diff options
author | Tor Andersson <tor@ghostscript.com> | 2009-04-08 13:16:43 +0200 |
---|---|---|
committer | Tor Andersson <tor@ghostscript.com> | 2009-04-08 13:16:43 +0200 |
commit | ed53573c4611d24e345477f8af457417c61759b0 (patch) | |
tree | f1b27bafdc80a77a4381986a45e95d1fc97706fb | |
parent | 7a1c8d86f519c789d0f743754f7f0734bf338306 (diff) | |
download | mupdf-ed53573c4611d24e345477f8af457417c61759b0.tar.xz |
Use a slower but correct division in image bit depth scaling/clamping.
-rw-r--r-- | mupdf/pdf_image.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/mupdf/pdf_image.c b/mupdf/pdf_image.c index 71f14e39..15984551 100644 --- a/mupdf/pdf_image.c +++ b/mupdf/pdf_image.c @@ -541,7 +541,7 @@ pdf_loadtile(fz_image *img, fz_pixmap *tile) { fz_pixmap *tmp; int x, y, k, i; - int invbpcfact = 1<<16; + int bpcfact = 1<<16; error = fz_newpixmap(&tmp, tile->x, tile->y, tile->w, tile->h, 1); if (error) @@ -549,10 +549,10 @@ pdf_loadtile(fz_image *img, fz_pixmap *tile) switch (src->bpc) { - case 1: invbpcfact = (1<<16) / 255; break; - case 2: invbpcfact = (1<<16) / 85; break; - case 4: invbpcfact = (1<<16) / 17; break; - case 8: invbpcfact = (1<<16) / 1; break; + case 1: bpcfact = 255; break; + case 2: bpcfact = 85; break; + case 4: bpcfact = 17; break; + case 8: bpcfact = 1; break; } tilefunc(src->samples->rp + (tile->y * src->stride), src->stride, @@ -570,7 +570,7 @@ pdf_loadtile(fz_image *img, fz_pixmap *tile) for (x = 0; x < tile->w; x++) { dst[x * dn] = 255; /* alpha */ - i = st[x] * invbpcfact >> 16; + i = st[x] / bpcfact; i = CLAMP(i, 0, high); for (k = 0; k < sn; k++) { |