diff options
author | Tor Andersson <tor@ghostscript.com> | 2011-02-08 08:37:25 +0000 |
---|---|---|
committer | Tor Andersson <tor@ghostscript.com> | 2011-02-08 08:37:25 +0000 |
commit | 1b8a2963bd93117e72d2a5159e739a77e455c37f (patch) | |
tree | 8aa94c005529ad52c92d07cbefdc7fe3be76de51 /fitz | |
parent | 385b171b8bef464bbf652c81d85728ccb064ab86 (diff) | |
download | mupdf-1b8a2963bd93117e72d2a5159e739a77e455c37f.tar.xz |
Only interpolate upscaled images when the interpolate flag is set in the image dictionary.
Diffstat (limited to 'fitz')
-rw-r--r-- | fitz/dev_draw.c | 6 | ||||
-rw-r--r-- | fitz/fitz.h | 1 | ||||
-rw-r--r-- | fitz/res_colorspace.c | 4 | ||||
-rw-r--r-- | fitz/res_pixmap.c | 1 |
4 files changed, 9 insertions, 3 deletions
diff --git a/fitz/dev_draw.c b/fitz/dev_draw.c index 439c4115..4d3c94f2 100644 --- a/fitz/dev_draw.c +++ b/fitz/dev_draw.c @@ -601,7 +601,7 @@ fz_drawfillimage(void *user, fz_pixmap *image, fz_matrix ctm, float alpha) #ifdef SMOOTHSCALE dx = sqrtf(ctm.a * ctm.a + ctm.b * ctm.b); dy = sqrtf(ctm.c * ctm.c + ctm.d * ctm.d); - if (dx < image->w && dy < image->h) + if (dx < image->w || dy < image->h) { scaled = fz_smoothtransformpixmap(image, &ctm, dev->dest->x, dev->dest->y, dx, dy); if (scaled == nil) @@ -649,7 +649,7 @@ fz_drawfillimagemask(void *user, fz_pixmap *image, fz_matrix ctm, #ifdef SMOOTHSCALE dx = sqrtf(ctm.a * ctm.a + ctm.b * ctm.b); dy = sqrtf(ctm.c * ctm.c + ctm.d * ctm.d); - if (dx < image->w && dy < image->h) + if (dx < image->w || dy < image->h) { scaled = fz_smoothtransformpixmap(image, &ctm, dev->dest->x, dev->dest->y, dx, dy); if (scaled == nil) @@ -720,7 +720,7 @@ fz_drawclipimagemask(void *user, fz_pixmap *image, fz_matrix ctm) #ifdef SMOOTHSCALE dx = sqrtf(ctm.a * ctm.a + ctm.b * ctm.b); dy = sqrtf(ctm.c * ctm.c + ctm.d * ctm.d); - if (dx < image->w && dy < image->h) + if (dx < image->w || dy < image->h) { scaled = fz_smoothtransformpixmap(image, &ctm, dev->dest->x, dev->dest->y, dx, dy); if (scaled == nil) diff --git a/fitz/fitz.h b/fitz/fitz.h index 6a339303..685a75f3 100644 --- a/fitz/fitz.h +++ b/fitz/fitz.h @@ -611,6 +611,7 @@ struct fz_pixmap_s int refs; int x, y, w, h, n; fz_pixmap *mask; /* explicit soft/image mask */ + int interpolate; fz_colorspace *colorspace; unsigned char *samples; int freesamples; diff --git a/fitz/res_colorspace.c b/fitz/res_colorspace.c index f3ea317d..09e6c349 100644 --- a/fitz/res_colorspace.c +++ b/fitz/res_colorspace.c @@ -497,6 +497,10 @@ fz_convertpixmap(fz_pixmap *sp, fz_pixmap *dp) assert(ss && ds); + if (sp->mask) + dp->mask = fz_keeppixmap(sp->mask); + dp->interpolate = sp->interpolate; + if (ss == fz_devicegray) { if (ds == fz_devicergb) fastgraytorgb(sp, dp); diff --git a/fitz/res_pixmap.c b/fitz/res_pixmap.c index 88e10230..e70d084d 100644 --- a/fitz/res_pixmap.c +++ b/fitz/res_pixmap.c @@ -12,6 +12,7 @@ fz_newpixmapwithdata(fz_colorspace *colorspace, int x, int y, int w, int h, unsi pix->w = w; pix->h = h; pix->mask = nil; + pix->interpolate = 1; pix->colorspace = nil; pix->n = 1; |