summaryrefslogtreecommitdiff
path: root/draw
diff options
context:
space:
mode:
authorRobin Watts <robin.watts@artifex.com>2013-03-04 15:40:22 +0000
committerRobin Watts <robin.watts@artifex.com>2013-03-04 15:43:57 +0000
commit4c45666cb302a7eab95d362989c0e7e087d8383f (patch)
tree7dc6d5b82ac103a5c13e43ed90ba06abe4495e4d /draw
parent8206ffe7013dd361d27519950ee5d285e4554e58 (diff)
downloadmupdf-4c45666cb302a7eab95d362989c0e7e087d8383f.tar.xz
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.
Diffstat (limited to 'draw')
-rw-r--r--draw/draw_affine.c15
1 files 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);