diff options
author | Robin Watts <robin.watts@artifex.com> | 2011-11-08 17:46:48 +0000 |
---|---|---|
committer | Robin Watts <robin.watts@artifex.com> | 2011-11-14 16:32:45 +0000 |
commit | 5c4ff53fb89b5068bc901fd5909be9e5d2d0cb0b (patch) | |
tree | 8dc1faaa37e23192dc586a00d7e7e95a1439366f /draw/draw_device.c | |
parent | a6e91235376900869f74673caf7bf17fc257bdd7 (diff) | |
download | mupdf-5c4ff53fb89b5068bc901fd5909be9e5d2d0cb0b.tar.xz |
Grid fitting tweaks.
Extract the grid fitting code from the scaling code and the affine image
drawing code into it's own separate function. This reduces code
duplication. It also allows us to make better allowance for rounding
errors.
Add a voodoo offset in the draw_affine.c code for painting interpolated
images. This gives us the best possible match between all the different
combinations of scaled/unscaled and interpolated/uninterpolated images.
Diffstat (limited to 'draw/draw_device.c')
-rw-r--r-- | draw/draw_device.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/draw/draw_device.c b/draw/draw_device.c index 76b55276..0efe701a 100644 --- a/draw/draw_device.c +++ b/draw/draw_device.c @@ -862,7 +862,10 @@ fz_transform_pixmap(fz_pixmap *image, fz_matrix *ctm, int x, int y, int dx, int if (ctm->a != 0 && ctm->b == 0 && ctm->c == 0 && ctm->d != 0) { /* Unrotated or X-flip or Y-flip or XY-flip */ - scaled = fz_scale_pixmap_gridfit(image, ctm->e, ctm->f, ctm->a, ctm->d, gridfit); + fz_matrix m = *ctm; + if (gridfit) + fz_gridfit_matrix(&m); + scaled = fz_scale_pixmap(image, m.e, m.f, m.a, m.d); if (scaled == NULL) return NULL; ctm->a = scaled->w; @@ -875,7 +878,10 @@ fz_transform_pixmap(fz_pixmap *image, fz_matrix *ctm, int x, int y, int dx, int if (ctm->a == 0 && ctm->b != 0 && ctm->c != 0 && ctm->d == 0) { /* Other orthogonal flip/rotation cases */ - scaled = fz_scale_pixmap_gridfit(image, ctm->f, ctm->e, ctm->b, ctm->c, gridfit); + fz_matrix m = *ctm; + if (gridfit) + fz_gridfit_matrix(&m); + scaled = fz_scale_pixmap(image, m.f, m.e, m.b, m.c); if (scaled == NULL) return NULL; ctm->b = scaled->w; |