From 4c45666cb302a7eab95d362989c0e7e087d8383f Mon Sep 17 00:00:00 2001 From: Robin Watts Date: Mon, 4 Mar 2013 15:40:22 +0000 Subject: Fix misalignment of rotated images. The recent positioning fix for bug 693640 caused a problem with rotated images. The fix is to only apply the previous fix when we have rectilinear scalings of images. --- draw/draw_affine.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/draw/draw_affine.c b/draw/draw_affine.c index c0fe1fea..5d4ca5b5 100644 --- a/draw/draw_affine.c +++ b/draw/draw_affine.c @@ -608,13 +608,15 @@ fz_paint_image_imp(fz_pixmap *dst, const fz_irect *scissor, fz_pixmap *shape, fz void (*paintfn)(byte *dp, byte *sp, int sw, int sh, int u, int v, int fa, int fb, int w, int n, int alpha, byte *color, byte *hp); fz_matrix local_ctm = *ctm; fz_rect rect; + int is_rectilinear; /* grid fit the image */ fz_gridfit_matrix(&local_ctm); /* turn on interpolation for upscaled and non-rectilinear transforms */ dolerp = 0; - if (!fz_is_rectilinear(&local_ctm)) + is_rectilinear = fz_is_rectilinear(&local_ctm); + if (!is_rectilinear) dolerp = 1; if (sqrtf(local_ctm.a * local_ctm.a + local_ctm.b * local_ctm.b) > img->w) dolerp = 1; @@ -673,11 +675,14 @@ fz_paint_image_imp(fz_pixmap *dst, const fz_irect *scissor, fz_pixmap *shape, fz * that we have found. */ if (dolerp) { u -= 32768; - if (u < 0) - u = 0; v -= 32768; - if (v < 0) - v = 0; + if (is_rectilinear) + { + if (u < 0) + u = 0; + if (v < 0) + v = 0; + } } dp = dst->samples + (unsigned int)(((y - dst->y) * dst->w + (x - dst->x)) * dst->n); -- cgit v1.2.3