diff options
author | Robin Watts <robin.watts@artifex.com> | 2012-03-15 18:59:11 +0000 |
---|---|---|
committer | Robin Watts <robin.watts@artifex.com> | 2012-03-15 18:59:11 +0000 |
commit | fa05641381427855c7ce45138572aa44178d2a25 (patch) | |
tree | 80271cec4924fa84fe8b6fa895424d9ef51aebd2 /fitz/image_png.c | |
parent | 22bbb6e6d3bcd01b164e91ecf500dc9d7305269e (diff) | |
download | mupdf-fa05641381427855c7ce45138572aa44178d2a25.tar.xz |
Fix 2 regressions in xps test files due to palette change.
When coping with missing transparency entries, fill with 255,
not 0. Simplify code slightly so we fill completely, not just
to depth.
Diffstat (limited to 'fitz/image_png.c')
-rw-r--r-- | fitz/image_png.c | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/fitz/image_png.c b/fitz/image_png.c index c846e156..aeb33137 100644 --- a/fitz/image_png.c +++ b/fitz/image_png.c @@ -297,10 +297,7 @@ png_read_plte(struct info *info, unsigned char *p, int size) } /* Fill in any missing palette entries */ - n = 1 << info->depth; - if (n > 256) - n = 256; - for (; i < n; i++) + for (; i < 256; i++) { info->palette[i * 4] = 0; info->palette[i * 4 + 1] = 0; @@ -325,11 +322,8 @@ png_read_trns(struct info *info, unsigned char *p, int size) for (i = 0; i < size; i++) info->palette[i * 4 + 3] = p[i]; /* Fill in any missing entries */ - size = (1 << info->depth); - if (size > 256) - size = 256; - for (; i < size; i++) - info->palette[i * 4 + 3] = 0; + for (; i < 256; i++) + info->palette[i * 4 + 3] = 255; } else { |