diff options
author | Robin Watts <robin.watts@artifex.com> | 2016-05-23 17:45:21 +0100 |
---|---|---|
committer | Robin Watts <robin.watts@artifex.com> | 2016-05-24 12:48:35 +0100 |
commit | d0b78f4166a1503ce522944002b3aab035724cd9 (patch) | |
tree | b8c680dc401db56a28be1110759219c7c175dd8d /source/fitz/load-jpx.c | |
parent | 841952db71d6541a2e98fd4d1d49dede284b2cf8 (diff) | |
download | mupdf-d0b78f4166a1503ce522944002b3aab035724cd9.tar.xz |
fz_pixmap revamp: add stride and make alpha optional
fz_pixmaps now have an explicit stride value. By default no change
from before, but code all copes with extra gaps at the end of the
line.
The alpha data in fz_pixmaps is no longer compulsory.
mudraw: use rgb not rgba (ppmraw), cmyk not cmyka (pkmraw).
Update halftone code to not expect alpha plane.
Update PNG writing to cope with alpha less input.
Also hide repeated params within the png output context.
ARM code needs updating.
Diffstat (limited to 'source/fitz/load-jpx.c')
-rw-r--r-- | source/fitz/load-jpx.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/source/fitz/load-jpx.c b/source/fitz/load-jpx.c index 3ea7775c..6a8c36c0 100644 --- a/source/fitz/load-jpx.c +++ b/source/fitz/load-jpx.c @@ -83,7 +83,7 @@ fz_load_jpx(fz_context *ctx, unsigned char *data, int size, fz_colorspace *defcs unsigned char *p; OPJ_CODEC_FORMAT format; int a, n, w, h, depth, sgnd; - int x, y, k, v; + int x, y, k, v, stride; stream_block sb; if (size < 2) @@ -204,7 +204,7 @@ fz_load_jpx(fz_context *ctx, unsigned char *data, int size, fz_colorspace *defcs fz_try(ctx) { - img = fz_new_pixmap(ctx, colorspace, w, h); + img = fz_new_pixmap(ctx, colorspace, w, h, 1); } fz_catch(ctx) { @@ -213,6 +213,7 @@ fz_load_jpx(fz_context *ctx, unsigned char *data, int size, fz_colorspace *defcs } p = img->samples; + stride = img->stride - w * (n + 1); for (y = 0; y < h; y++) { for (x = 0; x < w; x++) @@ -231,6 +232,7 @@ fz_load_jpx(fz_context *ctx, unsigned char *data, int size, fz_colorspace *defcs if (!a) *p++ = 255; } + p += stride; } opj_image_destroy(jpx); @@ -239,7 +241,7 @@ fz_load_jpx(fz_context *ctx, unsigned char *data, int size, fz_colorspace *defcs { if (n == 4) { - fz_pixmap *tmp = fz_new_pixmap(ctx, fz_device_rgb(ctx), w, h); + fz_pixmap *tmp = fz_new_pixmap(ctx, fz_device_rgb(ctx), w, h, 1); fz_convert_pixmap(ctx, tmp, img); fz_drop_pixmap(ctx, img); img = tmp; |