summaryrefslogtreecommitdiff
path: root/fitz
diff options
context:
space:
mode:
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;
+ }
}
}
}