diff options
author | Tor Andersson <tor.andersson@artifex.com> | 2017-09-20 12:44:12 +0200 |
---|---|---|
committer | Tor Andersson <tor.andersson@artifex.com> | 2017-09-20 12:44:17 +0200 |
commit | 91e23b63306baba7bdbae6a93fc124801e31ebc0 (patch) | |
tree | 613a4667719bb884c60f5351a82767044dd7b8e9 /source | |
parent | 2b16dbd8f73269cb15ca61ece75cf8d2d196ed28 (diff) | |
download | mupdf-91e23b63306baba7bdbae6a93fc124801e31ebc0.tar.xz |
Fix optional alpha pixmap support in gamma correction function.
Diffstat (limited to 'source')
-rw-r--r-- | source/fitz/pixmap.c | 8 |
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; } } |