diff options
author | Robin Watts <robin.watts@artifex.com> | 2016-05-20 13:06:31 +0100 |
---|---|---|
committer | Robin Watts <robin.watts@artifex.com> | 2016-05-20 13:09:45 +0100 |
commit | 52b0e6eba7f4597674fa6a1a2056523595449263 (patch) | |
tree | a3f9f66ba0e3a1c134188fb57b6f22d96eebdb5e /source | |
parent | 3cfdde1c1431d0ba3ca018b1dd79a384668d7d75 (diff) | |
download | mupdf-52b0e6eba7f4597674fa6a1a2056523595449263.tar.xz |
Remove voodoo from draw-affine.
We had some code in draw-affine that we didn't really understand.
Change this for some code that seems more plausible.
The voodoo code was showing up problems with the plotter rework
(don't really know why), but the non-voodoo code seems happier.
Diffstat (limited to 'source')
-rw-r--r-- | source/fitz/draw-affine.c | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/source/fitz/draw-affine.c b/source/fitz/draw-affine.c index c05c70a7..110c0085 100644 --- a/source/fitz/draw-affine.c +++ b/source/fitz/draw-affine.c @@ -1062,19 +1062,13 @@ fz_paint_image_imp(fz_pixmap *dst, const fz_irect *scissor, fz_pixmap *shape, fz u = (int)((local_ctm.a * x) + (local_ctm.c * y) + local_ctm.e + ((local_ctm.a + local_ctm.c) * .5f)); v = (int)((local_ctm.b * x) + (local_ctm.d * y) + local_ctm.f + ((local_ctm.b + local_ctm.d) * .5f)); - /* RJW: The following is voodoo. No idea why it works, but it gives - * the best match between scaled/unscaled/interpolated/non-interpolated - * that we have found. */ - if (dolerp) { - u -= 32768; - v -= 32768; - if (is_rectilinear) - { - if (u < 0) - u = 0; - if (v < 0) - v = 0; - } + /* If we are not linearly interpolating, then we use 'nearest'. We round u and v downwards + * each time, which isn't really "nearest". Bias them by a rounding constant now to adjust + * for this. */ + if (!dolerp) + { + u += 32768; + v += 32768; } dp = dst->samples + (unsigned int)(((y - dst->y) * dst->w + (x - dst->x)) * dst->n); |