summaryrefslogtreecommitdiff
path: root/source/fitz
diff options
context:
space:
mode:
authorTor Andersson <tor.andersson@artifex.com>2017-09-20 12:44:12 +0200
committerTor Andersson <tor.andersson@artifex.com>2017-09-20 12:44:17 +0200
commit91e23b63306baba7bdbae6a93fc124801e31ebc0 (patch)
tree613a4667719bb884c60f5351a82767044dd7b8e9 /source/fitz
parent2b16dbd8f73269cb15ca61ece75cf8d2d196ed28 (diff)
downloadmupdf-91e23b63306baba7bdbae6a93fc124801e31ebc0.tar.xz
Fix optional alpha pixmap support in gamma correction function.
Diffstat (limited to 'source/fitz')
-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 c5112985..4e3f62cb 100644
--- a/source/fitz/pixmap.c
+++ b/source/fitz/pixmap.c
@@ -842,6 +842,8 @@ fz_gamma_pixmap(fz_context *ctx, fz_pixmap *pix, float gamma)
{
unsigned char gamma_map[256];
unsigned char *s = pix->samples;
+ int n1 = pix->n - pix->alpha;
+ int n = pix->n;
int k, x, y;
for (k = 0; k < 256; k++)
@@ -851,11 +853,11 @@ fz_gamma_pixmap(fz_context *ctx, fz_pixmap *pix, float gamma)
{
for (x = 0; x < pix->w; x++)
{
- for (k = 0; k < pix->n - 1; k++)
+ for (k = 0; k < n1; k++)
s[k] = gamma_map[s[k]];
- s += pix->n;
+ s += n;
}
- s += pix->stride - pix->w * pix->n;
+ s += pix->stride - pix->w * n;
}
}