diff options
author | Robin Watts <robin.watts@artifex.com> | 2016-04-14 10:54:12 +0100 |
---|---|---|
committer | Robin Watts <robin.watts@artifex.com> | 2016-04-28 12:30:42 +0100 |
commit | 88e9fd50724cff8d656060715fa56409ba7dab84 (patch) | |
tree | 9e9487ddba3198f7432850f4c736da90b3d101dc /source | |
parent | 3dc16d54db4669415412bb44790d4653962747f6 (diff) | |
download | mupdf-88e9fd50724cff8d656060715fa56409ba7dab84.tar.xz |
Tweak fz_image in preparation for things to come.
Move from ints to bits where possible.
Diffstat (limited to 'source')
-rw-r--r-- | source/fitz/image.c | 7 | ||||
-rw-r--r-- | source/pdf/pdf-image.c | 14 |
2 files changed, 11 insertions, 10 deletions
diff --git a/source/fitz/image.c b/source/fitz/image.c index c622c92b..931eb44e 100644 --- a/source/fitz/image.c +++ b/source/fitz/image.c @@ -234,7 +234,7 @@ fz_decomp_image_from_stream(fz_context *ctx, fz_stream *stm, fz_image *image, fz samples = NULL; /* color keyed transparency */ - if (image->usecolorkey && !image->mask) + if (image->use_colorkey && !image->mask) fz_mask_color_key(tile, image->n, image->colorkey); if (indexed) @@ -251,7 +251,7 @@ fz_decomp_image_from_stream(fz_context *ctx, fz_stream *stm, fz_image *image, fz } /* pre-blended matte color */ - if (image->usecolorkey && image->mask) + if (image->use_colorkey && image->mask) fz_unblend_masked_tile(ctx, tile, image); } fz_always(ctx) @@ -462,6 +462,7 @@ fz_get_pixmap_from_image(fz_context *ctx, fz_image *image, const fz_irect *subar else for (l2factor=0; image->w>>(l2factor+1) >= w+2 && image->h>>(l2factor+1) >= h+2 && l2factor < 6; l2factor++); + /* Now figure out if we want to decode just a subarea */ if (subarea == NULL) { @@ -628,7 +629,7 @@ fz_new_image(fz_context *ctx, int w, int h, int bpc, fz_colorspace *colorspace, image->invert_cmyk_jpeg = 1; image->interpolate = interpolate; image->imagemask = imagemask; - image->usecolorkey = (colorkey != NULL); + image->use_colorkey = (colorkey != NULL); if (colorkey) memcpy(image->colorkey, colorkey, sizeof(int)*image->n*2); if (decode) diff --git a/source/pdf/pdf-image.c b/source/pdf/pdf-image.c index e0da7ad9..86ec41d8 100644 --- a/source/pdf/pdf-image.c +++ b/source/pdf/pdf-image.c @@ -14,7 +14,7 @@ pdf_load_image_imp(fz_context *ctx, pdf_document *doc, pdf_obj *rdb, pdf_obj *di int interpolate; int indexed; fz_image *mask = NULL; /* explicit mask/soft mask image */ - int usecolorkey = 0; + int use_colorkey = 0; fz_colorspace *colorspace = NULL; float decode[FZ_MAX_COLORS * 2]; int colorkey[FZ_MAX_COLORS * 2]; @@ -64,7 +64,7 @@ pdf_load_image_imp(fz_context *ctx, pdf_document *doc, pdf_obj *rdb, pdf_obj *di interpolate = pdf_to_bool(ctx, pdf_dict_geta(ctx, dict, PDF_NAME_Interpolate, PDF_NAME_I)); indexed = 0; - usecolorkey = 0; + use_colorkey = 0; if (imagemask) bpc = 1; @@ -130,7 +130,7 @@ pdf_load_image_imp(fz_context *ctx, pdf_document *doc, pdf_obj *rdb, pdf_obj *di obj = pdf_dict_get(ctx, obj, PDF_NAME_Matte); if (pdf_is_array(ctx, obj)) { - usecolorkey = 1; + use_colorkey = 1; for (i = 0; i < n; i++) colorkey[i] = pdf_to_real(ctx, pdf_array_get(ctx, obj, i)) * 255; } @@ -138,13 +138,13 @@ pdf_load_image_imp(fz_context *ctx, pdf_document *doc, pdf_obj *rdb, pdf_obj *di } else if (pdf_is_array(ctx, obj)) { - usecolorkey = 1; + use_colorkey = 1; for (i = 0; i < n * 2; i++) { if (!pdf_is_int(ctx, pdf_array_get(ctx, obj, i))) { fz_warn(ctx, "invalid value in color key mask"); - usecolorkey = 0; + use_colorkey = 0; } colorkey[i] = pdf_to_int(ctx, pdf_array_get(ctx, obj, i)); } @@ -158,14 +158,14 @@ pdf_load_image_imp(fz_context *ctx, pdf_document *doc, pdf_obj *rdb, pdf_obj *di int num = pdf_to_num(ctx, dict); int gen = pdf_to_gen(ctx, dict); buffer = pdf_load_compressed_stream(ctx, doc, num, gen); - image = fz_new_image(ctx, w, h, bpc, colorspace, 96, 96, interpolate, imagemask, decode, usecolorkey ? colorkey : NULL, buffer, mask); + image = fz_new_image(ctx, w, h, bpc, colorspace, 96, 96, interpolate, imagemask, decode, use_colorkey ? colorkey : NULL, buffer, mask); image->invert_cmyk_jpeg = 0; } else { /* Inline stream */ stride = (w * n * bpc + 7) / 8; - image = fz_new_image(ctx, w, h, bpc, colorspace, 96, 96, interpolate, imagemask, decode, usecolorkey ? colorkey : NULL, NULL, mask); + image = fz_new_image(ctx, w, h, bpc, colorspace, 96, 96, interpolate, imagemask, decode, use_colorkey ? colorkey : NULL, NULL, mask); image->invert_cmyk_jpeg = 0; pdf_load_compressed_inline_image(ctx, doc, dict, stride * h, cstm, indexed, image); } |