From 7168509ae3cfa884c12d0ea134bc7d43b11a632d Mon Sep 17 00:00:00 2001 From: Sebastian Rasmussen Date: Wed, 3 May 2017 02:27:11 +0800 Subject: tiff: Support images with 24/32 bits per component. --- source/fitz/draw-unpack.c | 4 ++++ source/fitz/load-tiff.c | 2 ++ 2 files changed, 6 insertions(+) (limited to 'source') diff --git a/source/fitz/draw-unpack.c b/source/fitz/draw-unpack.c index e3c4c5b2..2b6a241e 100644 --- a/source/fitz/draw-unpack.c +++ b/source/fitz/draw-unpack.c @@ -10,6 +10,8 @@ #define get4(buf,x) ((buf[x >> 1] >> ( ( 1 - (x & 1) ) << 2 ) ) & 15 ) #define get8(buf,x) (buf[x]) #define get16(buf,x) (buf[x << 1]) +#define get24(buf,x) (buf[(x << 1) + x]) +#define get32(buf,x) (buf[x << 2]) static unsigned char get1_tab_1[256][8]; static unsigned char get1_tab_1p[256][16]; @@ -186,6 +188,8 @@ fz_unpack_tile(fz_context *ctx, fz_pixmap *dst, unsigned char * restrict src, in case 4: *dp++ = get4(sp, b) * scale; break; case 8: *dp++ = get8(sp, b); break; case 16: *dp++ = get16(sp, b); break; + case 24: *dp++ = get24(sp, b); break; + case 32: *dp++ = get32(sp, b); break; } b++; } diff --git a/source/fitz/load-tiff.c b/source/fitz/load-tiff.c index 76df053a..56140e89 100644 --- a/source/fitz/load-tiff.c +++ b/source/fitz/load-tiff.c @@ -430,6 +430,8 @@ tiff_paste_tile(fz_context *ctx, struct tiff *tiff, unsigned char *tile, unsigne case 4: *dst |= (*src >> (4 - 4 * ((col + x) % 2))) & 0xf; break; case 8: *dst = *src; break; case 16: dst[0] = src[0]; dst[1] = src[1]; break; + case 24: dst[0] = src[0]; dst[1] = src[1]; dst[2] = src[2]; break; + case 32: dst[0] = src[0]; dst[1] = src[1]; dst[2] = src[2]; dst[3] = src[3]; break; } } } -- cgit v1.2.3