diff options
author | Robin Watts <robin.watts@artifex.com> | 2016-01-12 17:30:59 +0000 |
---|---|---|
committer | Robin Watts <robin.watts@artifex.com> | 2016-01-13 12:32:58 +0000 |
commit | ad8936bf2bcf54c7042bdec20c49c96657649b34 (patch) | |
tree | 0d6e309f5747e493632b72b34acef1e53e1ed9d7 /source/fitz/image.c | |
parent | 881b7ea89588677e709aaa7d3d0ffe4aed63822a (diff) | |
download | mupdf-ad8936bf2bcf54c7042bdec20c49c96657649b34.tar.xz |
Add lots of consts.
In general, we should use 'const fz_blah' in device calls whenever
the callee should not alter the fz_blah.
Push this through. This shows up various places where we fz_keep
and fz_drop these const things.
I've updated the fz_keep and fz_drops with appropriate casts
to remove the consts. We may need to do the union dance to avoid
the consts for some compilers, but will only do that if required.
I think this is nicer overall, even allowing for the const<->no const
problems.
Diffstat (limited to 'source/fitz/image.c')
-rw-r--r-- | source/fitz/image.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/source/fitz/image.c b/source/fitz/image.c index 34f0dd6a..297e6263 100644 --- a/source/fitz/image.c +++ b/source/fitz/image.c @@ -3,13 +3,13 @@ #define SANE_DPI 72.0f fz_image * -fz_keep_image(fz_context *ctx, fz_image *image) +fz_keep_image(fz_context *ctx, const fz_image *image) { return (fz_image *)fz_keep_storable(ctx, &image->storable); } void -fz_drop_image(fz_context *ctx, fz_image *image) +fz_drop_image(fz_context *ctx, const fz_image *image) { fz_drop_storable(ctx, &image->storable); } @@ -18,7 +18,7 @@ typedef struct fz_image_key_s fz_image_key; struct fz_image_key_s { int refs; - fz_image *image; + const fz_image *image; int l2factor; }; @@ -74,7 +74,7 @@ static fz_store_type fz_image_store_type = }; static void -fz_mask_color_key(fz_pixmap *pix, int n, int *colorkey) +fz_mask_color_key(fz_pixmap *pix, int n, const int *colorkey) { unsigned char *p = pix->samples; int len = pix->w * pix->h; @@ -93,7 +93,7 @@ fz_mask_color_key(fz_pixmap *pix, int n, int *colorkey) } static void -fz_unblend_masked_tile(fz_context *ctx, fz_pixmap *tile, fz_image *image) +fz_unblend_masked_tile(fz_context *ctx, fz_pixmap *tile, const fz_image *image) { fz_pixmap *mask = fz_get_pixmap_from_image(ctx, image->mask, tile->w, tile->h); unsigned char *s = mask->samples, *end = s + mask->w * mask->h; @@ -121,7 +121,7 @@ fz_unblend_masked_tile(fz_context *ctx, fz_pixmap *tile, fz_image *image) } fz_pixmap * -fz_decomp_image_from_stream(fz_context *ctx, fz_stream *stm, fz_image *image, int indexed, int l2factor) +fz_decomp_image_from_stream(fz_context *ctx, fz_stream *stm, const fz_image *image, int indexed, int l2factor) { fz_pixmap *tile = NULL; int stride, len, i; @@ -218,7 +218,7 @@ fz_drop_image_imp(fz_context *ctx, fz_storable *image_) } static fz_pixmap * -standard_image_get_pixmap(fz_context *ctx, fz_image *image, int w, int h, int *l2factor) +standard_image_get_pixmap(fz_context *ctx, const fz_image *image, int w, int h, int *l2factor) { int native_l2factor; fz_stream *stm; @@ -285,7 +285,7 @@ standard_image_get_pixmap(fz_context *ctx, fz_image *image, int w, int h, int *l } fz_pixmap * -fz_get_pixmap_from_image(fz_context *ctx, fz_image *image, int w, int h) +fz_get_pixmap_from_image(fz_context *ctx, const fz_image *image, int w, int h) { fz_pixmap *tile; int l2factor, l2factor_remaining; |