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 /include | |
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 'include')
-rw-r--r-- | include/mupdf/fitz/colorspace.h | 20 | ||||
-rw-r--r-- | include/mupdf/fitz/device.h | 60 | ||||
-rw-r--r-- | include/mupdf/fitz/font.h | 16 | ||||
-rw-r--r-- | include/mupdf/fitz/glyph-cache.h | 28 | ||||
-rw-r--r-- | include/mupdf/fitz/image.h | 11 | ||||
-rw-r--r-- | include/mupdf/fitz/output-png.h | 2 | ||||
-rw-r--r-- | include/mupdf/fitz/path.h | 6 | ||||
-rw-r--r-- | include/mupdf/fitz/pixmap.h | 6 | ||||
-rw-r--r-- | include/mupdf/fitz/shade.h | 10 | ||||
-rw-r--r-- | include/mupdf/fitz/store.h | 6 | ||||
-rw-r--r-- | include/mupdf/fitz/text.h | 8 | ||||
-rw-r--r-- | include/mupdf/pdf/resource.h | 2 |
12 files changed, 87 insertions, 88 deletions
diff --git a/include/mupdf/fitz/colorspace.h b/include/mupdf/fitz/colorspace.h index b1b82999..0839e0eb 100644 --- a/include/mupdf/fitz/colorspace.h +++ b/include/mupdf/fitz/colorspace.h @@ -74,19 +74,19 @@ struct fz_colorspace_s unsigned int size; char name[16]; int n; - void (*to_rgb)(fz_context *ctx, fz_colorspace *, const float *src, float *rgb); - void (*from_rgb)(fz_context *ctx, fz_colorspace *, const float *rgb, float *dst); - void (*free_data)(fz_context *Ctx, fz_colorspace *); + void (*to_rgb)(fz_context *ctx, const fz_colorspace *, const float *src, float *rgb); + void (*from_rgb)(fz_context *ctx, const fz_colorspace *, const float *rgb, float *dst); + void (*free_data)(fz_context *Ctx, const fz_colorspace *); void *data; }; fz_colorspace *fz_new_colorspace(fz_context *ctx, char *name, int n); fz_colorspace *fz_new_indexed_colorspace(fz_context *ctx, fz_colorspace *base, int high, unsigned char *lookup); -fz_colorspace *fz_keep_colorspace(fz_context *ctx, fz_colorspace *colorspace); -void fz_drop_colorspace(fz_context *ctx, fz_colorspace *colorspace); +fz_colorspace *fz_keep_colorspace(fz_context *ctx, const fz_colorspace *colorspace); +void fz_drop_colorspace(fz_context *ctx, const fz_colorspace *colorspace); void fz_drop_colorspace_imp(fz_context *ctx, fz_storable *colorspace); -void fz_convert_color(fz_context *ctx, fz_colorspace *dsts, float *dstv, fz_colorspace *srcs, const float *srcv); +void fz_convert_color(fz_context *ctx, const fz_colorspace *dsts, float *dstv, const fz_colorspace *srcs, const float *srcv); void fz_new_colorspace_context(fz_context *ctx); fz_colorspace_context *fz_keep_colorspace_context(fz_context *ctx); @@ -101,14 +101,14 @@ typedef struct fz_color_converter_s fz_color_converter; struct fz_color_converter_s { void (*convert)(fz_context *, fz_color_converter *, float *, const float *); - fz_colorspace *ds; - fz_colorspace *ss; + const fz_colorspace *ds; + const fz_colorspace *ss; void *opaque; }; -void fz_lookup_color_converter(fz_context *ctx, fz_color_converter *cc, fz_colorspace *ds, fz_colorspace *ss); +void fz_lookup_color_converter(fz_context *ctx, fz_color_converter *cc, const fz_colorspace *ds, const fz_colorspace *ss); -void fz_init_cached_color_converter(fz_context *ctx, fz_color_converter *cc, fz_colorspace *ds, fz_colorspace *ss); +void fz_init_cached_color_converter(fz_context *ctx, fz_color_converter *cc, const fz_colorspace *ds, const fz_colorspace *ss); void fz_fin_cached_color_converter(fz_context *ctx, fz_color_converter *cc); #endif diff --git a/include/mupdf/fitz/device.h b/include/mupdf/fitz/device.h index 95c56c65..8c2c0219 100644 --- a/include/mupdf/fitz/device.h +++ b/include/mupdf/fitz/device.h @@ -106,25 +106,25 @@ struct fz_device_s void (*begin_page)(fz_context *, fz_device *, const fz_rect *rect, const fz_matrix *ctm); void (*end_page)(fz_context *, fz_device *); - void (*fill_path)(fz_context *, fz_device *, fz_path *, int even_odd, const fz_matrix *, fz_colorspace *, float *color, float alpha); - void (*stroke_path)(fz_context *, fz_device *, fz_path *, fz_stroke_state *, const fz_matrix *, fz_colorspace *, float *color, float alpha); - void (*clip_path)(fz_context *, fz_device *, fz_path *, const fz_rect *rect, int even_odd, const fz_matrix *); - void (*clip_stroke_path)(fz_context *, fz_device *, fz_path *, const fz_rect *rect, fz_stroke_state *, const fz_matrix *); - - void (*fill_text)(fz_context *, fz_device *, fz_text *, const fz_matrix *, fz_colorspace *, float *color, float alpha); - void (*stroke_text)(fz_context *, fz_device *, fz_text *, fz_stroke_state *, const fz_matrix *, fz_colorspace *, float *color, float alpha); - void (*clip_text)(fz_context *, fz_device *, fz_text *, const fz_matrix *); - void (*clip_stroke_text)(fz_context *, fz_device *, fz_text *, fz_stroke_state *, const fz_matrix *); - void (*ignore_text)(fz_context *, fz_device *, fz_text *, const fz_matrix *); - - void (*fill_shade)(fz_context *, fz_device *, fz_shade *shd, const fz_matrix *ctm, float alpha); - void (*fill_image)(fz_context *, fz_device *, fz_image *img, const fz_matrix *ctm, float alpha); - void (*fill_image_mask)(fz_context *, fz_device *, fz_image *img, const fz_matrix *ctm, fz_colorspace *, float *color, float alpha); - void (*clip_image_mask)(fz_context *, fz_device *, fz_image *img, const fz_rect *rect, const fz_matrix *ctm); + void (*fill_path)(fz_context *, fz_device *, const fz_path *, int even_odd, const fz_matrix *, const fz_colorspace *, const float *color, float alpha); + void (*stroke_path)(fz_context *, fz_device *, const fz_path *, const fz_stroke_state *, const fz_matrix *, const fz_colorspace *, const float *color, float alpha); + void (*clip_path)(fz_context *, fz_device *, const fz_path *, const fz_rect *rect, int even_odd, const fz_matrix *); + void (*clip_stroke_path)(fz_context *, fz_device *, const fz_path *, const fz_rect *rect, const fz_stroke_state *, const fz_matrix *); + + void (*fill_text)(fz_context *, fz_device *, const fz_text *, const fz_matrix *, const fz_colorspace *, const float *color, float alpha); + void (*stroke_text)(fz_context *, fz_device *, const fz_text *, const fz_stroke_state *, const fz_matrix *, const fz_colorspace *, const float *color, float alpha); + void (*clip_text)(fz_context *, fz_device *, const fz_text *, const fz_matrix *); + void (*clip_stroke_text)(fz_context *, fz_device *, const fz_text *, const fz_stroke_state *, const fz_matrix *); + void (*ignore_text)(fz_context *, fz_device *, const fz_text *, const fz_matrix *); + + void (*fill_shade)(fz_context *, fz_device *, const fz_shade *shd, const fz_matrix *ctm, float alpha); + void (*fill_image)(fz_context *, fz_device *, const fz_image *img, const fz_matrix *ctm, float alpha); + void (*fill_image_mask)(fz_context *, fz_device *, const fz_image *img, const fz_matrix *ctm, const fz_colorspace *, const float *color, float alpha); + void (*clip_image_mask)(fz_context *, fz_device *, const fz_image *img, const fz_rect *rect, const fz_matrix *ctm); void (*pop_clip)(fz_context *, fz_device *); - void (*begin_mask)(fz_context *, fz_device *, const fz_rect *, int luminosity, fz_colorspace *, float *bc); + void (*begin_mask)(fz_context *, fz_device *, const fz_rect *, int luminosity, const fz_colorspace *, const float *bc); void (*end_mask)(fz_context *, fz_device *); void (*begin_group)(fz_context *, fz_device *, const fz_rect *, int isolated, int knockout, int blendmode, float alpha); void (*end_group)(fz_context *, fz_device *); @@ -146,21 +146,21 @@ struct fz_device_s void fz_begin_page(fz_context *ctx, fz_device *dev, const fz_rect *rect, const fz_matrix *ctm); void fz_end_page(fz_context *ctx, fz_device *dev); -void fz_fill_path(fz_context *ctx, fz_device *dev, fz_path *path, int even_odd, const fz_matrix *ctm, fz_colorspace *colorspace, float *color, float alpha); -void fz_stroke_path(fz_context *ctx, fz_device *dev, fz_path *path, fz_stroke_state *stroke, const fz_matrix *ctm, fz_colorspace *colorspace, float *color, float alpha); -void fz_clip_path(fz_context *ctx, fz_device *dev, fz_path *path, const fz_rect *rect, int even_odd, const fz_matrix *ctm); -void fz_clip_stroke_path(fz_context *ctx, fz_device *dev, fz_path *path, const fz_rect *rect, fz_stroke_state *stroke, const fz_matrix *ctm); -void fz_fill_text(fz_context *ctx, fz_device *dev, fz_text *text, const fz_matrix *ctm, fz_colorspace *colorspace, float *color, float alpha); -void fz_stroke_text(fz_context *ctx, fz_device *dev, fz_text *text, fz_stroke_state *stroke, const fz_matrix *ctm, fz_colorspace *colorspace, float *color, float alpha); -void fz_clip_text(fz_context *ctx, fz_device *dev, fz_text *text, const fz_matrix *ctm); -void fz_clip_stroke_text(fz_context *ctx, fz_device *dev, fz_text *text, fz_stroke_state *stroke, const fz_matrix *ctm); -void fz_ignore_text(fz_context *ctx, fz_device *dev, fz_text *text, const fz_matrix *ctm); +void fz_fill_path(fz_context *ctx, fz_device *dev, const fz_path *path, int even_odd, const fz_matrix *ctm, const fz_colorspace *colorspace, const float *color, float alpha); +void fz_stroke_path(fz_context *ctx, fz_device *dev, const fz_path *path, const fz_stroke_state *stroke, const fz_matrix *ctm, const fz_colorspace *colorspace, const float *color, float alpha); +void fz_clip_path(fz_context *ctx, fz_device *dev, const fz_path *path, const fz_rect *rect, int even_odd, const fz_matrix *ctm); +void fz_clip_stroke_path(fz_context *ctx, fz_device *dev, const fz_path *path, const fz_rect *rect, const fz_stroke_state *stroke, const fz_matrix *ctm); +void fz_fill_text(fz_context *ctx, fz_device *dev, const fz_text *text, const fz_matrix *ctm, const fz_colorspace *colorspace, const float *color, float alpha); +void fz_stroke_text(fz_context *ctx, fz_device *dev, const fz_text *text, const fz_stroke_state *stroke, const fz_matrix *ctm, const fz_colorspace *colorspace, const float *color, float alpha); +void fz_clip_text(fz_context *ctx, fz_device *dev, const fz_text *text, const fz_matrix *ctm); +void fz_clip_stroke_text(fz_context *ctx, fz_device *dev, const fz_text *text, const fz_stroke_state *stroke, const fz_matrix *ctm); +void fz_ignore_text(fz_context *ctx, fz_device *dev, const fz_text *text, const fz_matrix *ctm); void fz_pop_clip(fz_context *ctx, fz_device *dev); -void fz_fill_shade(fz_context *ctx, fz_device *dev, fz_shade *shade, const fz_matrix *ctm, float alpha); -void fz_fill_image(fz_context *ctx, fz_device *dev, fz_image *image, const fz_matrix *ctm, float alpha); -void fz_fill_image_mask(fz_context *ctx, fz_device *dev, fz_image *image, const fz_matrix *ctm, fz_colorspace *colorspace, float *color, float alpha); -void fz_clip_image_mask(fz_context *ctx, fz_device *dev, fz_image *image, const fz_rect *rect, const fz_matrix *ctm); -void fz_begin_mask(fz_context *ctx, fz_device *dev, const fz_rect *area, int luminosity, fz_colorspace *colorspace, float *bc); +void fz_fill_shade(fz_context *ctx, fz_device *dev, const fz_shade *shade, const fz_matrix *ctm, float alpha); +void fz_fill_image(fz_context *ctx, fz_device *dev, const fz_image *image, const fz_matrix *ctm, float alpha); +void fz_fill_image_mask(fz_context *ctx, fz_device *dev, const fz_image *image, const fz_matrix *ctm, const fz_colorspace *colorspace, const float *color, float alpha); +void fz_clip_image_mask(fz_context *ctx, fz_device *dev, const fz_image *image, const fz_rect *rect, const fz_matrix *ctm); +void fz_begin_mask(fz_context *ctx, fz_device *dev, const fz_rect *area, int luminosity, const fz_colorspace *colorspace, const float *bc); void fz_end_mask(fz_context *ctx, fz_device *dev); void fz_begin_group(fz_context *ctx, fz_device *dev, const fz_rect *area, int isolated, int knockout, int blendmode, float alpha); void fz_end_group(fz_context *ctx, fz_device *dev); diff --git a/include/mupdf/fitz/font.h b/include/mupdf/fitz/font.h index b6ea3362..eb3e1887 100644 --- a/include/mupdf/fitz/font.h +++ b/include/mupdf/fitz/font.h @@ -90,20 +90,20 @@ fz_font *fz_new_font_from_memory(fz_context *ctx, const char *name, unsigned cha fz_font *fz_new_font_from_buffer(fz_context *ctx, const char *name, fz_buffer *buffer, int index, int use_glyph_bbox); fz_font *fz_new_font_from_file(fz_context *ctx, const char *name, const char *path, int index, int use_glyph_bbox); -fz_font *fz_keep_font(fz_context *ctx, fz_font *font); -void fz_drop_font(fz_context *ctx, fz_font *font); +fz_font *fz_keep_font(fz_context *ctx, const fz_font *font); +void fz_drop_font(fz_context *ctx, const fz_font *font); void fz_set_font_bbox(fz_context *ctx, fz_font *font, float xmin, float ymin, float xmax, float ymax); -fz_rect *fz_bound_glyph(fz_context *ctx, fz_font *font, int gid, const fz_matrix *trm, fz_rect *r); -int fz_glyph_cacheable(fz_context *ctx, fz_font *font, int gid); +fz_rect *fz_bound_glyph(fz_context *ctx, const fz_font *font, int gid, const fz_matrix *trm, fz_rect *r); +int fz_glyph_cacheable(fz_context *ctx, const fz_font *font, int gid); -void fz_run_t3_glyph(fz_context *ctx, fz_font *font, int gid, const fz_matrix *trm, struct fz_device_s *dev); +void fz_run_t3_glyph(fz_context *ctx, const fz_font *font, int gid, const fz_matrix *trm, struct fz_device_s *dev); void fz_decouple_type3_font(fz_context *ctx, fz_font *font, void *t3doc); -float fz_advance_glyph(fz_context *ctx, fz_font *font, int glyph); -int fz_encode_character(fz_context *ctx, fz_font *font, int unicode); +float fz_advance_glyph(fz_context *ctx, const fz_font *font, int glyph); +int fz_encode_character(fz_context *ctx, const fz_font *font, int unicode); -void fz_print_font(fz_context *ctx, fz_output *out, fz_font *font); +void fz_print_font(fz_context *ctx, fz_output *out, const fz_font *font); #endif diff --git a/include/mupdf/fitz/glyph-cache.h b/include/mupdf/fitz/glyph-cache.h index 28fcf416..db9294fc 100644 --- a/include/mupdf/fitz/glyph-cache.h +++ b/include/mupdf/fitz/glyph-cache.h @@ -18,20 +18,20 @@ fz_glyph_cache *fz_keep_glyph_cache(fz_context *ctx); void fz_drop_glyph_cache_context(fz_context *ctx); void fz_purge_glyph_cache(fz_context *ctx); -fz_path *fz_outline_ft_glyph(fz_context *ctx, fz_font *font, int gid, const fz_matrix *trm); -fz_path *fz_outline_glyph(fz_context *ctx, fz_font *font, int gid, const fz_matrix *ctm); -fz_glyph *fz_render_ft_glyph(fz_context *ctx, fz_font *font, int cid, const fz_matrix *trm, int aa); -fz_pixmap *fz_render_ft_glyph_pixmap(fz_context *ctx, fz_font *font, int cid, const fz_matrix *trm, int aa); -fz_glyph *fz_render_t3_glyph(fz_context *ctx, fz_font *font, int cid, const fz_matrix *trm, fz_colorspace *model, const fz_irect *scissor); -fz_pixmap *fz_render_t3_glyph_pixmap(fz_context *ctx, fz_font *font, int cid, const fz_matrix *trm, fz_colorspace *model, const fz_irect *scissor); -fz_glyph *fz_render_ft_stroked_glyph(fz_context *ctx, fz_font *font, int gid, const fz_matrix *trm, const fz_matrix *ctm, fz_stroke_state *state); -fz_pixmap *fz_render_ft_stroked_glyph_pixmap(fz_context *ctx, fz_font *font, int gid, const fz_matrix *trm, const fz_matrix *ctm, fz_stroke_state *state); -fz_glyph *fz_render_glyph(fz_context *ctx, fz_font*, int, fz_matrix *, fz_colorspace *model, const fz_irect *scissor); -fz_pixmap *fz_render_glyph_pixmap(fz_context *ctx, fz_font*, int, fz_matrix *, fz_colorspace *model, const fz_irect *scissor); -fz_glyph *fz_render_stroked_glyph(fz_context *ctx, fz_font*, int, fz_matrix *, const fz_matrix *, fz_stroke_state *stroke, const fz_irect *scissor); -fz_pixmap *fz_render_stroked_glyph_pixmap(fz_context *ctx, fz_font*, int, fz_matrix *, const fz_matrix *, fz_stroke_state *stroke, const fz_irect *scissor); -void fz_render_t3_glyph_direct(fz_context *ctx, fz_device *dev, fz_font *font, int gid, const fz_matrix *trm, void *gstate, int nestedDepth); -void fz_prepare_t3_glyph(fz_context *ctx, fz_font *font, int gid, int nestedDepth); +fz_path *fz_outline_ft_glyph(fz_context *ctx, const fz_font *font, int gid, const fz_matrix *trm); +fz_path *fz_outline_glyph(fz_context *ctx, const fz_font *font, int gid, const fz_matrix *ctm); +fz_glyph *fz_render_ft_glyph(fz_context *ctx, const fz_font *font, int cid, const fz_matrix *trm, int aa); +fz_pixmap *fz_render_ft_glyph_pixmap(fz_context *ctx, const fz_font *font, int cid, const fz_matrix *trm, int aa); +fz_glyph *fz_render_t3_glyph(fz_context *ctx, const fz_font *font, int cid, const fz_matrix *trm, fz_colorspace *model, const fz_irect *scissor); +fz_pixmap *fz_render_t3_glyph_pixmap(fz_context *ctx, const fz_font *font, int cid, const fz_matrix *trm, fz_colorspace *model, const fz_irect *scissor); +fz_glyph *fz_render_ft_stroked_glyph(fz_context *ctx, const fz_font *font, int gid, const fz_matrix *trm, const fz_matrix *ctm, const fz_stroke_state *state); +fz_pixmap *fz_render_ft_stroked_glyph_pixmap(fz_context *ctx, const fz_font *font, int gid, const fz_matrix *trm, const fz_matrix *ctm, const fz_stroke_state *state); +fz_glyph *fz_render_glyph(fz_context *ctx, const fz_font*, int, fz_matrix *, fz_colorspace *model, const fz_irect *scissor); +fz_pixmap *fz_render_glyph_pixmap(fz_context *ctx, const fz_font*, int, fz_matrix *, fz_colorspace *model, const fz_irect *scissor); +fz_glyph *fz_render_stroked_glyph(fz_context *ctx, const fz_font*, int, fz_matrix *, const fz_matrix *, const fz_stroke_state *stroke, const fz_irect *scissor); +fz_pixmap *fz_render_stroked_glyph_pixmap(fz_context *ctx, const fz_font*, int, fz_matrix *, const fz_matrix *, const fz_stroke_state *stroke, const fz_irect *scissor); +void fz_render_t3_glyph_direct(fz_context *ctx, fz_device *dev, const fz_font *font, int gid, const fz_matrix *trm, void *gstate, int nestedDepth); +void fz_prepare_t3_glyph(fz_context *ctx, const fz_font *font, int gid, int nestedDepth); void fz_dump_glyph_cache_stats(fz_context *ctx); float fz_subpixel_adjust(fz_context *ctx, fz_matrix *ctm, fz_matrix *subpix_ctm, unsigned char *qe, unsigned char *qf); diff --git a/include/mupdf/fitz/image.h b/include/mupdf/fitz/image.h index 41b53475..080352da 100644 --- a/include/mupdf/fitz/image.h +++ b/include/mupdf/fitz/image.h @@ -34,14 +34,14 @@ typedef struct fz_image_s fz_image; Returns a non NULL pixmap pointer. May throw exceptions. */ -fz_pixmap *fz_get_pixmap_from_image(fz_context *ctx, fz_image *image, int w, int h); +fz_pixmap *fz_get_pixmap_from_image(fz_context *ctx, const fz_image *image, int w, int h); /* fz_drop_image: Drop a reference to an image. image: The image to drop a reference to. */ -void fz_drop_image(fz_context *ctx, fz_image *image); +void fz_drop_image(fz_context *ctx, const fz_image *image); /* fz_keep_image: Increment the reference count of an image. @@ -50,15 +50,14 @@ void fz_drop_image(fz_context *ctx, fz_image *image); Returns a pointer to the image. */ -fz_image *fz_keep_image(fz_context *ctx, fz_image *image); +fz_image *fz_keep_image(fz_context *ctx, const fz_image *image); fz_image *fz_new_image(fz_context *ctx, int w, int h, int bpc, fz_colorspace *colorspace, int xres, int yres, int interpolate, int imagemask, float *decode, int *colorkey, fz_compressed_buffer *buffer, fz_image *mask); fz_image *fz_new_image_from_pixmap(fz_context *ctx, fz_pixmap *pixmap, fz_image *mask); fz_image *fz_new_image_from_data(fz_context *ctx, unsigned char *data, int len); fz_image *fz_new_image_from_buffer(fz_context *ctx, fz_buffer *buffer); -fz_pixmap *fz_get_pixmap_from_image(fz_context *ctx, fz_image *image, int w, int h); void fz_drop_image_imp(fz_context *ctx, fz_storable *image); -fz_pixmap *fz_decomp_image_from_stream(fz_context *ctx, fz_stream *stm, fz_image *image, int indexed, int l2factor); +fz_pixmap *fz_decomp_image_from_stream(fz_context *ctx, fz_stream *stm, const fz_image *image, int indexed, int l2factor); fz_pixmap *fz_expand_indexed_pixmap(fz_context *ctx, fz_pixmap *src); struct fz_image_s @@ -67,7 +66,7 @@ struct fz_image_s int w, h, n, bpc; fz_image *mask; fz_colorspace *colorspace; - fz_pixmap *(*get_pixmap)(fz_context *, fz_image *, int w, int h, int *l2factor); + fz_pixmap *(*get_pixmap)(fz_context *, const fz_image *, int w, int h, int *l2factor); int colorkey[FZ_MAX_COLORS * 2]; float decode[FZ_MAX_COLORS * 2]; int imagemask; diff --git a/include/mupdf/fitz/output-png.h b/include/mupdf/fitz/output-png.h index dd1ef465..7e0dfb87 100644 --- a/include/mupdf/fitz/output-png.h +++ b/include/mupdf/fitz/output-png.h @@ -29,7 +29,7 @@ void fz_write_png_trailer(fz_context *ctx, fz_output *out, fz_png_output_context /* Create a new buffer containing the image/pixmap in PNG format. */ -fz_buffer *fz_new_buffer_from_image_as_png(fz_context *ctx, fz_image *image, int w, int h); +fz_buffer *fz_new_buffer_from_image_as_png(fz_context *ctx, const fz_image *image, int w, int h); fz_buffer *fz_new_buffer_from_pixmap_as_png(fz_context *ctx, fz_pixmap *pixmap); #endif diff --git a/include/mupdf/fitz/path.h b/include/mupdf/fitz/path.h index ef308615..03c69849 100644 --- a/include/mupdf/fitz/path.h +++ b/include/mupdf/fitz/path.h @@ -80,15 +80,15 @@ void fz_closepath(fz_context*,fz_path*); void fz_transform_path(fz_context *ctx, fz_path *path, const fz_matrix *transform); -fz_rect *fz_bound_path(fz_context *ctx, fz_path *path, const fz_stroke_state *stroke, const fz_matrix *ctm, fz_rect *r); +fz_rect *fz_bound_path(fz_context *ctx, const fz_path *path, const fz_stroke_state *stroke, const fz_matrix *ctm, fz_rect *r); fz_rect *fz_adjust_rect_for_stroke(fz_context *ctx, fz_rect *r, const fz_stroke_state *stroke, const fz_matrix *ctm); extern const fz_stroke_state fz_default_stroke_state; fz_stroke_state *fz_new_stroke_state(fz_context *ctx); fz_stroke_state *fz_new_stroke_state_with_dash_len(fz_context *ctx, int len); -fz_stroke_state *fz_keep_stroke_state(fz_context *ctx, fz_stroke_state *stroke); -void fz_drop_stroke_state(fz_context *ctx, fz_stroke_state *stroke); +fz_stroke_state *fz_keep_stroke_state(fz_context *ctx, const fz_stroke_state *stroke); +void fz_drop_stroke_state(fz_context *ctx, const fz_stroke_state *stroke); fz_stroke_state *fz_unshare_stroke_state(fz_context *ctx, fz_stroke_state *shared); fz_stroke_state *fz_unshare_stroke_state_with_dash_len(fz_context *ctx, fz_stroke_state *shared, int len); fz_stroke_state *fz_clone_stroke_state(fz_context *ctx, fz_stroke_state *stroke); diff --git a/include/mupdf/fitz/pixmap.h b/include/mupdf/fitz/pixmap.h index 42a70c7b..be8f45ba 100644 --- a/include/mupdf/fitz/pixmap.h +++ b/include/mupdf/fitz/pixmap.h @@ -301,14 +301,14 @@ typedef struct fz_scale_cache_s fz_scale_cache; fz_scale_cache *fz_new_scale_cache(fz_context *ctx); void fz_drop_scale_cache(fz_context *ctx, fz_scale_cache *cache); -fz_pixmap *fz_scale_pixmap_cached(fz_context *ctx, fz_pixmap *src, float x, float y, float w, float h, const fz_irect *clip, fz_scale_cache *cache_x, fz_scale_cache *cache_y); +fz_pixmap *fz_scale_pixmap_cached(fz_context *ctx, const fz_pixmap *src, float x, float y, float w, float h, const fz_irect *clip, fz_scale_cache *cache_x, fz_scale_cache *cache_y); void fz_subsample_pixmap(fz_context *ctx, fz_pixmap *tile, int factor); fz_irect *fz_pixmap_bbox_no_ctx(fz_pixmap *src, fz_irect *bbox); -void fz_decode_tile(fz_context *ctx, fz_pixmap *pix, float *decode); -void fz_decode_indexed_tile(fz_context *ctx, fz_pixmap *pix, float *decode, int maxval); +void fz_decode_tile(fz_context *ctx, fz_pixmap *pix, const float *decode); +void fz_decode_indexed_tile(fz_context *ctx, fz_pixmap *pix, const float *decode, int maxval); void fz_unpack_tile(fz_context *ctx, fz_pixmap *dst, unsigned char * restrict src, int n, int depth, int stride, int scale); /* diff --git a/include/mupdf/fitz/shade.h b/include/mupdf/fitz/shade.h index 56adea5b..ada969cd 100644 --- a/include/mupdf/fitz/shade.h +++ b/include/mupdf/fitz/shade.h @@ -72,12 +72,12 @@ struct fz_shade_s fz_compressed_buffer *buffer; }; -fz_shade *fz_keep_shade(fz_context *ctx, fz_shade *shade); -void fz_drop_shade(fz_context *ctx, fz_shade *shade); +fz_shade *fz_keep_shade(fz_context *ctx, const fz_shade *shade); +void fz_drop_shade(fz_context *ctx, const fz_shade *shade); void fz_drop_shade_imp(fz_context *ctx, fz_storable *shade); -fz_rect *fz_bound_shade(fz_context *ctx, fz_shade *shade, const fz_matrix *ctm, fz_rect *r); -void fz_paint_shade(fz_context *ctx, fz_shade *shade, const fz_matrix *ctm, fz_pixmap *dest, const fz_irect *bbox); +fz_rect *fz_bound_shade(fz_context *ctx, const fz_shade *shade, const fz_matrix *ctm, fz_rect *r); +void fz_paint_shade(fz_context *ctx, const fz_shade *shade, const fz_matrix *ctm, fz_pixmap *dest, const fz_irect *bbox); /* * Handy routine for processing mesh based shades @@ -93,7 +93,7 @@ struct fz_vertex_s typedef void (fz_mesh_prepare_fn)(fz_context *ctx, void *arg, fz_vertex *v, const float *c); typedef void (fz_mesh_process_fn)(fz_context *ctx, void *arg, fz_vertex *av, fz_vertex *bv, fz_vertex *cv); -void fz_process_mesh(fz_context *ctx, fz_shade *shade, const fz_matrix *ctm, +void fz_process_mesh(fz_context *ctx, const fz_shade *shade, const fz_matrix *ctm, fz_mesh_prepare_fn *prepare, fz_mesh_process_fn *process, void *process_arg); void fz_print_shade(fz_context *ctx, fz_output *out, fz_shade *shade); diff --git a/include/mupdf/fitz/store.h b/include/mupdf/fitz/store.h index 3b7b69ab..e98e2394 100644 --- a/include/mupdf/fitz/store.h +++ b/include/mupdf/fitz/store.h @@ -39,8 +39,8 @@ struct fz_storable_s { S->drop = (DROP); \ } while (0) -void *fz_keep_storable(fz_context *, fz_storable *); -void fz_drop_storable(fz_context *, fz_storable *); +void *fz_keep_storable(fz_context *, const fz_storable *); +void fz_drop_storable(fz_context *, const fz_storable *); /* The store can be seen as a dictionary that maps keys to fz_storable @@ -73,7 +73,7 @@ struct fz_store_hash_s } i; struct { - void *ptr; + const void *ptr; int i; } pi; struct diff --git a/include/mupdf/fitz/text.h b/include/mupdf/fitz/text.h index 302678cd..090d372d 100644 --- a/include/mupdf/fitz/text.h +++ b/include/mupdf/fitz/text.h @@ -46,12 +46,12 @@ struct fz_text_s }; fz_text *fz_new_text(fz_context *ctx); -fz_text *fz_keep_text(fz_context *ctx, fz_text *text); -void fz_drop_text(fz_context *ctx, fz_text *text); +fz_text *fz_keep_text(fz_context *ctx, const fz_text *text); +void fz_drop_text(fz_context *ctx, const fz_text *text); void fz_add_text(fz_context *ctx, fz_text *text, fz_font *font, int wmode, const fz_matrix *trm, int gid, int ucs); -fz_rect *fz_bound_text(fz_context *ctx, fz_text *text, const fz_stroke_state *stroke, const fz_matrix *ctm, fz_rect *r); +fz_rect *fz_bound_text(fz_context *ctx, const fz_text *text, const fz_stroke_state *stroke, const fz_matrix *ctm, fz_rect *r); -fz_text *fz_clone_text(fz_context *ctx, fz_text *text); +fz_text *fz_clone_text(fz_context *ctx, const fz_text *text); #endif diff --git a/include/mupdf/pdf/resource.h b/include/mupdf/pdf/resource.h index 868bd168..a97b9b84 100644 --- a/include/mupdf/pdf/resource.h +++ b/include/mupdf/pdf/resource.h @@ -15,7 +15,7 @@ void pdf_remove_item(fz_context *ctx, fz_store_drop_fn *drop, pdf_obj *key); fz_function *pdf_load_function(fz_context *ctx, pdf_document *doc, pdf_obj *ref, int in, int out); fz_colorspace *pdf_load_colorspace(fz_context *ctx, pdf_document *doc, pdf_obj *obj); -int pdf_is_tint_colorspace(fz_context *ctx, fz_colorspace *cs); +int pdf_is_tint_colorspace(fz_context *ctx, const fz_colorspace *cs); fz_shade *pdf_load_shading(fz_context *ctx, pdf_document *doc, pdf_obj *obj); |