summaryrefslogtreecommitdiff
path: root/fitz
diff options
context:
space:
mode:
authorTor Andersson <tor.andersson@artifex.com>2011-03-31 15:04:30 +0200
committerTor Andersson <tor.andersson@artifex.com>2011-03-31 15:04:30 +0200
commitaf6d16923fab4597e364c891fee2deb89998bdde (patch)
treea664fed72ae61c6447c80c35b8d8b477bf2a0076 /fitz
parentf158d944be90b6657c57f3ad850b814c1d5ade59 (diff)
downloadmupdf-af6d16923fab4597e364c891fee2deb89998bdde.tar.xz
xps: Fix bugs in TIFF reader.
WhiteIsBlack was flipped for fax images. re-multiplying alpha with CMYK images needs special care because of subtractive colors.
Diffstat (limited to 'fitz')
-rw-r--r--fitz/res_pixmap.c30
1 files changed, 24 insertions, 6 deletions
diff --git a/fitz/res_pixmap.c b/fitz/res_pixmap.c
index b37b7a3e..93fdb307 100644
--- a/fitz/res_pixmap.c
+++ b/fitz/res_pixmap.c
@@ -103,14 +103,32 @@ fz_premultiplypixmap(fz_pixmap *pix)
unsigned char *s = pix->samples;
unsigned char a;
int k, x, y;
- for (y = 0; y < pix->h; y++)
+
+ /* special case for CMYK (subtractive colors) */
+ if (pix->n == 5)
+ {
+ for (y = 0; y < pix->h; y++)
+ {
+ for (x = 0; x < pix->w; x++)
+ {
+ a = s[pix->n - 1];
+ for (k = 0; k < pix->n - 1; k++)
+ s[k] = 255 - fz_mul255(255 - s[k], a);
+ s += pix->n;
+ }
+ }
+ }
+ else
{
- for (x = 0; x < pix->w; x++)
+ for (y = 0; y < pix->h; y++)
{
- a = s[pix->n - 1];
- for (k = 0; k < pix->n - 1; k++)
- s[k] = fz_mul255(s[k], a);
- s += pix->n;
+ for (x = 0; x < pix->w; x++)
+ {
+ a = s[pix->n - 1];
+ for (k = 0; k < pix->n - 1; k++)
+ s[k] = fz_mul255(s[k], a);
+ s += pix->n;
+ }
}
}
}