From 52b0e6eba7f4597674fa6a1a2056523595449263 Mon Sep 17 00:00:00 2001 From: Robin Watts Date: Fri, 20 May 2016 13:06:31 +0100 Subject: 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. --- source/fitz/draw-affine.c | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) (limited to 'source/fitz') 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); -- cgit v1.2.3