summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source/fitz/pixmap.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/source/fitz/pixmap.c b/source/fitz/pixmap.c
index a8c7da4c..1d985fa9 100644
--- a/source/fitz/pixmap.c
+++ b/source/fitz/pixmap.c
@@ -781,16 +781,18 @@ fz_invert_pixmap(fz_context *ctx, fz_pixmap *pix)
{
unsigned char *s = pix->samples;
int k, x, y;
+ int n1 = pix->n - pix->alpha;
+ int n = pix->n;
for (y = 0; y < pix->h; y++)
{
for (x = 0; x < pix->w; x++)
{
- for (k = 0; k < pix->n - 1; k++)
+ for (k = 0; k < n1; k++)
s[k] = 255 - s[k];
- s += pix->n;
+ s += n;
}
- s += pix->stride - pix->w * pix->n;
+ s += pix->stride - pix->w * n;
}
}