summaryrefslogtreecommitdiff
path: root/fitz/res_pixmap.c
diff options
context:
space:
mode:
authorTor Andersson <tor.andersson@artifex.com>2011-04-04 21:17:14 +0200
committerTor Andersson <tor.andersson@artifex.com>2011-04-04 21:17:14 +0200
commit05a6d9c992ebac6ec7a382c6f124e0e4f817a1ca (patch)
treec5b8332045547e7d729daa204a28fde6fdb124c9 /fitz/res_pixmap.c
parent0a48595b5721790d2010a089e71688e804b78744 (diff)
downloadmupdf-05a6d9c992ebac6ec7a382c6f124e0e4f817a1ca.tar.xz
xps: Convert CMYK with alpha to RGB early to avoid premul alpha headaches.
Diffstat (limited to 'fitz/res_pixmap.c')
-rw-r--r--fitz/res_pixmap.c29
1 files changed, 6 insertions, 23 deletions
diff --git a/fitz/res_pixmap.c b/fitz/res_pixmap.c
index 9f336ab1..85138be1 100644
--- a/fitz/res_pixmap.c
+++ b/fitz/res_pixmap.c
@@ -106,31 +106,14 @@ fz_premultiplypixmap(fz_pixmap *pix)
unsigned char a;
int k, x, y;
- /* special case for CMYK (subtractive colors) */
- if (pix->n == 5)
+ for (y = 0; y < pix->h; y++)
{
- for (y = 0; y < pix->h; y++)
+ for (x = 0; x < pix->w; x++)
{
- 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 (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] = fz_mul255(s[k], a);
- s += pix->n;
- }
+ a = s[pix->n - 1];
+ for (k = 0; k < pix->n - 1; k++)
+ s[k] = fz_mul255(s[k], a);
+ s += pix->n;
}
}
}