diff options
Diffstat (limited to 'source')
54 files changed, 734 insertions, 744 deletions
diff --git a/source/cbz/mucbz.c b/source/cbz/mucbz.c index ddf3c553..5cbdf0ca 100644 --- a/source/cbz/mucbz.c +++ b/source/cbz/mucbz.c @@ -151,7 +151,7 @@ cbz_bound_page(fz_context *ctx, fz_page *page_) } static void -cbz_run_page(fz_context *ctx, fz_page *page_, fz_device *dev, const fz_matrix *ctm, fz_cookie *cookie) +cbz_run_page(fz_context *ctx, fz_page *page_, fz_device *dev, fz_matrix ctm, fz_cookie *cookie) { cbz_page *page = (cbz_page*)page_; fz_matrix local_ctm; @@ -162,8 +162,8 @@ cbz_run_page(fz_context *ctx, fz_page *page_, fz_device *dev, const fz_matrix *c fz_image_resolution(image, &xres, &yres); w = image->w * DPI / xres; h = image->h * DPI / yres; - local_ctm = fz_pre_scale(*ctm, w, h); - fz_fill_image(ctx, dev, image, &local_ctm, 1, NULL); + local_ctm = fz_pre_scale(ctm, w, h); + fz_fill_image(ctx, dev, image, local_ctm, 1, NULL); } static void diff --git a/source/cbz/muimg.c b/source/cbz/muimg.c index bc7e6e92..b54371fa 100644 --- a/source/cbz/muimg.c +++ b/source/cbz/muimg.c @@ -52,10 +52,9 @@ img_bound_page(fz_context *ctx, fz_page *page_) } static void -img_run_page(fz_context *ctx, fz_page *page_, fz_device *dev, const fz_matrix *ctm, fz_cookie *cookie) +img_run_page(fz_context *ctx, fz_page *page_, fz_device *dev, fz_matrix ctm, fz_cookie *cookie) { img_page *page = (img_page*)page_; - fz_matrix local_ctm; fz_image *image = page->image; int xres, yres; float w, h; @@ -63,8 +62,8 @@ img_run_page(fz_context *ctx, fz_page *page_, fz_device *dev, const fz_matrix *c fz_image_resolution(image, &xres, &yres); w = image->w * DPI / xres; h = image->h * DPI / yres; - local_ctm = fz_pre_scale(*ctm, w, h); - fz_fill_image(ctx, dev, image, &local_ctm, 1, NULL); + ctm = fz_pre_scale(ctm, w, h); + fz_fill_image(ctx, dev, image, ctm, 1, NULL); } static void diff --git a/source/fitz/bbox-device.c b/source/fitz/bbox-device.c index 7238936a..9492a2da 100644 --- a/source/fitz/bbox-device.c +++ b/source/fitz/bbox-device.c @@ -35,80 +35,80 @@ fz_bbox_add_rect(fz_context *ctx, fz_device *dev, fz_rect rect, int clip) } static void -fz_bbox_fill_path(fz_context *ctx, fz_device *dev, const fz_path *path, int even_odd, const fz_matrix *ctm, +fz_bbox_fill_path(fz_context *ctx, fz_device *dev, const fz_path *path, int even_odd, fz_matrix ctm, fz_colorspace *colorspace, const float *color, float alpha, const fz_color_params *color_params) { - fz_bbox_add_rect(ctx, dev, fz_bound_path(ctx, path, NULL, *ctm), 0); + fz_bbox_add_rect(ctx, dev, fz_bound_path(ctx, path, NULL, ctm), 0); } static void fz_bbox_stroke_path(fz_context *ctx, fz_device *dev, const fz_path *path, const fz_stroke_state *stroke, - const fz_matrix *ctm, fz_colorspace *colorspace, const float *color, float alpha, const fz_color_params *color_params) + fz_matrix ctm, fz_colorspace *colorspace, const float *color, float alpha, const fz_color_params *color_params) { - fz_bbox_add_rect(ctx, dev, fz_bound_path(ctx, path, stroke, *ctm), 0); + fz_bbox_add_rect(ctx, dev, fz_bound_path(ctx, path, stroke, ctm), 0); } static void -fz_bbox_fill_text(fz_context *ctx, fz_device *dev, const fz_text *text, const fz_matrix *ctm, +fz_bbox_fill_text(fz_context *ctx, fz_device *dev, const fz_text *text, fz_matrix ctm, fz_colorspace *colorspace, const float *color, float alpha, const fz_color_params *color_params) { - fz_bbox_add_rect(ctx, dev, fz_bound_text(ctx, text, NULL, *ctm), 0); + fz_bbox_add_rect(ctx, dev, fz_bound_text(ctx, text, NULL, ctm), 0); } static void fz_bbox_stroke_text(fz_context *ctx, fz_device *dev, const fz_text *text, const fz_stroke_state *stroke, - const fz_matrix *ctm, fz_colorspace *colorspace, const float *color, float alpha, const fz_color_params *color_params) + fz_matrix ctm, fz_colorspace *colorspace, const float *color, float alpha, const fz_color_params *color_params) { - fz_bbox_add_rect(ctx, dev, fz_bound_text(ctx, text, stroke, *ctm), 0); + fz_bbox_add_rect(ctx, dev, fz_bound_text(ctx, text, stroke, ctm), 0); } static void -fz_bbox_fill_shade(fz_context *ctx, fz_device *dev, fz_shade *shade, const fz_matrix *ctm, float alpha, const fz_color_params *color_params) +fz_bbox_fill_shade(fz_context *ctx, fz_device *dev, fz_shade *shade, fz_matrix ctm, float alpha, const fz_color_params *color_params) { - fz_bbox_add_rect(ctx, dev, fz_bound_shade(ctx, shade, *ctm), 0); + fz_bbox_add_rect(ctx, dev, fz_bound_shade(ctx, shade, ctm), 0); } static void -fz_bbox_fill_image(fz_context *ctx, fz_device *dev, fz_image *image, const fz_matrix *ctm, float alpha, const fz_color_params *color_params) +fz_bbox_fill_image(fz_context *ctx, fz_device *dev, fz_image *image, fz_matrix ctm, float alpha, const fz_color_params *color_params) { - fz_bbox_add_rect(ctx, dev, fz_transform_rect(fz_unit_rect, *ctm), 0); + fz_bbox_add_rect(ctx, dev, fz_transform_rect(fz_unit_rect, ctm), 0); } static void -fz_bbox_fill_image_mask(fz_context *ctx, fz_device *dev, fz_image *image, const fz_matrix *ctm, +fz_bbox_fill_image_mask(fz_context *ctx, fz_device *dev, fz_image *image, fz_matrix ctm, fz_colorspace *colorspace, const float *color, float alpha, const fz_color_params *color_params) { - fz_bbox_add_rect(ctx, dev, fz_transform_rect(fz_unit_rect, *ctm), 0); + fz_bbox_add_rect(ctx, dev, fz_transform_rect(fz_unit_rect, ctm), 0); } static void -fz_bbox_clip_path(fz_context *ctx, fz_device *dev, const fz_path *path, int even_odd, const fz_matrix *ctm, const fz_rect *scissor) +fz_bbox_clip_path(fz_context *ctx, fz_device *dev, const fz_path *path, int even_odd, fz_matrix ctm, const fz_rect *scissor) { - fz_bbox_add_rect(ctx, dev, fz_bound_path(ctx, path, NULL, *ctm), 1); + fz_bbox_add_rect(ctx, dev, fz_bound_path(ctx, path, NULL, ctm), 1); } static void -fz_bbox_clip_stroke_path(fz_context *ctx, fz_device *dev, const fz_path *path, const fz_stroke_state *stroke, const fz_matrix *ctm, const fz_rect *scissor) +fz_bbox_clip_stroke_path(fz_context *ctx, fz_device *dev, const fz_path *path, const fz_stroke_state *stroke, fz_matrix ctm, const fz_rect *scissor) { - fz_bbox_add_rect(ctx, dev, fz_bound_path(ctx, path, stroke, *ctm), 1); + fz_bbox_add_rect(ctx, dev, fz_bound_path(ctx, path, stroke, ctm), 1); } static void -fz_bbox_clip_text(fz_context *ctx, fz_device *dev, const fz_text *text, const fz_matrix *ctm, const fz_rect *scissor) +fz_bbox_clip_text(fz_context *ctx, fz_device *dev, const fz_text *text, fz_matrix ctm, const fz_rect *scissor) { - fz_bbox_add_rect(ctx, dev, fz_bound_text(ctx, text, NULL, *ctm), 1); + fz_bbox_add_rect(ctx, dev, fz_bound_text(ctx, text, NULL, ctm), 1); } static void -fz_bbox_clip_stroke_text(fz_context *ctx, fz_device *dev, const fz_text *text, const fz_stroke_state *stroke, const fz_matrix *ctm, const fz_rect *scissor) +fz_bbox_clip_stroke_text(fz_context *ctx, fz_device *dev, const fz_text *text, const fz_stroke_state *stroke, fz_matrix ctm, const fz_rect *scissor) { - fz_bbox_add_rect(ctx, dev, fz_bound_text(ctx, text, stroke, *ctm), 1); + fz_bbox_add_rect(ctx, dev, fz_bound_text(ctx, text, stroke, ctm), 1); } static void -fz_bbox_clip_image_mask(fz_context *ctx, fz_device *dev, fz_image *image, const fz_matrix *ctm, const fz_rect *scissor) +fz_bbox_clip_image_mask(fz_context *ctx, fz_device *dev, fz_image *image, fz_matrix ctm, const fz_rect *scissor) { - fz_bbox_add_rect(ctx, dev, fz_transform_rect(fz_unit_rect, *ctm), 1); + fz_bbox_add_rect(ctx, dev, fz_transform_rect(fz_unit_rect, ctm), 1); } static void @@ -150,10 +150,10 @@ fz_bbox_end_group(fz_context *ctx, fz_device *dev) } static int -fz_bbox_begin_tile(fz_context *ctx, fz_device *dev, const fz_rect *area, const fz_rect *view, float xstep, float ystep, const fz_matrix *ctm, int id) +fz_bbox_begin_tile(fz_context *ctx, fz_device *dev, const fz_rect *area, const fz_rect *view, float xstep, float ystep, fz_matrix ctm, int id) { fz_bbox_device *bdev = (fz_bbox_device*)dev; - fz_bbox_add_rect(ctx, dev, fz_transform_rect(*area, *ctm), 0); + fz_bbox_add_rect(ctx, dev, fz_transform_rect(*area, ctm), 0); bdev->ignore++; return 0; } diff --git a/source/fitz/colorspace.c b/source/fitz/colorspace.c index 54435743..eee90f46 100644 --- a/source/fitz/colorspace.c +++ b/source/fitz/colorspace.c @@ -2130,8 +2130,8 @@ fast_cmyk_to_rgb_ARM(unsigned char *dst, unsigned char *src, int n) } #endif -static inline void cached_cmyk_conv(unsigned char *FZ_RESTRICT const pr, unsigned char *FZ_RESTRICT const pg, unsigned char *FZ_RESTRICT const pb, - unsigned int *FZ_RESTRICT const C, unsigned int *FZ_RESTRICT const M, unsigned int *FZ_RESTRICT const Y, unsigned int *FZ_RESTRICT const K, +static inline void cached_cmyk_conv(unsigned char * FZ_RESTRICT pr, unsigned char * FZ_RESTRICT pg, unsigned char * FZ_RESTRICT pb, + unsigned int * FZ_RESTRICT C, unsigned int * FZ_RESTRICT M, unsigned int * FZ_RESTRICT Y, unsigned int * FZ_RESTRICT K, unsigned int c, unsigned int m, unsigned int y, unsigned int k) { #ifdef SLOWCMYK diff --git a/source/fitz/device.c b/source/fitz/device.c index 2cc4a2e7..cad71a6a 100644 --- a/source/fitz/device.c +++ b/source/fitz/device.c @@ -114,7 +114,7 @@ pop_clip_stack(fz_context *ctx, fz_device *dev) } void -fz_fill_path(fz_context *ctx, fz_device *dev, const fz_path *path, int even_odd, const fz_matrix *ctm, +fz_fill_path(fz_context *ctx, fz_device *dev, const fz_path *path, int even_odd, fz_matrix ctm, fz_colorspace *colorspace, const float *color, float alpha, const fz_color_params *color_params) { if (dev->error_depth) @@ -124,7 +124,7 @@ fz_fill_path(fz_context *ctx, fz_device *dev, const fz_path *path, int even_odd, } void -fz_stroke_path(fz_context *ctx, fz_device *dev, const fz_path *path, const fz_stroke_state *stroke, const fz_matrix *ctm, +fz_stroke_path(fz_context *ctx, fz_device *dev, const fz_path *path, const fz_stroke_state *stroke, fz_matrix ctm, fz_colorspace *colorspace, const float *color, float alpha, const fz_color_params *color_params) { if (dev->error_depth) @@ -134,7 +134,7 @@ fz_stroke_path(fz_context *ctx, fz_device *dev, const fz_path *path, const fz_st } void -fz_clip_path(fz_context *ctx, fz_device *dev, const fz_path *path, int even_odd, const fz_matrix *ctm, const fz_rect *scissor) +fz_clip_path(fz_context *ctx, fz_device *dev, const fz_path *path, int even_odd, fz_matrix ctm, const fz_rect *scissor) { if (dev->error_depth) { @@ -148,7 +148,7 @@ fz_clip_path(fz_context *ctx, fz_device *dev, const fz_path *path, int even_odd, { if (scissor == NULL) { - fz_rect bbox = fz_bound_path(ctx, path, NULL, *ctm); + fz_rect bbox = fz_bound_path(ctx, path, NULL, ctm); push_clip_stack(ctx, dev, &bbox, fz_device_container_stack_is_clip_path); } else @@ -166,7 +166,7 @@ fz_clip_path(fz_context *ctx, fz_device *dev, const fz_path *path, int even_odd, } void -fz_clip_stroke_path(fz_context *ctx, fz_device *dev, const fz_path *path, const fz_stroke_state *stroke, const fz_matrix *ctm, const fz_rect *scissor) +fz_clip_stroke_path(fz_context *ctx, fz_device *dev, const fz_path *path, const fz_stroke_state *stroke, fz_matrix ctm, const fz_rect *scissor) { if (dev->error_depth) { @@ -180,7 +180,7 @@ fz_clip_stroke_path(fz_context *ctx, fz_device *dev, const fz_path *path, const { if (scissor == NULL) { - fz_rect bbox = fz_bound_path(ctx, path, stroke, *ctm); + fz_rect bbox = fz_bound_path(ctx, path, stroke, ctm); push_clip_stack(ctx, dev, &bbox, fz_device_container_stack_is_clip_stroke_path); } else @@ -198,7 +198,7 @@ fz_clip_stroke_path(fz_context *ctx, fz_device *dev, const fz_path *path, const } void -fz_fill_text(fz_context *ctx, fz_device *dev, const fz_text *text, const fz_matrix *ctm, +fz_fill_text(fz_context *ctx, fz_device *dev, const fz_text *text, fz_matrix ctm, fz_colorspace *colorspace, const float *color, float alpha, const fz_color_params *color_params) { if (dev->error_depth) @@ -208,7 +208,7 @@ fz_fill_text(fz_context *ctx, fz_device *dev, const fz_text *text, const fz_matr } void -fz_stroke_text(fz_context *ctx, fz_device *dev, const fz_text *text, const fz_stroke_state *stroke, const fz_matrix *ctm, +fz_stroke_text(fz_context *ctx, fz_device *dev, const fz_text *text, const fz_stroke_state *stroke, fz_matrix ctm, fz_colorspace *colorspace, const float *color, float alpha, const fz_color_params *color_params) { if (dev->error_depth) @@ -218,7 +218,7 @@ fz_stroke_text(fz_context *ctx, fz_device *dev, const fz_text *text, const fz_st } void -fz_clip_text(fz_context *ctx, fz_device *dev, const fz_text *text, const fz_matrix *ctm, const fz_rect *scissor) +fz_clip_text(fz_context *ctx, fz_device *dev, const fz_text *text, fz_matrix ctm, const fz_rect *scissor) { if (dev->error_depth) { @@ -232,7 +232,7 @@ fz_clip_text(fz_context *ctx, fz_device *dev, const fz_text *text, const fz_matr { if (scissor == NULL) { - fz_rect bbox = fz_bound_text(ctx, text, NULL, *ctm); + fz_rect bbox = fz_bound_text(ctx, text, NULL, ctm); push_clip_stack(ctx, dev, &bbox, fz_device_container_stack_is_clip_text); } else @@ -250,7 +250,7 @@ fz_clip_text(fz_context *ctx, fz_device *dev, const fz_text *text, const fz_matr } void -fz_clip_stroke_text(fz_context *ctx, fz_device *dev, const fz_text *text, const fz_stroke_state *stroke, const fz_matrix *ctm, const fz_rect *scissor) +fz_clip_stroke_text(fz_context *ctx, fz_device *dev, const fz_text *text, const fz_stroke_state *stroke, fz_matrix ctm, const fz_rect *scissor) { if (dev->error_depth) { @@ -264,7 +264,7 @@ fz_clip_stroke_text(fz_context *ctx, fz_device *dev, const fz_text *text, const { if (scissor == NULL) { - fz_rect bbox = fz_bound_text(ctx, text, stroke, *ctm); + fz_rect bbox = fz_bound_text(ctx, text, stroke, ctm); push_clip_stack(ctx, dev, &bbox, fz_device_container_stack_is_clip_stroke_text); } else @@ -282,7 +282,7 @@ fz_clip_stroke_text(fz_context *ctx, fz_device *dev, const fz_text *text, const } void -fz_ignore_text(fz_context *ctx, fz_device *dev, const fz_text *text, const fz_matrix *ctm) +fz_ignore_text(fz_context *ctx, fz_device *dev, const fz_text *text, fz_matrix ctm) { if (dev->error_depth) return; @@ -307,7 +307,7 @@ 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, const fz_color_params *color_params) +fz_fill_shade(fz_context *ctx, fz_device *dev, fz_shade *shade, fz_matrix ctm, float alpha, const fz_color_params *color_params) { if (dev->error_depth) return; @@ -316,7 +316,7 @@ fz_fill_shade(fz_context *ctx, fz_device *dev, fz_shade *shade, const fz_matrix } void -fz_fill_image(fz_context *ctx, fz_device *dev, fz_image *image, const fz_matrix *ctm, float alpha, const fz_color_params *color_params) +fz_fill_image(fz_context *ctx, fz_device *dev, fz_image *image, fz_matrix ctm, float alpha, const fz_color_params *color_params) { if (dev->error_depth) return; @@ -325,7 +325,7 @@ fz_fill_image(fz_context *ctx, fz_device *dev, fz_image *image, const fz_matrix } void -fz_fill_image_mask(fz_context *ctx, fz_device *dev, fz_image *image, const fz_matrix *ctm, +fz_fill_image_mask(fz_context *ctx, fz_device *dev, fz_image *image, fz_matrix ctm, fz_colorspace *colorspace, const float *color, float alpha, const fz_color_params *color_params) { if (dev->error_depth) @@ -335,7 +335,7 @@ fz_fill_image_mask(fz_context *ctx, fz_device *dev, fz_image *image, const fz_ma } void -fz_clip_image_mask(fz_context *ctx, fz_device *dev, fz_image *image, const fz_matrix *ctm, const fz_rect *scissor) +fz_clip_image_mask(fz_context *ctx, fz_device *dev, fz_image *image, fz_matrix ctm, const fz_rect *scissor) { if (dev->error_depth) { @@ -349,7 +349,7 @@ fz_clip_image_mask(fz_context *ctx, fz_device *dev, fz_image *image, const fz_ma { if (scissor == NULL) { - fz_rect bbox = fz_transform_rect(fz_unit_rect, *ctm); + fz_rect bbox = fz_transform_rect(fz_unit_rect, ctm); push_clip_stack(ctx, dev, &bbox, fz_device_container_stack_is_clip_image_mask); } else @@ -457,13 +457,13 @@ fz_end_group(fz_context *ctx, fz_device *dev) } void -fz_begin_tile(fz_context *ctx, fz_device *dev, const fz_rect *area, const fz_rect *view, float xstep, float ystep, const fz_matrix *ctm) +fz_begin_tile(fz_context *ctx, fz_device *dev, const fz_rect *area, const fz_rect *view, float xstep, float ystep, fz_matrix ctm) { (void)fz_begin_tile_id(ctx, dev, area, view, xstep, ystep, ctm, 0); } int -fz_begin_tile_id(fz_context *ctx, fz_device *dev, const fz_rect *area, const fz_rect *view, float xstep, float ystep, const fz_matrix *ctm, int id) +fz_begin_tile_id(fz_context *ctx, fz_device *dev, const fz_rect *area, const fz_rect *view, float xstep, float ystep, fz_matrix ctm, int id) { int ret = 0; diff --git a/source/fitz/document.c b/source/fitz/document.c index 3dc41a75..013badb0 100644 --- a/source/fitz/document.c +++ b/source/fitz/document.c @@ -366,7 +366,7 @@ fz_bound_annot(fz_context *ctx, fz_annot *annot) } void -fz_run_page_contents(fz_context *ctx, fz_page *page, fz_device *dev, const fz_matrix *transform, fz_cookie *cookie) +fz_run_page_contents(fz_context *ctx, fz_page *page, fz_device *dev, fz_matrix transform, fz_cookie *cookie) { if (page && page->run_page_contents && page) { @@ -383,7 +383,7 @@ fz_run_page_contents(fz_context *ctx, fz_page *page, fz_device *dev, const fz_ma } void -fz_run_annot(fz_context *ctx, fz_annot *annot, fz_device *dev, const fz_matrix *transform, fz_cookie *cookie) +fz_run_annot(fz_context *ctx, fz_annot *annot, fz_device *dev, fz_matrix transform, fz_cookie *cookie) { if (annot && annot->run_annot) { @@ -400,7 +400,7 @@ fz_run_annot(fz_context *ctx, fz_annot *annot, fz_device *dev, const fz_matrix * } void -fz_run_page(fz_context *ctx, fz_page *page, fz_device *dev, const fz_matrix *transform, fz_cookie *cookie) +fz_run_page(fz_context *ctx, fz_page *page, fz_device *dev, fz_matrix transform, fz_cookie *cookie) { fz_annot *annot; diff --git a/source/fitz/draw-affine.c b/source/fitz/draw-affine.c index 9f626415..61f7eb3f 100644 --- a/source/fitz/draw-affine.c +++ b/source/fitz/draw-affine.c @@ -7,7 +7,7 @@ typedef unsigned char byte; -typedef void (paintfn_t)(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, int sw, int sh, int ss, int sa, int u, int v, int fa, int fb, int w, int dn, int sn, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop); +typedef void (paintfn_t)(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, int sw, int sh, int ss, int sa, int u, int v, int fa, int fb, int w, int dn, int sn, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint *eop); static inline int lerp(int a, int b, int t) { @@ -3868,7 +3868,7 @@ fz_gridfit_matrix(int as_tiled, fz_matrix m) /* Draw an image with an affine transform on destination */ static void -fz_paint_image_imp(fz_pixmap * FZ_RESTRICT dst, const fz_irect *scissor, fz_pixmap * FZ_RESTRICT shape, fz_pixmap * FZ_RESTRICT group_alpha, const fz_pixmap * FZ_RESTRICT img, const fz_matrix * FZ_RESTRICT ctm, const byte * FZ_RESTRICT color, int alpha, int lerp_allowed, int as_tiled, const fz_overprint * FZ_RESTRICT eop) +fz_paint_image_imp(fz_pixmap *dst, const fz_irect *scissor, fz_pixmap *shape, fz_pixmap *group_alpha, const fz_pixmap *img, fz_matrix ctm, const byte *color, int alpha, int lerp_allowed, int as_tiled, const fz_overprint *eop) { byte *dp, *sp, *hp, *gp; int u, v, fa, fb, fc, fd; @@ -3877,35 +3877,34 @@ fz_paint_image_imp(fz_pixmap * FZ_RESTRICT dst, const fz_irect *scissor, fz_pixm fz_irect bbox; int dolerp; paintfn_t *paintfn; - fz_matrix local_ctm; int is_rectilinear; if (alpha == 0) return; /* grid fit the image */ - local_ctm = fz_gridfit_matrix(as_tiled, *ctm); + ctm = fz_gridfit_matrix(as_tiled, ctm); /* turn on interpolation for upscaled and non-rectilinear transforms */ dolerp = 0; - is_rectilinear = fz_is_rectilinear(local_ctm); + is_rectilinear = fz_is_rectilinear(ctm); if (!is_rectilinear) dolerp = lerp_allowed; - if (sqrtf(local_ctm.a * local_ctm.a + local_ctm.b * local_ctm.b) > img->w) + if (sqrtf(ctm.a * ctm.a + ctm.b * ctm.b) > img->w) dolerp = lerp_allowed; - if (sqrtf(local_ctm.c * local_ctm.c + local_ctm.d * local_ctm.d) > img->h) + if (sqrtf(ctm.c * ctm.c + ctm.d * ctm.d) > img->h) dolerp = lerp_allowed; /* except when we shouldn't, at large magnifications */ if (!(img->flags & FZ_PIXMAP_FLAG_INTERPOLATE)) { - if (sqrtf(local_ctm.a * local_ctm.a + local_ctm.b * local_ctm.b) > img->w * 2) + if (sqrtf(ctm.a * ctm.a + ctm.b * ctm.b) > img->w * 2) dolerp = 0; - if (sqrtf(local_ctm.c * local_ctm.c + local_ctm.d * local_ctm.d) > img->h * 2) + if (sqrtf(ctm.c * ctm.c + ctm.d * ctm.d) > img->h * 2) dolerp = 0; } - bbox = fz_irect_from_rect(fz_transform_rect(fz_unit_rect, local_ctm)); + bbox = fz_irect_from_rect(fz_transform_rect(fz_unit_rect, ctm)); bbox = fz_intersect_irect(bbox, *scissor); x = bbox.x0; @@ -3934,21 +3933,21 @@ fz_paint_image_imp(fz_pixmap * FZ_RESTRICT dst, const fz_irect *scissor, fz_pixm return; /* map from screen space (x,y) to image space (u,v) */ - local_ctm = fz_pre_scale(local_ctm, 1.0f / img->w, 1.0f / img->h); - local_ctm = fz_invert_matrix(local_ctm); + ctm = fz_pre_scale(ctm, 1.0f / img->w, 1.0f / img->h); + ctm = fz_invert_matrix(ctm); - fa = (int)(local_ctm.a *= 65536.0f); - fb = (int)(local_ctm.b *= 65536.0f); - fc = (int)(local_ctm.c *= 65536.0f); - fd = (int)(local_ctm.d *= 65536.0f); - local_ctm.e *= 65536.0f; - local_ctm.f *= 65536.0f; + fa = (int)(ctm.a *= 65536.0f); + fb = (int)(ctm.b *= 65536.0f); + fc = (int)(ctm.c *= 65536.0f); + fd = (int)(ctm.d *= 65536.0f); + ctm.e *= 65536.0f; + ctm.f *= 65536.0f; /* Calculate initial texture positions. Do a half step to start. */ /* Bug 693021: Keep calculation in float for as long as possible to * avoid overflow. */ - u = (int)((local_ctm.a * x) + (local_ctm.c * y) + local_ctm.e + ((local_ctm.a + local_ctm.c) * .5f)); - v = (int)((local_ctm.b * x) + (local_ctm.d * y) + local_ctm.f + ((local_ctm.b + local_ctm.d) * .5f)); + u = (int)((ctm.a * x) + (ctm.c * y) + ctm.e + ((ctm.a + ctm.c) * .5f)); + v = (int)((ctm.b * x) + (ctm.d * y) + ctm.f + ((ctm.b + ctm.d) * .5f)); dp = dst->samples + (unsigned int)((y - dst->y) * dst->stride + (x - dst->x) * dst->n); da = dst->alpha; @@ -4063,14 +4062,14 @@ fz_paint_image_imp(fz_pixmap * FZ_RESTRICT dst, const fz_irect *scissor, fz_pixm } void -fz_paint_image_with_color(fz_pixmap * FZ_RESTRICT dst, const fz_irect * FZ_RESTRICT scissor, fz_pixmap * FZ_RESTRICT shape, fz_pixmap * FZ_RESTRICT group_alpha, const fz_pixmap * FZ_RESTRICT img, const fz_matrix * FZ_RESTRICT ctm, const byte * FZ_RESTRICT color, int lerp_allowed, int as_tiled, const fz_overprint * FZ_RESTRICT eop) +fz_paint_image_with_color(fz_pixmap *dst, const fz_irect *scissor, fz_pixmap *shape, fz_pixmap *group_alpha, const fz_pixmap *img, fz_matrix ctm, const byte *color, int lerp_allowed, int as_tiled, const fz_overprint *eop) { assert(img->n == 1); fz_paint_image_imp(dst, scissor, shape, group_alpha, img, ctm, color, 255, lerp_allowed, as_tiled, eop); } void -fz_paint_image(fz_pixmap * FZ_RESTRICT dst, const fz_irect * FZ_RESTRICT scissor, fz_pixmap * FZ_RESTRICT shape, fz_pixmap * FZ_RESTRICT group_alpha, const fz_pixmap * FZ_RESTRICT img, const fz_matrix * FZ_RESTRICT ctm, int alpha, int lerp_allowed, int as_tiled, const fz_overprint * FZ_RESTRICT eop) +fz_paint_image(fz_pixmap *dst, const fz_irect *scissor, fz_pixmap *shape, fz_pixmap *group_alpha, const fz_pixmap *img, fz_matrix ctm, int alpha, int lerp_allowed, int as_tiled, const fz_overprint *eop) { fz_paint_image_imp(dst, scissor, shape, group_alpha, img, ctm, NULL, alpha, lerp_allowed, as_tiled, eop); } diff --git a/source/fitz/draw-device.c b/source/fitz/draw-device.c index 63b20f67..d31fa9d8 100644 --- a/source/fitz/draw-device.c +++ b/source/fitz/draw-device.c @@ -601,11 +601,11 @@ push_group_for_separations(fz_context *ctx, fz_draw_device *dev, const fz_color_ } static void -fz_draw_fill_path(fz_context *ctx, fz_device *devp, const fz_path *path, int even_odd, const fz_matrix *in_ctm, +fz_draw_fill_path(fz_context *ctx, fz_device *devp, const fz_path *path, int even_odd, fz_matrix in_ctm, fz_colorspace *colorspace_in, const float *color, float alpha, const fz_color_params *color_params) { fz_draw_device *dev = (fz_draw_device*)devp; - fz_matrix ctm = fz_concat(*in_ctm, dev->transform); + fz_matrix ctm = fz_concat(in_ctm, dev->transform); fz_rasterizer *rast = dev->rast; fz_colorspace *colorspace = fz_default_colorspace(ctx, dev->default_cs, colorspace_in); float expansion = fz_matrix_expansion(ctm); @@ -623,7 +623,7 @@ fz_draw_fill_path(fz_context *ctx, fz_device *devp, const fz_path *path, int eve flatness = 0.001f; bbox = fz_intersect_irect(fz_pixmap_bbox(ctx, state->dest), state->scissor); - if (fz_flatten_fill_path(ctx, rast, path, &ctm, flatness, &bbox, &bbox)) + if (fz_flatten_fill_path(ctx, rast, path, ctm, flatness, &bbox, &bbox)) return; if (state->blendmode & FZ_BLEND_KNOCKOUT) @@ -635,7 +635,7 @@ fz_draw_fill_path(fz_context *ctx, fz_device *devp, const fz_path *path, int eve if (state->shape) { if (!rast->fns.reusable) - fz_flatten_fill_path(ctx, rast, path, &ctm, flatness, &bbox, NULL); + fz_flatten_fill_path(ctx, rast, path, ctm, flatness, &bbox, NULL); colorbv[0] = 255; fz_convert_rasterizer(ctx, rast, even_odd, state->shape, colorbv, 0); @@ -643,7 +643,7 @@ fz_draw_fill_path(fz_context *ctx, fz_device *devp, const fz_path *path, int eve if (state->group_alpha) { if (!rast->fns.reusable) - fz_flatten_fill_path(ctx, rast, path, &ctm, flatness, &bbox, NULL); + fz_flatten_fill_path(ctx, rast, path, ctm, flatness, &bbox, NULL); colorbv[0] = alpha * 255; fz_convert_rasterizer(ctx, rast, even_odd, state->group_alpha, colorbv, 0); @@ -654,11 +654,11 @@ fz_draw_fill_path(fz_context *ctx, fz_device *devp, const fz_path *path, int eve } static void -fz_draw_stroke_path(fz_context *ctx, fz_device *devp, const fz_path *path, const fz_stroke_state *stroke, const fz_matrix *in_ctm, +fz_draw_stroke_path(fz_context *ctx, fz_device *devp, const fz_path *path, const fz_stroke_state *stroke, fz_matrix in_ctm, fz_colorspace *colorspace_in, const float *color, float alpha, const fz_color_params *color_params) { fz_draw_device *dev = (fz_draw_device*)devp; - fz_matrix ctm = fz_concat(*in_ctm, dev->transform); + fz_matrix ctm = fz_concat(in_ctm, dev->transform); fz_rasterizer *rast = dev->rast; fz_colorspace *colorspace = fz_default_colorspace(ctx, dev->default_cs, colorspace_in); float expansion = fz_matrix_expansion(ctm); @@ -683,7 +683,7 @@ fz_draw_stroke_path(fz_context *ctx, fz_device *devp, const fz_path *path, const flatness = 0.001f; bbox = fz_intersect_irect(fz_pixmap_bbox_no_ctx(state->dest), state->scissor); - if (fz_flatten_stroke_path(ctx, rast, path, stroke, &ctm, flatness, linewidth, &bbox, &bbox)) + if (fz_flatten_stroke_path(ctx, rast, path, stroke, ctm, flatness, linewidth, &bbox, &bbox)) return; if (state->blendmode & FZ_BLEND_KNOCKOUT) @@ -704,7 +704,7 @@ fz_draw_stroke_path(fz_context *ctx, fz_device *devp, const fz_path *path, const if (state->shape) { if (!rast->fns.reusable) - (void)fz_flatten_stroke_path(ctx, rast, path, stroke, &ctm, flatness, linewidth, &bbox, NULL); + (void)fz_flatten_stroke_path(ctx, rast, path, stroke, ctm, flatness, linewidth, &bbox, NULL); colorbv[0] = 255; fz_convert_rasterizer(ctx, rast, 0, state->shape, colorbv, 0); @@ -712,7 +712,7 @@ fz_draw_stroke_path(fz_context *ctx, fz_device *devp, const fz_path *path, const if (state->group_alpha) { if (!rast->fns.reusable) - (void)fz_flatten_stroke_path(ctx, rast, path, stroke, &ctm, flatness, linewidth, &bbox, NULL); + (void)fz_flatten_stroke_path(ctx, rast, path, stroke, ctm, flatness, linewidth, &bbox, NULL); colorbv[0] = 255 * alpha; fz_convert_rasterizer(ctx, rast, 0, state->group_alpha, colorbv, 0); @@ -732,10 +732,10 @@ fz_draw_stroke_path(fz_context *ctx, fz_device *devp, const fz_path *path, const } static void -fz_draw_clip_path(fz_context *ctx, fz_device *devp, const fz_path *path, int even_odd, const fz_matrix *in_ctm, const fz_rect *scissor) +fz_draw_clip_path(fz_context *ctx, fz_device *devp, const fz_path *path, int even_odd, fz_matrix in_ctm, const fz_rect *scissor) { fz_draw_device *dev = (fz_draw_device*)devp; - fz_matrix ctm = fz_concat(*in_ctm, dev->transform); + fz_matrix ctm = fz_concat(in_ctm, dev->transform); fz_rasterizer *rast = dev->rast; float expansion = fz_matrix_expansion(ctm); @@ -765,7 +765,7 @@ fz_draw_clip_path(fz_context *ctx, fz_device *devp, const fz_path *path, int eve bbox = fz_intersect_irect(fz_pixmap_bbox(ctx, state->dest), state->scissor); } - if (fz_flatten_fill_path(ctx, rast, path, &ctm, flatness, &bbox, &bbox) || fz_is_rect_rasterizer(ctx, rast)) + if (fz_flatten_fill_path(ctx, rast, path, ctm, flatness, &bbox, &bbox) || fz_is_rect_rasterizer(ctx, rast)) { state[1].scissor = bbox; state[1].mask = NULL; @@ -806,10 +806,10 @@ fz_draw_clip_path(fz_context *ctx, fz_device *devp, const fz_path *path, int eve } static void -fz_draw_clip_stroke_path(fz_context *ctx, fz_device *devp, const fz_path *path, const fz_stroke_state *stroke, const fz_matrix *in_ctm, const fz_rect *scissor) +fz_draw_clip_stroke_path(fz_context *ctx, fz_device *devp, const fz_path *path, const fz_stroke_state *stroke, fz_matrix in_ctm, const fz_rect *scissor) { fz_draw_device *dev = (fz_draw_device*)devp; - fz_matrix ctm = fz_concat(*in_ctm, dev->transform); + fz_matrix ctm = fz_concat(in_ctm, dev->transform); fz_rasterizer *rast = dev->rast; float expansion = fz_matrix_expansion(ctm); @@ -846,7 +846,7 @@ fz_draw_clip_stroke_path(fz_context *ctx, fz_device *devp, const fz_path *path, bbox = fz_intersect_irect(fz_pixmap_bbox(ctx, state->dest), state->scissor); } - if (fz_flatten_stroke_path(ctx, rast, path, stroke, &ctm, flatness, linewidth, &bbox, &bbox)) + if (fz_flatten_stroke_path(ctx, rast, path, stroke, ctm, flatness, linewidth, &bbox, &bbox)) { state[1].scissor = bbox; state[1].mask = NULL; @@ -965,11 +965,11 @@ draw_glyph(unsigned char *colorbv, fz_pixmap *dst, fz_glyph *glyph, } static void -fz_draw_fill_text(fz_context *ctx, fz_device *devp, const fz_text *text, const fz_matrix *in_ctm, +fz_draw_fill_text(fz_context *ctx, fz_device *devp, const fz_text *text, fz_matrix in_ctm, fz_colorspace *colorspace_in, const float *color, float alpha, const fz_color_params *color_params) { fz_draw_device *dev = (fz_draw_device*)devp; - fz_matrix ctm = fz_concat(*in_ctm, dev->transform); + fz_matrix ctm = fz_concat(in_ctm, dev->transform); fz_draw_state *state = &dev->stack[dev->top]; fz_colorspace *model = state->dest->colorspace; unsigned char colorbv[FZ_MAX_COLORS + 1]; @@ -1037,13 +1037,13 @@ fz_draw_fill_text(fz_context *ctx, fz_device *devp, const fz_text *text, const f fz_matrix mat; mat.a = pixmap->w; mat.b = mat.c = 0; mat.d = pixmap->h; mat.e = x + pixmap->x; mat.f = y + pixmap->y; - fz_paint_image(state->dest, &state->scissor, state->shape, state->group_alpha, pixmap, &mat, alpha * 255, !(devp->hints & FZ_DONT_INTERPOLATE_IMAGES), devp->flags & FZ_DEVFLAG_GRIDFIT_AS_TILED, eop); + fz_paint_image(state->dest, &state->scissor, state->shape, state->group_alpha, pixmap, mat, alpha * 255, !(devp->hints & FZ_DONT_INTERPOLATE_IMAGES), devp->flags & FZ_DEVFLAG_GRIDFIT_AS_TILED, eop); } fz_drop_glyph(ctx, glyph); } else { - fz_path *path = fz_outline_glyph(ctx, span->font, gid, &tm); + fz_path *path = fz_outline_glyph(ctx, span->font, gid, tm); if (path) { fz_draw_fill_path(ctx, devp, path, 0, in_ctm, colorspace, color, alpha, color_params); @@ -1063,10 +1063,10 @@ fz_draw_fill_text(fz_context *ctx, fz_device *devp, const fz_text *text, const f static void fz_draw_stroke_text(fz_context *ctx, fz_device *devp, const fz_text *text, const fz_stroke_state *stroke, - const fz_matrix *in_ctm, fz_colorspace *colorspace_in, const float *color, float alpha, const fz_color_params *color_params) + fz_matrix in_ctm, fz_colorspace *colorspace_in, const float *color, float alpha, const fz_color_params *color_params) { fz_draw_device *dev = (fz_draw_device*)devp; - fz_matrix ctm = fz_concat(*in_ctm, dev->transform); + fz_matrix ctm = fz_concat(in_ctm, dev->transform); fz_draw_state *state = &dev->stack[dev->top]; unsigned char colorbv[FZ_MAX_COLORS + 1]; unsigned char solid = 255; @@ -1107,7 +1107,7 @@ fz_draw_stroke_text(fz_context *ctx, fz_device *devp, const fz_text *text, const tm.f = span->items[i].y; trm = fz_concat(tm, ctm); - glyph = fz_render_stroked_glyph(ctx, span->font, gid, &trm, &ctm, stroke, &state->scissor, aa); + glyph = fz_render_stroked_glyph(ctx, span->font, gid, &trm, ctm, stroke, &state->scissor, aa); if (glyph) { int x = (int)trm.e; @@ -1121,7 +1121,7 @@ fz_draw_stroke_text(fz_context *ctx, fz_device *devp, const fz_text *text, const } else { - fz_path *path = fz_outline_glyph(ctx, span->font, gid, &tm); + fz_path *path = fz_outline_glyph(ctx, span->font, gid, tm); if (path) { fz_draw_stroke_path(ctx, devp, path, stroke, in_ctm, colorspace, color, alpha, color_params); @@ -1140,10 +1140,10 @@ fz_draw_stroke_text(fz_context *ctx, fz_device *devp, const fz_text *text, const } static void -fz_draw_clip_text(fz_context *ctx, fz_device *devp, const fz_text *text, const fz_matrix *in_ctm, const fz_rect *scissor) +fz_draw_clip_text(fz_context *ctx, fz_device *devp, const fz_text *text, fz_matrix in_ctm, const fz_rect *scissor) { fz_draw_device *dev = (fz_draw_device*)devp; - fz_matrix ctm = fz_concat(*in_ctm, dev->transform); + fz_matrix ctm = fz_concat(in_ctm, dev->transform); fz_irect bbox; fz_pixmap *mask, *dest, *shape, *group_alpha; fz_matrix tm, trm; @@ -1238,7 +1238,7 @@ fz_draw_clip_text(fz_context *ctx, fz_device *devp, const fz_text *text, const f } else { - fz_path *path = fz_outline_glyph(ctx, span->font, gid, &tm); + fz_path *path = fz_outline_glyph(ctx, span->font, gid, tm); if (path) { fz_pixmap *old_dest; @@ -1278,10 +1278,10 @@ fz_draw_clip_text(fz_context *ctx, fz_device *devp, const fz_text *text, const f } static void -fz_draw_clip_stroke_text(fz_context *ctx, fz_device *devp, const fz_text *text, const fz_stroke_state *stroke, const fz_matrix *in_ctm, const fz_rect *scissor) +fz_draw_clip_stroke_text(fz_context *ctx, fz_device *devp, const fz_text *text, const fz_stroke_state *stroke, fz_matrix in_ctm, const fz_rect *scissor) { fz_draw_device *dev = (fz_draw_device*)devp; - fz_matrix ctm = fz_concat(*in_ctm, dev->transform); + fz_matrix ctm = fz_concat(in_ctm, dev->transform); fz_irect bbox; fz_pixmap *mask, *dest, *shape, *group_alpha; fz_matrix tm, trm; @@ -1356,7 +1356,7 @@ fz_draw_clip_stroke_text(fz_context *ctx, fz_device *devp, const fz_text *text, tm.f = span->items[i].y; trm = fz_concat(tm, ctm); - glyph = fz_render_stroked_glyph(ctx, span->font, gid, &trm, &ctm, stroke, &state->scissor, aa); + glyph = fz_render_stroked_glyph(ctx, span->font, gid, &trm, ctm, stroke, &state->scissor, aa); if (glyph) { int x = (int)trm.e; @@ -1370,7 +1370,7 @@ fz_draw_clip_stroke_text(fz_context *ctx, fz_device *devp, const fz_text *text, } else { - fz_path *path = fz_outline_glyph(ctx, span->font, gid, &tm); + fz_path *path = fz_outline_glyph(ctx, span->font, gid, tm); if (path) { fz_pixmap *old_dest; @@ -1411,15 +1411,15 @@ fz_draw_clip_stroke_text(fz_context *ctx, fz_device *devp, const fz_text *text, } static void -fz_draw_ignore_text(fz_context *ctx, fz_device *dev, const fz_text *text, const fz_matrix *ctm) +fz_draw_ignore_text(fz_context *ctx, fz_device *dev, const fz_text *text, fz_matrix ctm) { } static void -fz_draw_fill_shade(fz_context *ctx, fz_device *devp, fz_shade *shade, const fz_matrix *in_ctm, float alpha, const fz_color_params *color_params) +fz_draw_fill_shade(fz_context *ctx, fz_device *devp, fz_shade *shade, fz_matrix in_ctm, float alpha, const fz_color_params *color_params) { fz_draw_device *dev = (fz_draw_device*)devp; - fz_matrix ctm = fz_concat(*in_ctm, dev->transform); + fz_matrix ctm = fz_concat(in_ctm, dev->transform); fz_irect bbox, scissor; fz_pixmap *dest, *shape, *group_alpha; unsigned char colorbv[FZ_MAX_COLORS + 1]; @@ -1542,7 +1542,7 @@ fz_draw_fill_shade(fz_context *ctx, fz_device *devp, fz_shade *shade, const fz_m else eop = NULL; - fz_paint_shade(ctx, shade, colorspace, &ctm, dest, color_params, &bbox, eop); + fz_paint_shade(ctx, shade, colorspace, ctm, dest, color_params, &bbox, eop); if (shape) fz_clear_pixmap_rect_with_value(ctx, shape, 255, bbox); if (group_alpha) @@ -1682,10 +1682,10 @@ convert_pixmap_for_painting(fz_context *ctx, fz_pixmap *pixmap, fz_colorspace *m } static void -fz_draw_fill_image(fz_context *ctx, fz_device *devp, fz_image *image, const fz_matrix *in_ctm, float alpha, const fz_color_params *color_params) +fz_draw_fill_image(fz_context *ctx, fz_device *devp, fz_image *image, fz_matrix in_ctm, float alpha, const fz_color_params *color_params) { fz_draw_device *dev = (fz_draw_device*)devp; - fz_matrix local_ctm = fz_concat(*in_ctm, dev->transform); + fz_matrix local_ctm = fz_concat(in_ctm, dev->transform); fz_pixmap *pixmap; int after; int dx, dy; @@ -1816,7 +1816,7 @@ fz_draw_fill_image(fz_context *ctx, fz_device *devp, fz_image *image, const fz_m pixmap = convert_pixmap_for_painting(ctx, pixmap, model, src_cs, state->dest, color_params, dev, &eop); } - fz_paint_image(state->dest, &state->scissor, state->shape, state->group_alpha, pixmap, &local_ctm, alpha * 255, !(devp->hints & FZ_DONT_INTERPOLATE_IMAGES), devp->flags & FZ_DEVFLAG_GRIDFIT_AS_TILED, eop); + fz_paint_image(state->dest, &state->scissor, state->shape, state->group_alpha, pixmap, local_ctm, alpha * 255, !(devp->hints & FZ_DONT_INTERPOLATE_IMAGES), devp->flags & FZ_DEVFLAG_GRIDFIT_AS_TILED, eop); } fz_always(ctx) { @@ -1829,11 +1829,11 @@ fz_draw_fill_image(fz_context *ctx, fz_device *devp, fz_image *image, const fz_m } static void -fz_draw_fill_image_mask(fz_context *ctx, fz_device *devp, fz_image *image, const fz_matrix *in_ctm, +fz_draw_fill_image_mask(fz_context *ctx, fz_device *devp, fz_image *image, fz_matrix in_ctm, fz_colorspace *colorspace_in, const float *color, float alpha, const fz_color_params *color_params) { fz_draw_device *dev = (fz_draw_device*)devp; - fz_matrix local_ctm = fz_concat(*in_ctm, dev->transform); + fz_matrix local_ctm = fz_concat(in_ctm, dev->transform); unsigned char colorbv[FZ_MAX_COLORS + 1]; fz_pixmap *scaled = NULL; fz_pixmap *pixmap; @@ -1926,7 +1926,7 @@ fz_draw_fill_image_mask(fz_context *ctx, fz_device *devp, fz_image *image, const eop = resolve_color(ctx, &op, color, colorspace, alpha, color_params, colorbv, state->dest); - fz_paint_image_with_color(state->dest, &state->scissor, state->shape, state->group_alpha, pixmap, &local_ctm, colorbv, !(devp->hints & FZ_DONT_INTERPOLATE_IMAGES), devp->flags & FZ_DEVFLAG_GRIDFIT_AS_TILED, eop); + fz_paint_image_with_color(state->dest, &state->scissor, state->shape, state->group_alpha, pixmap, local_ctm, colorbv, !(devp->hints & FZ_DONT_INTERPOLATE_IMAGES), devp->flags & FZ_DEVFLAG_GRIDFIT_AS_TILED, eop); if (state->blendmode & FZ_BLEND_KNOCKOUT) fz_knockout_end(ctx, dev); @@ -1938,10 +1938,10 @@ fz_draw_fill_image_mask(fz_context *ctx, fz_device *devp, fz_image *image, const } static void -fz_draw_clip_image_mask(fz_context *ctx, fz_device *devp, fz_image *image, const fz_matrix *in_ctm, const fz_rect *scissor) +fz_draw_clip_image_mask(fz_context *ctx, fz_device *devp, fz_image *image, fz_matrix in_ctm, const fz_rect *scissor) { fz_draw_device *dev = (fz_draw_device*)devp; - fz_matrix local_ctm = fz_concat(*in_ctm, dev->transform); + fz_matrix local_ctm = fz_concat(in_ctm, dev->transform); fz_irect bbox; fz_pixmap *scaled = NULL; fz_pixmap *pixmap = NULL; @@ -2029,7 +2029,7 @@ fz_draw_clip_image_mask(fz_context *ctx, fz_device *devp, fz_image *image, const if (state[1].group_alpha) fz_dump_blend(ctx, "/GA=", state[1].group_alpha); #endif - fz_paint_image(state[1].mask, &bbox, state[1].shape, state[1].group_alpha, pixmap, &local_ctm, 255, !(devp->hints & FZ_DONT_INTERPOLATE_IMAGES), devp->flags & FZ_DEVFLAG_GRIDFIT_AS_TILED, 0); + fz_paint_image(state[1].mask, &bbox, state[1].shape, state[1].group_alpha, pixmap, local_ctm, 255, !(devp->hints & FZ_DONT_INTERPOLATE_IMAGES), devp->flags & FZ_DEVFLAG_GRIDFIT_AS_TILED, 0); #ifdef DUMP_GROUP_BLENDS fz_dump_blend(ctx, " to get ", state[1].mask); if (state[1].shape) @@ -2581,10 +2581,10 @@ fz_tile_size(fz_context *ctx, tile_record *tile) } static int -fz_draw_begin_tile(fz_context *ctx, fz_device *devp, const fz_rect *area, const fz_rect *view, float xstep, float ystep, const fz_matrix *in_ctm, int id) +fz_draw_begin_tile(fz_context *ctx, fz_device *devp, const fz_rect *area, const fz_rect *view, float xstep, float ystep, fz_matrix in_ctm, int id) { fz_draw_device *dev = (fz_draw_device*)devp; - fz_matrix ctm = fz_concat(*in_ctm, dev->transform); + fz_matrix ctm = fz_concat(in_ctm, dev->transform); fz_pixmap *dest = NULL; fz_pixmap *shape, *group_alpha; fz_irect bbox; @@ -2974,7 +2974,7 @@ fz_draw_drop_device(fz_context *ctx, fz_device *devp) } fz_device * -new_draw_device(fz_context *ctx, const fz_matrix *transform, fz_pixmap *dest, const fz_aa_context *aa, const fz_irect *clip, fz_colorspace *proof_cs) +new_draw_device(fz_context *ctx, fz_matrix transform, fz_pixmap *dest, const fz_aa_context *aa, const fz_irect *clip, fz_colorspace *proof_cs) { fz_draw_device *dev = fz_new_derived_device(ctx, fz_draw_device); @@ -3011,7 +3011,7 @@ new_draw_device(fz_context *ctx, const fz_matrix *transform, fz_pixmap *dest, co dev->super.set_default_colorspaces = fz_draw_set_default_colorspaces; dev->proof_cs = fz_keep_colorspace(ctx, proof_cs); - dev->transform = transform ? *transform : fz_identity; + dev->transform = transform; dev->flags = 0; dev->resolve_spots = 0; dev->top = 0; @@ -3079,31 +3079,31 @@ new_draw_device(fz_context *ctx, const fz_matrix *transform, fz_pixmap *dest, co } fz_device * -fz_new_draw_device(fz_context *ctx, const fz_matrix *transform, fz_pixmap *dest) +fz_new_draw_device(fz_context *ctx, fz_matrix transform, fz_pixmap *dest) { return new_draw_device(ctx, transform, dest, NULL, NULL, NULL); } fz_device * -fz_new_draw_device_with_bbox(fz_context *ctx, const fz_matrix *transform, fz_pixmap *dest, const fz_irect *clip) +fz_new_draw_device_with_bbox(fz_context *ctx, fz_matrix transform, fz_pixmap *dest, const fz_irect *clip) { return new_draw_device(ctx, transform, dest, NULL, clip, NULL); } fz_device * -fz_new_draw_device_with_proof(fz_context *ctx, const fz_matrix *transform, fz_pixmap *dest, fz_colorspace *cs) +fz_new_draw_device_with_proof(fz_context *ctx, fz_matrix transform, fz_pixmap *dest, fz_colorspace *cs) { return new_draw_device(ctx, transform, dest, NULL, NULL, cs); } fz_device * -fz_new_draw_device_with_bbox_proof(fz_context *ctx, const fz_matrix *transform, fz_pixmap *dest, const fz_irect *clip, fz_colorspace *cs) +fz_new_draw_device_with_bbox_proof(fz_context *ctx, fz_matrix transform, fz_pixmap *dest, const fz_irect *clip, fz_colorspace *cs) { return new_draw_device(ctx, transform, dest, NULL, clip, cs); } fz_device * -fz_new_draw_device_type3(fz_context *ctx, const fz_matrix *transform, fz_pixmap *dest) +fz_new_draw_device_type3(fz_context *ctx, fz_matrix transform, fz_pixmap *dest) { fz_draw_device *dev = (fz_draw_device*)fz_new_draw_device(ctx, transform, dest); dev->flags |= FZ_DRAWDEV_FLAGS_TYPE3; @@ -3111,7 +3111,7 @@ fz_new_draw_device_type3(fz_context *ctx, const fz_matrix *transform, fz_pixmap } fz_irect * -fz_bound_path_accurate(fz_context *ctx, fz_irect *bbox, const fz_irect *scissor, const fz_path *path, const fz_stroke_state *stroke, const fz_matrix *ctm, float flatness, float linewidth) +fz_bound_path_accurate(fz_context *ctx, fz_irect *bbox, const fz_irect *scissor, const fz_path *path, const fz_stroke_state *stroke, fz_matrix ctm, float flatness, float linewidth) { fz_rasterizer *rast = fz_new_rasterizer(ctx, NULL); @@ -3271,7 +3271,7 @@ fz_new_draw_device_with_options(fz_context *ctx, const fz_draw_options *opts, co else fz_clear_pixmap_with_value(ctx, *pixmap, 255); - dev = new_draw_device(ctx, &transform, *pixmap, &aa, NULL, NULL); + dev = new_draw_device(ctx, transform, *pixmap, &aa, NULL, NULL); } fz_catch(ctx) { diff --git a/source/fitz/draw-glyph.c b/source/fitz/draw-glyph.c index 7696a59c..21b43539 100644 --- a/source/fitz/draw-glyph.c +++ b/source/fitz/draw-glyph.c @@ -178,7 +178,7 @@ fz_subpixel_adjust(fz_context *ctx, fz_matrix *ctm, fz_matrix *subpix_ctm, unsig } fz_glyph * -fz_render_stroked_glyph(fz_context *ctx, fz_font *font, int gid, fz_matrix *trm, const fz_matrix *ctm, const fz_stroke_state *stroke, const fz_irect *scissor, int aa) +fz_render_stroked_glyph(fz_context *ctx, fz_font *font, int gid, fz_matrix *trm, fz_matrix ctm, const fz_stroke_state *stroke, const fz_irect *scissor, int aa) { if (fz_font_ft_face(ctx, font)) { @@ -188,13 +188,13 @@ fz_render_stroked_glyph(fz_context *ctx, fz_font *font, int gid, fz_matrix *trm, if (stroke->dash_len > 0) return NULL; (void)fz_subpixel_adjust(ctx, trm, &subpix_trm, &qe, &qf); - return fz_render_ft_stroked_glyph(ctx, font, gid, &subpix_trm, ctm, stroke, aa); + return fz_render_ft_stroked_glyph(ctx, font, gid, subpix_trm, ctm, stroke, aa); } return fz_render_glyph(ctx, font, gid, trm, NULL, scissor, 1, aa); } fz_pixmap * -fz_render_stroked_glyph_pixmap(fz_context *ctx, fz_font *font, int gid, fz_matrix *trm, const fz_matrix *ctm, const fz_stroke_state *stroke, const fz_irect *scissor, int aa) +fz_render_stroked_glyph_pixmap(fz_context *ctx, fz_font *font, int gid, fz_matrix *trm, fz_matrix ctm, const fz_stroke_state *stroke, const fz_irect *scissor, int aa) { if (fz_font_ft_face(ctx, font)) { @@ -204,7 +204,7 @@ fz_render_stroked_glyph_pixmap(fz_context *ctx, fz_font *font, int gid, fz_matri if (stroke->dash_len > 0) return NULL; (void)fz_subpixel_adjust(ctx, trm, &subpix_trm, &qe, &qf); - return fz_render_ft_stroked_glyph_pixmap(ctx, font, gid, &subpix_trm, ctm, stroke, aa); + return fz_render_ft_stroked_glyph_pixmap(ctx, font, gid, subpix_trm, ctm, stroke, aa); } return fz_render_glyph_pixmap(ctx, font, gid, trm, scissor, aa); } @@ -315,7 +315,7 @@ fz_render_glyph(fz_context *ctx, fz_font *font, int gid, fz_matrix *ctm, fz_colo { if (is_ft_font) { - val = fz_render_ft_glyph(ctx, font, gid, &subpix_ctm, aa); + val = fz_render_ft_glyph(ctx, font, gid, subpix_ctm, aa); } else if (fz_font_t3_procs(ctx, font)) { @@ -330,7 +330,7 @@ fz_render_glyph(fz_context *ctx, fz_font *font, int gid, fz_matrix *ctm, fz_colo */ fz_unlock(ctx, FZ_LOCK_GLYPHCACHE); locked = 0; - val = fz_render_t3_glyph(ctx, font, gid, &subpix_ctm, model, scissor, aa); + val = fz_render_t3_glyph(ctx, font, gid, subpix_ctm, model, scissor, aa); fz_lock(ctx, FZ_LOCK_GLYPHCACHE); locked = 1; } @@ -432,11 +432,11 @@ fz_render_glyph_pixmap(fz_context *ctx, fz_font *font, int gid, fz_matrix *ctm, if (is_ft_font) { - val = fz_render_ft_glyph_pixmap(ctx, font, gid, &subpix_ctm, aa); + val = fz_render_ft_glyph_pixmap(ctx, font, gid, subpix_ctm, aa); } else if (fz_font_t3_procs(ctx, font)) { - val = fz_render_t3_glyph_pixmap(ctx, font, gid, &subpix_ctm, NULL, scissor, aa); + val = fz_render_t3_glyph_pixmap(ctx, font, gid, subpix_ctm, NULL, scissor, aa); } else { diff --git a/source/fitz/draw-imp.h b/source/fitz/draw-imp.h index eb3e36d2..1d6e691a 100644 --- a/source/fitz/draw-imp.h +++ b/source/fitz/draw-imp.h @@ -438,36 +438,36 @@ typedef enum fz_rasterizer *fz_new_edgebuffer(fz_context *ctx, fz_edgebuffer_rule rule); -int fz_flatten_fill_path(fz_context *ctx, fz_rasterizer *rast, const fz_path *path, const fz_matrix *ctm, float flatness, const fz_irect *irect, fz_irect *bounds); -int fz_flatten_stroke_path(fz_context *ctx, fz_rasterizer *rast, const fz_path *path, const fz_stroke_state *stroke, const fz_matrix *ctm, float flatness, float linewidth, const fz_irect *irect, fz_irect *bounds); +int fz_flatten_fill_path(fz_context *ctx, fz_rasterizer *rast, const fz_path *path, fz_matrix ctm, float flatness, const fz_irect *irect, fz_irect *bounds); +int fz_flatten_stroke_path(fz_context *ctx, fz_rasterizer *rast, const fz_path *path, const fz_stroke_state *stroke, fz_matrix ctm, float flatness, float linewidth, const fz_irect *irect, fz_irect *bounds); -fz_irect *fz_bound_path_accurate(fz_context *ctx, fz_irect *bbox, const fz_irect *scissor, const fz_path *path, const fz_stroke_state *stroke, const fz_matrix *ctm, float flatness, float linewidth); +fz_irect *fz_bound_path_accurate(fz_context *ctx, fz_irect *bbox, const fz_irect *scissor, const fz_path *path, const fz_stroke_state *stroke, fz_matrix ctm, float flatness, float linewidth); /* * Plotting functions. */ -typedef void (fz_solid_color_painter_t)(unsigned char * FZ_RESTRICT dp, int n, int w, const unsigned char * FZ_RESTRICT color, int da, const fz_overprint * FZ_RESTRICT eop); +typedef void (fz_solid_color_painter_t)(unsigned char * FZ_RESTRICT dp, int n, int w, const unsigned char * FZ_RESTRICT color, int da, const fz_overprint *eop); -typedef void (fz_span_painter_t)(unsigned char * FZ_RESTRICT dp, int da, const unsigned char * FZ_RESTRICT sp, int sa, int n, int w, int alpha, const fz_overprint * FZ_RESTRICT eop); -typedef void (fz_span_color_painter_t)(unsigned char * FZ_RESTRICT dp, const unsigned char * FZ_RESTRICT mp, int n, int w, const unsigned char * FZ_RESTRICT color, int da, const fz_overprint * FZ_RESTRICT eop); +typedef void (fz_span_painter_t)(unsigned char * FZ_RESTRICT dp, int da, const unsigned char * FZ_RESTRICT sp, int sa, int n, int w, int alpha, const fz_overprint *eop); +typedef void (fz_span_color_painter_t)(unsigned char * FZ_RESTRICT dp, const unsigned char * FZ_RESTRICT mp, int n, int w, const unsigned char * FZ_RESTRICT color, int da, const fz_overprint *eop); -fz_solid_color_painter_t *fz_get_solid_color_painter(int n, const unsigned char * FZ_RESTRICT color, int da, const fz_overprint * FZ_RESTRICT eop); -fz_span_painter_t *fz_get_span_painter(int da, int sa, int n, int alpha, const fz_overprint * FZ_RESTRICT eop); -fz_span_color_painter_t *fz_get_span_color_painter(int n, int da, const unsigned char * FZ_RESTRICT color, const fz_overprint * FZ_RESTRICT eop); +fz_solid_color_painter_t *fz_get_solid_color_painter(int n, const unsigned char *color, int da, const fz_overprint *eop); +fz_span_painter_t *fz_get_span_painter(int da, int sa, int n, int alpha, const fz_overprint *eop); +fz_span_color_painter_t *fz_get_span_color_painter(int n, int da, const unsigned char *color, const fz_overprint *eop); -void fz_paint_image(fz_pixmap * FZ_RESTRICT dst, const fz_irect * FZ_RESTRICT scissor, fz_pixmap * FZ_RESTRICT shape, fz_pixmap * FZ_RESTRICT group_alpha, const fz_pixmap * FZ_RESTRICT img, const fz_matrix * FZ_RESTRICT ctm, int alpha, int lerp_allowed, int gridfit_as_tiled, const fz_overprint * FZ_RESTRICT eop); -void fz_paint_image_with_color(fz_pixmap * FZ_RESTRICT dst, const fz_irect * FZ_RESTRICT scissor, fz_pixmap *FZ_RESTRICT shape, fz_pixmap * FZ_RESTRICT group_alpha, const fz_pixmap * FZ_RESTRICT img, const fz_matrix * FZ_RESTRICT ctm, const unsigned char * FZ_RESTRICT colorbv, int lerp_allowed, int gridfit_as_tiled, const fz_overprint * FZ_RESTRICT eop); +void fz_paint_image(fz_pixmap *dst, const fz_irect *scissor, fz_pixmap *shape, fz_pixmap *group_alpha, const fz_pixmap *img, fz_matrix ctm, int alpha, int lerp_allowed, int gridfit_as_tiled, const fz_overprint *eop); +void fz_paint_image_with_color(fz_pixmap *dst, const fz_irect *scissor, fz_pixmap *shape, fz_pixmap *group_alpha, const fz_pixmap *img, fz_matrix ctm, const unsigned char *colorbv, int lerp_allowed, int gridfit_as_tiled, const fz_overprint *eop); -void fz_paint_pixmap(fz_pixmap * FZ_RESTRICT dst, const fz_pixmap * FZ_RESTRICT src, int alpha); -void fz_paint_pixmap_alpha(fz_pixmap * FZ_RESTRICT dst, const fz_pixmap * FZ_RESTRICT src, int alpha); -void fz_paint_pixmap_with_mask(fz_pixmap * FZ_RESTRICT dst, const fz_pixmap * FZ_RESTRICT src, const fz_pixmap * FZ_RESTRICT msk); -void fz_paint_pixmap_with_bbox(fz_pixmap * FZ_RESTRICT dst, const fz_pixmap * FZ_RESTRICT src, int alpha, fz_irect bbox); -void fz_paint_pixmap_with_overprint(fz_pixmap * FZ_RESTRICT dst, const fz_pixmap * FZ_RESTRICT src, const fz_overprint *op); +void fz_paint_pixmap(fz_pixmap *dst, const fz_pixmap *src, int alpha); +void fz_paint_pixmap_alpha(fz_pixmap *dst, const fz_pixmap *src, int alpha); +void fz_paint_pixmap_with_mask(fz_pixmap *dst, const fz_pixmap *src, const fz_pixmap *msk); +void fz_paint_pixmap_with_bbox(fz_pixmap *dst, const fz_pixmap *src, int alpha, fz_irect bbox); +void fz_paint_pixmap_with_overprint(fz_pixmap *dst, const fz_pixmap *src, const fz_overprint *op); -void fz_blend_pixmap(fz_context *ctx, fz_pixmap * FZ_RESTRICT dst, fz_pixmap * FZ_RESTRICT src, int alpha, int blendmode, int isolated, const fz_pixmap * FZ_RESTRICT shape); -void fz_blend_pixmap_knockout(fz_context *ctx, fz_pixmap * FZ_RESTRICT dst, fz_pixmap * FZ_RESTRICT src, const fz_pixmap * FZ_RESTRICT shape); +void fz_blend_pixmap(fz_context *ctx, fz_pixmap *dst, fz_pixmap *src, int alpha, int blendmode, int isolated, const fz_pixmap *shape); +void fz_blend_pixmap_knockout(fz_context *ctx, fz_pixmap *dst, fz_pixmap *src, const fz_pixmap *shape); -void fz_paint_glyph(const unsigned char * FZ_RESTRICT colorbv, fz_pixmap * FZ_RESTRICT dst, unsigned char * FZ_RESTRICT dp, const fz_glyph * FZ_RESTRICT glyph, int w, int h, int skip_x, int skip_y, const fz_overprint * FZ_RESTRICT eop); +void fz_paint_glyph(const unsigned char *colorbv, fz_pixmap *dst, unsigned char *dp, const fz_glyph *glyph, int w, int h, int skip_x, int skip_y, const fz_overprint *eop); #endif diff --git a/source/fitz/draw-mesh.c b/source/fitz/draw-mesh.c index 5a3bef40..3b08c1e1 100644 --- a/source/fitz/draw-mesh.c +++ b/source/fitz/draw-mesh.c @@ -211,7 +211,7 @@ do_paint_tri(fz_context *ctx, void *arg, fz_vertex *av, fz_vertex *bv, fz_vertex } void -fz_paint_shade(fz_context *ctx, fz_shade *shade, fz_colorspace *colorspace, const fz_matrix *ctm, fz_pixmap *dest, const fz_color_params *color_params, const fz_irect *bbox, const fz_overprint *op) +fz_paint_shade(fz_context *ctx, fz_shade *shade, fz_colorspace *colorspace, fz_matrix ctm, fz_pixmap *dest, const fz_color_params *color_params, const fz_irect *bbox, const fz_overprint *op) { unsigned char clut[256][FZ_MAX_COLORS]; fz_pixmap *temp = NULL; @@ -230,7 +230,7 @@ fz_paint_shade(fz_context *ctx, fz_shade *shade, fz_colorspace *colorspace, cons fz_try(ctx) { - local_ctm = fz_concat(shade->matrix, *ctm); + local_ctm = fz_concat(shade->matrix, ctm); if (shade->use_function) { diff --git a/source/fitz/draw-path.c b/source/fitz/draw-path.c index 74456df5..d809b7d8 100644 --- a/source/fitz/draw-path.c +++ b/source/fitz/draw-path.c @@ -48,17 +48,17 @@ static void -line(fz_context *ctx, fz_rasterizer *rast, const fz_matrix *ctm, float x0, float y0, float x1, float y1) +line(fz_context *ctx, fz_rasterizer *rast, fz_matrix ctm, float x0, float y0, float x1, float y1) { - float tx0 = ctm->a * x0 + ctm->c * y0 + ctm->e; - float ty0 = ctm->b * x0 + ctm->d * y0 + ctm->f; - float tx1 = ctm->a * x1 + ctm->c * y1 + ctm->e; - float ty1 = ctm->b * x1 + ctm->d * y1 + ctm->f; + float tx0 = ctm.a * x0 + ctm.c * y0 + ctm.e; + float ty0 = ctm.b * x0 + ctm.d * y0 + ctm.f; + float tx1 = ctm.a * x1 + ctm.c * y1 + ctm.e; + float ty1 = ctm.b * x1 + ctm.d * y1 + ctm.f; fz_insert_rasterizer(ctx, rast, tx0, ty0, tx1, ty1, 0); } static void -bezier(fz_context *ctx, fz_rasterizer *rast, const fz_matrix *ctm, float flatness, +bezier(fz_context *ctx, fz_rasterizer *rast, fz_matrix ctm, float flatness, float xa, float ya, float xb, float yb, float xc, float yc, @@ -112,7 +112,7 @@ bezier(fz_context *ctx, fz_rasterizer *rast, const fz_matrix *ctm, float flatnes } static void -quad(fz_context *ctx, fz_rasterizer *rast, const fz_matrix *ctm, float flatness, +quad(fz_context *ctx, fz_rasterizer *rast, fz_matrix ctm, float flatness, float xa, float ya, float xb, float yb, float xc, float yc, int depth) @@ -153,7 +153,7 @@ quad(fz_context *ctx, fz_rasterizer *rast, const fz_matrix *ctm, float flatness, typedef struct { fz_rasterizer *rast; - const fz_matrix *ctm; + fz_matrix ctm; float flatness; fz_point b; fz_point c; @@ -218,7 +218,7 @@ static void flatten_rectto(fz_context *ctx, void *arg_, float x0, float y0, float x1, float y1) { flatten_arg *arg = (flatten_arg *)arg_; - const fz_matrix *ctm = arg->ctm; + fz_matrix ctm = arg->ctm; flatten_moveto(ctx, arg_, x0, y0); @@ -226,21 +226,21 @@ flatten_rectto(fz_context *ctx, void *arg_, float x0, float y0, float x1, float { /* In the case where we have an axis aligned rectangle, do some * horrid antidropout stuff. */ - if (ctm->b == 0 && ctm->c == 0) + if (ctm.b == 0 && ctm.c == 0) { - float tx0 = ctm->a * x0 + ctm->e; - float ty0 = ctm->d * y0 + ctm->f; - float tx1 = ctm->a * x1 + ctm->e; - float ty1 = ctm->d * y1 + ctm->f; + float tx0 = ctm.a * x0 + ctm.e; + float ty0 = ctm.d * y0 + ctm.f; + float tx1 = ctm.a * x1 + ctm.e; + float ty1 = ctm.d * y1 + ctm.f; fz_insert_rasterizer_rect(ctx, arg->rast, tx0, ty0, tx1, ty1); return; } - else if (ctm->a == 0 && ctm->d == 0) + else if (ctm.a == 0 && ctm.d == 0) { - float tx0 = ctm->c * y0 + ctm->e; - float ty0 = ctm->b * x0 + ctm->f; - float tx1 = ctm->c * y1 + ctm->e; - float ty1 = ctm->b * x1 + ctm->f; + float tx0 = ctm.c * y0 + ctm.e; + float ty0 = ctm.b * x0 + ctm.f; + float tx1 = ctm.c * y1 + ctm.e; + float ty1 = ctm.b * x1 + ctm.f; fz_insert_rasterizer_rect(ctx, arg->rast, tx0, ty1, tx1, ty0); return; } @@ -265,7 +265,7 @@ static const fz_path_walker flatten_proc = }; int -fz_flatten_fill_path(fz_context *ctx, fz_rasterizer *rast, const fz_path *path, const fz_matrix *ctm, float flatness, const fz_irect *scissor, fz_irect *bbox) +fz_flatten_fill_path(fz_context *ctx, fz_rasterizer *rast, const fz_path *path, fz_matrix ctm, float flatness, const fz_irect *scissor, fz_irect *bbox) { flatten_arg arg; @@ -312,7 +312,7 @@ enum { typedef struct sctx { fz_rasterizer *rast; - const fz_matrix *ctm; + fz_matrix ctm; float flatness; const fz_stroke_state *stroke; @@ -341,10 +341,10 @@ typedef struct sctx static void fz_add_line(fz_context *ctx, sctx *s, float x0, float y0, float x1, float y1, int rev) { - float tx0 = s->ctm->a * x0 + s->ctm->c * y0 + s->ctm->e; - float ty0 = s->ctm->b * x0 + s->ctm->d * y0 + s->ctm->f; - float tx1 = s->ctm->a * x1 + s->ctm->c * y1 + s->ctm->e; - float ty1 = s->ctm->b * x1 + s->ctm->d * y1 + s->ctm->f; + float tx0 = s->ctm.a * x0 + s->ctm.c * y0 + s->ctm.e; + float ty0 = s->ctm.b * x0 + s->ctm.d * y0 + s->ctm.f; + float tx1 = s->ctm.a * x1 + s->ctm.c * y1 + s->ctm.e; + float ty1 = s->ctm.b * x1 + s->ctm.d * y1 + s->ctm.f; fz_insert_rasterizer(ctx, s->rast, tx0, ty0, tx1, ty1, rev); } @@ -353,21 +353,21 @@ static void fz_add_horiz_rect(fz_context *ctx, sctx *s, float x0, float y0, float x1, float y1) { if (fz_antidropout_rasterizer(ctx, s->rast)) { - if (s->ctm->b == 0 && s->ctm->c == 0) + if (s->ctm.b == 0 && s->ctm.c == 0) { - float tx0 = s->ctm->a * x0 + s->ctm->e; - float ty0 = s->ctm->d * y0 + s->ctm->f; - float tx1 = s->ctm->a * x1 + s->ctm->e; - float ty1 = s->ctm->d * y1 + s->ctm->f; + float tx0 = s->ctm.a * x0 + s->ctm.e; + float ty0 = s->ctm.d * y0 + s->ctm.f; + float tx1 = s->ctm.a * x1 + s->ctm.e; + float ty1 = s->ctm.d * y1 + s->ctm.f; fz_insert_rasterizer_rect(ctx, s->rast, tx1, ty1, tx0, ty0); return; } - else if (s->ctm->a == 0 && s->ctm->d == 0) + else if (s->ctm.a == 0 && s->ctm.d == 0) { - float tx0 = s->ctm->c * y0 + s->ctm->e; - float ty0 = s->ctm->b * x0 + s->ctm->f; - float tx1 = s->ctm->c * y1 + s->ctm->e; - float ty1 = s->ctm->b * x1 + s->ctm->f; + float tx0 = s->ctm.c * y0 + s->ctm.e; + float ty0 = s->ctm.b * x0 + s->ctm.f; + float tx1 = s->ctm.c * y1 + s->ctm.e; + float ty1 = s->ctm.b * x1 + s->ctm.f; fz_insert_rasterizer_rect(ctx, s->rast, tx1, ty0, tx0, ty1); return; } @@ -382,21 +382,21 @@ fz_add_vert_rect(fz_context *ctx, sctx *s, float x0, float y0, float x1, float y { if (fz_antidropout_rasterizer(ctx, s->rast)) { - if (s->ctm->b == 0 && s->ctm->c == 0) + if (s->ctm.b == 0 && s->ctm.c == 0) { - float tx0 = s->ctm->a * x0 + s->ctm->e; - float ty0 = s->ctm->d * y0 + s->ctm->f; - float tx1 = s->ctm->a * x1 + s->ctm->e; - float ty1 = s->ctm->d * y1 + s->ctm->f; + float tx0 = s->ctm.a * x0 + s->ctm.e; + float ty0 = s->ctm.d * y0 + s->ctm.f; + float tx1 = s->ctm.a * x1 + s->ctm.e; + float ty1 = s->ctm.d * y1 + s->ctm.f; fz_insert_rasterizer_rect(ctx, s->rast, tx0, ty1, tx1, ty0); return; } - else if (s->ctm->a == 0 && s->ctm->d == 0) + else if (s->ctm.a == 0 && s->ctm.d == 0) { - float tx0 = s->ctm->c * y0 + s->ctm->e; - float ty0 = s->ctm->b * x0 + s->ctm->f; - float tx1 = s->ctm->c * y1 + s->ctm->e; - float ty1 = s->ctm->b * x1 + s->ctm->f; + float tx0 = s->ctm.c * y0 + s->ctm.e; + float ty0 = s->ctm.b * x0 + s->ctm.f; + float tx1 = s->ctm.c * y1 + s->ctm.e; + float ty1 = s->ctm.b * x1 + s->ctm.f; fz_insert_rasterizer_rect(ctx, s->rast, tx0, ty0, tx1, ty1); return; } @@ -1419,7 +1419,7 @@ static const fz_path_walker dash_proc = }; static int -do_flatten_stroke(fz_context *ctx, fz_rasterizer *rast, const fz_path *path, const fz_stroke_state *stroke, const fz_matrix *ctm, float flatness, float linewidth, const fz_irect *scissor, fz_irect *bbox) +do_flatten_stroke(fz_context *ctx, fz_rasterizer *rast, const fz_path *path, const fz_stroke_state *stroke, fz_matrix ctm, float flatness, float linewidth, const fz_irect *scissor, fz_irect *bbox) { struct sctx s; const fz_path_walker *proc = &stroke_proc; @@ -1455,7 +1455,7 @@ do_flatten_stroke(fz_context *ctx, fz_rasterizer *rast, const fz_path *path, con return 1; s.rect = fz_scissor_rasterizer(ctx, rast); - if (fz_try_invert_matrix(&inv, *ctm)) + if (fz_try_invert_matrix(&inv, ctm)) return 1; s.rect = fz_transform_rect(s.rect, inv); s.rect.x0 -= linewidth; @@ -1463,7 +1463,7 @@ do_flatten_stroke(fz_context *ctx, fz_rasterizer *rast, const fz_path *path, con s.rect.y0 -= linewidth; s.rect.y1 += linewidth; - max_expand = fz_matrix_max_expansion(*ctm); + max_expand = fz_matrix_max_expansion(ctm); if (s.dash_total >= 0.01f && s.dash_total * max_expand >= 0.5f) { proc = &dash_proc; @@ -1484,7 +1484,7 @@ do_flatten_stroke(fz_context *ctx, fz_rasterizer *rast, const fz_path *path, con } int -fz_flatten_stroke_path(fz_context *ctx, fz_rasterizer *rast, const fz_path *path, const fz_stroke_state *stroke, const fz_matrix *ctm, float flatness, float linewidth, const fz_irect *scissor, fz_irect *bbox) +fz_flatten_stroke_path(fz_context *ctx, fz_rasterizer *rast, const fz_path *path, const fz_stroke_state *stroke, fz_matrix ctm, float flatness, float linewidth, const fz_irect *scissor, fz_irect *bbox) { if (fz_reset_rasterizer(ctx, rast, *scissor)) { diff --git a/source/fitz/draw-unpack.c b/source/fitz/draw-unpack.c index ad1076bd..77180f5c 100644 --- a/source/fitz/draw-unpack.c +++ b/source/fitz/draw-unpack.c @@ -70,7 +70,7 @@ init_get1_tables(void) } void -fz_unpack_tile(fz_context *ctx, fz_pixmap *dst, unsigned char * FZ_RESTRICT src, int n, int depth, size_t stride, int scale) +fz_unpack_tile(fz_context *ctx, fz_pixmap *dst, unsigned char *src, int n, int depth, size_t stride, int scale) { int pad, x, y, k, skip; int w = dst->w; diff --git a/source/fitz/font-imp.h b/source/fitz/font-imp.h index f121923c..383d7d21 100644 --- a/source/fitz/font-imp.h +++ b/source/fitz/font-imp.h @@ -19,7 +19,7 @@ struct fz_font_s float *t3widths; /* has 256 entries if used */ unsigned short *t3flags; /* has 256 entries if used */ void *t3doc; /* a pdf_document for the callback */ - void (*t3run)(fz_context *ctx, void *doc, void *resources, fz_buffer *contents, struct fz_device_s *dev, const fz_matrix *ctm, void *gstate, int nested_depth, fz_default_colorspaces *default_cs); + void (*t3run)(fz_context *ctx, void *doc, void *resources, fz_buffer *contents, struct fz_device_s *dev, fz_matrix ctm, void *gstate, int nested_depth, fz_default_colorspaces *default_cs); void (*t3freeres)(fz_context *ctx, void *doc, void *resources); fz_rect bbox; /* font bbox is used only for t3 fonts */ diff --git a/source/fitz/font.c b/source/fitz/font.c index d7c58d0d..f24d639b 100644 --- a/source/fitz/font.c +++ b/source/fitz/font.c @@ -778,20 +778,19 @@ pixmap_from_ft_bitmap(fz_context *ctx, int left, int top, FT_Bitmap *bitmap) /* Takes the freetype lock, and returns with it held */ static FT_GlyphSlot -do_ft_render_glyph(fz_context *ctx, fz_font *font, int gid, const fz_matrix *trm, int aa) +do_ft_render_glyph(fz_context *ctx, fz_font *font, int gid, fz_matrix trm, int aa) { FT_Face face = font->ft_face; FT_Matrix m; FT_Vector v; FT_Error fterr; - fz_matrix local_trm = *trm; - float strength = fz_matrix_expansion(*trm) * 0.02f; + float strength = fz_matrix_expansion(trm) * 0.02f; - fz_adjust_ft_glyph_width(ctx, font, gid, &local_trm); + fz_adjust_ft_glyph_width(ctx, font, gid, &trm); if (font->flags.fake_italic) - local_trm = fz_pre_shear(local_trm, SHEAR, 0); + trm = fz_pre_shear(trm, SHEAR, 0); /* Freetype mutilates complex glyphs if they are loaded @@ -801,12 +800,12 @@ do_ft_render_glyph(fz_context *ctx, fz_font *font, int gid, const fz_matrix *trm into FT_Set_Char_Size instead */ - m.xx = local_trm.a * 64; /* should be 65536 */ - m.yx = local_trm.b * 64; - m.xy = local_trm.c * 64; - m.yy = local_trm.d * 64; - v.x = local_trm.e * 64; - v.y = local_trm.f * 64; + m.xx = trm.a * 64; /* should be 65536 */ + m.yx = trm.b * 64; + m.xy = trm.c * 64; + m.yy = trm.d * 64; + v.x = trm.e * 64; + v.y = trm.f * 64; fz_lock(ctx, FZ_LOCK_FREETYPE); fterr = FT_Set_Char_Size(face, 65536, 65536, 72, 72); /* should be 64, 64 */ @@ -817,11 +816,11 @@ do_ft_render_glyph(fz_context *ctx, fz_font *font, int gid, const fz_matrix *trm if (aa == 0) { /* enable grid fitting for non-antialiased rendering */ - float scale = fz_matrix_expansion(local_trm); - m.xx = local_trm.a * 65536 / scale; - m.yx = local_trm.b * 65536 / scale; - m.xy = local_trm.c * 65536 / scale; - m.yy = local_trm.d * 65536 / scale; + float scale = fz_matrix_expansion(trm); + m.xx = trm.a * 65536 / scale; + m.yx = trm.b * 65536 / scale; + m.xy = trm.c * 65536 / scale; + m.yy = trm.d * 65536 / scale; v.x = 0; v.y = 0; @@ -862,7 +861,7 @@ retry_unhinted: } fz_pixmap * -fz_render_ft_glyph_pixmap(fz_context *ctx, fz_font *font, int gid, const fz_matrix *trm, int aa) +fz_render_ft_glyph_pixmap(fz_context *ctx, fz_font *font, int gid, fz_matrix trm, int aa) { FT_GlyphSlot slot = do_ft_render_glyph(ctx, font, gid, trm, aa); fz_pixmap *pixmap = NULL; @@ -891,7 +890,7 @@ fz_render_ft_glyph_pixmap(fz_context *ctx, fz_font *font, int gid, const fz_matr /* The glyph cache lock is always taken when this is called. */ fz_glyph * -fz_render_ft_glyph(fz_context *ctx, fz_font *font, int gid, const fz_matrix *trm, int aa) +fz_render_ft_glyph(fz_context *ctx, fz_font *font, int gid, fz_matrix trm, int aa) { FT_GlyphSlot slot = do_ft_render_glyph(ctx, font, gid, trm, aa); fz_glyph *glyph = NULL; @@ -920,10 +919,10 @@ fz_render_ft_glyph(fz_context *ctx, fz_font *font, int gid, const fz_matrix *trm /* Takes the freetype lock, and returns with it held */ static FT_Glyph -do_render_ft_stroked_glyph(fz_context *ctx, fz_font *font, int gid, const fz_matrix *trm, const fz_matrix *ctm, const fz_stroke_state *state, int aa) +do_render_ft_stroked_glyph(fz_context *ctx, fz_font *font, int gid, fz_matrix trm, fz_matrix ctm, const fz_stroke_state *state, int aa) { FT_Face face = font->ft_face; - float expansion = fz_matrix_expansion(*ctm); + float expansion = fz_matrix_expansion(ctm); int linewidth = state->linewidth * expansion * 64 / 2; FT_Matrix m; FT_Vector v; @@ -932,19 +931,18 @@ do_render_ft_stroked_glyph(fz_context *ctx, fz_font *font, int gid, const fz_mat FT_Glyph glyph; FT_Stroker_LineJoin line_join; FT_Stroker_LineCap line_cap; - fz_matrix local_trm = *trm; - fz_adjust_ft_glyph_width(ctx, font, gid, &local_trm); + fz_adjust_ft_glyph_width(ctx, font, gid, &trm); if (font->flags.fake_italic) - local_trm = fz_pre_shear(local_trm, SHEAR, 0); + trm = fz_pre_shear(trm, SHEAR, 0); - m.xx = local_trm.a * 64; /* should be 65536 */ - m.yx = local_trm.b * 64; - m.xy = local_trm.c * 64; - m.yy = local_trm.d * 64; - v.x = local_trm.e * 64; - v.y = local_trm.f * 64; + m.xx = trm.a * 64; /* should be 65536 */ + m.yx = trm.b * 64; + m.xy = trm.c * 64; + m.yy = trm.d * 64; + v.x = trm.e * 64; + v.y = trm.f * 64; fz_lock(ctx, FZ_LOCK_FREETYPE); fterr = FT_Set_Char_Size(face, 65536, 65536, 72, 72); /* should be 64, 64 */ @@ -1014,7 +1012,7 @@ do_render_ft_stroked_glyph(fz_context *ctx, fz_font *font, int gid, const fz_mat } fz_pixmap * -fz_render_ft_stroked_glyph_pixmap(fz_context *ctx, fz_font *font, int gid, const fz_matrix *trm, const fz_matrix *ctm, const fz_stroke_state *state, int aa) +fz_render_ft_stroked_glyph_pixmap(fz_context *ctx, fz_font *font, int gid, fz_matrix trm, fz_matrix ctm, const fz_stroke_state *state, int aa) { FT_Glyph glyph = do_render_ft_stroked_glyph(ctx, font, gid, trm, ctm, state, aa); FT_BitmapGlyph bitmap = (FT_BitmapGlyph)glyph; @@ -1044,7 +1042,7 @@ fz_render_ft_stroked_glyph_pixmap(fz_context *ctx, fz_font *font, int gid, const } fz_glyph * -fz_render_ft_stroked_glyph(fz_context *ctx, fz_font *font, int gid, const fz_matrix *trm, const fz_matrix *ctm, const fz_stroke_state *state, int aa) +fz_render_ft_stroked_glyph(fz_context *ctx, fz_font *font, int gid, fz_matrix trm, fz_matrix ctm, const fz_stroke_state *state, int aa) { FT_Glyph glyph = do_render_ft_stroked_glyph(ctx, font, gid, trm, ctm, state, aa); FT_BitmapGlyph bitmap = (FT_BitmapGlyph)glyph; @@ -1089,19 +1087,19 @@ fz_bound_ft_glyph(fz_context *ctx, fz_font *font, int gid) const int scale = face->units_per_EM; const float recip = 1.0f / scale; const float strength = 0.02f; - fz_matrix local_trm = fz_identity; + fz_matrix trm = fz_identity; - fz_adjust_ft_glyph_width(ctx, font, gid, &local_trm); + fz_adjust_ft_glyph_width(ctx, font, gid, &trm); if (font->flags.fake_italic) - local_trm = fz_pre_shear(local_trm, SHEAR, 0); + trm = fz_pre_shear(trm, SHEAR, 0); - m.xx = local_trm.a * 65536; - m.yx = local_trm.b * 65536; - m.xy = local_trm.c * 65536; - m.yy = local_trm.d * 65536; - v.x = local_trm.e * 65536; - v.y = local_trm.f * 65536; + m.xx = trm.a * 65536; + m.yx = trm.b * 65536; + m.xy = trm.c * 65536; + m.yy = trm.d * 65536; + v.x = trm.e * 65536; + v.y = trm.f * 65536; fz_lock(ctx, FZ_LOCK_FREETYPE); /* Set the char size to scale=face->units_per_EM to effectively give @@ -1117,8 +1115,8 @@ fz_bound_ft_glyph(fz_context *ctx, fz_font *font, int gid) { fz_warn(ctx, "freetype load glyph (gid %d): %s", gid, ft_error_string(fterr)); fz_unlock(ctx, FZ_LOCK_FREETYPE); - bounds->x0 = bounds->x1 = local_trm.e; - bounds->y0 = bounds->y1 = local_trm.f; + bounds->x0 = bounds->x1 = trm.e; + bounds->y0 = bounds->y1 = trm.f; return bounds; } @@ -1137,8 +1135,8 @@ fz_bound_ft_glyph(fz_context *ctx, fz_font *font, int gid) if (fz_is_empty_rect(*bounds)) { - bounds->x0 = bounds->x1 = local_trm.e; - bounds->y0 = bounds->y1 = local_trm.f; + bounds->x0 = bounds->x1 = trm.e; + bounds->y0 = bounds->y1 = trm.f; } return bounds; @@ -1210,21 +1208,20 @@ static const FT_Outline_Funcs outline_funcs = { }; fz_path * -fz_outline_ft_glyph(fz_context *ctx, fz_font *font, int gid, const fz_matrix *trm) +fz_outline_ft_glyph(fz_context *ctx, fz_font *font, int gid, fz_matrix trm) { struct closure cc; FT_Face face = font->ft_face; int fterr; - fz_matrix local_trm = *trm; const int scale = face->units_per_EM; const float recip = 1.0f / scale; const float strength = 0.02f; - fz_adjust_ft_glyph_width(ctx, font, gid, &local_trm); + fz_adjust_ft_glyph_width(ctx, font, gid, &trm); if (font->flags.fake_italic) - local_trm = fz_pre_shear(local_trm, SHEAR, 0); + trm = fz_pre_shear(trm, SHEAR, 0); fz_lock(ctx, FZ_LOCK_FREETYPE); @@ -1247,7 +1244,7 @@ fz_outline_ft_glyph(fz_context *ctx, fz_font *font, int gid, const fz_matrix *tr { cc.ctx = ctx; cc.path = fz_new_path(ctx); - cc.trm = fz_concat(fz_scale(recip, recip), local_trm); + cc.trm = fz_concat(fz_scale(recip, recip), trm); fz_moveto(ctx, cc.path, cc.trm.e, cc.trm.f); FT_Outline_Decompose(&face->glyph->outline, &outline_funcs, &cc); fz_closepath(ctx, cc.path); @@ -1310,7 +1307,7 @@ fz_bound_t3_glyph(fz_context *ctx, fz_font *font, int gid) dev = fz_new_bbox_device(ctx, &font->bbox_table[gid]); fz_try(ctx) { - fz_run_display_list(ctx, list, dev, &font->t3matrix, &fz_infinite_rect, NULL); + fz_run_display_list(ctx, list, dev, font->t3matrix, &fz_infinite_rect, NULL); fz_close_device(ctx, dev); } fz_always(ctx) @@ -1354,7 +1351,7 @@ fz_prepare_t3_glyph(fz_context *ctx, fz_font *font, int gid, int nested_depth) FZ_DEVFLAG_LINEWIDTH_UNDEFINED; fz_try(ctx) { - font->t3run(ctx, font->t3doc, font->t3resources, contents, dev, &fz_identity, NULL, 0, NULL); + font->t3run(ctx, font->t3doc, font->t3resources, contents, dev, fz_identity, NULL, 0, NULL); fz_close_device(ctx, dev); font->t3flags[gid] = dev->flags; d1_rect = dev->d1_rect; @@ -1394,7 +1391,7 @@ fz_prepare_t3_glyph(fz_context *ctx, fz_font *font, int gid, int nested_depth) } void -fz_run_t3_glyph(fz_context *ctx, fz_font *font, int gid, const fz_matrix *trm, fz_device *dev) +fz_run_t3_glyph(fz_context *ctx, fz_font *font, int gid, fz_matrix trm, fz_device *dev) { fz_display_list *list; fz_matrix ctm; @@ -1403,12 +1400,12 @@ fz_run_t3_glyph(fz_context *ctx, fz_font *font, int gid, const fz_matrix *trm, f if (!list) return; - ctm = fz_concat(font->t3matrix, *trm); - fz_run_display_list(ctx, list, dev, &ctm, &fz_infinite_rect, NULL); + ctm = fz_concat(font->t3matrix, trm); + fz_run_display_list(ctx, list, dev, ctm, &fz_infinite_rect, NULL); } fz_pixmap * -fz_render_t3_glyph_pixmap(fz_context *ctx, fz_font *font, int gid, const fz_matrix *trm, fz_colorspace *model, const fz_irect *scissor, int aa) +fz_render_t3_glyph_pixmap(fz_context *ctx, fz_font *font, int gid, fz_matrix trm, fz_colorspace *model, const fz_irect *scissor, int aa) { fz_display_list *list; fz_rect bounds; @@ -1441,7 +1438,7 @@ fz_render_t3_glyph_pixmap(fz_context *ctx, fz_font *font, int gid, const fz_matr model = NULL; /* Treat as masked */ } - bounds = fz_expand_rect(fz_bound_glyph(ctx, font, gid, *trm), 1); + bounds = fz_expand_rect(fz_bound_glyph(ctx, font, gid, trm), 1); bbox = fz_irect_from_rect(bounds); bbox = fz_intersect_irect(bbox, *scissor); @@ -1452,7 +1449,7 @@ fz_render_t3_glyph_pixmap(fz_context *ctx, fz_font *font, int gid, const fz_matr fz_try(ctx) { fz_clear_pixmap(ctx, glyph); - dev = fz_new_draw_device_type3(ctx, NULL, glyph); + dev = fz_new_draw_device_type3(ctx, fz_identity, glyph); fz_run_t3_glyph(ctx, font, gid, trm, dev); fz_close_device(ctx, dev); } @@ -1488,14 +1485,14 @@ fz_render_t3_glyph_pixmap(fz_context *ctx, fz_font *font, int gid, const fz_matr } fz_glyph * -fz_render_t3_glyph(fz_context *ctx, fz_font *font, int gid, const fz_matrix *trm, fz_colorspace *model, const fz_irect *scissor, int aa) +fz_render_t3_glyph(fz_context *ctx, fz_font *font, int gid, fz_matrix trm, fz_colorspace *model, const fz_irect *scissor, int aa) { fz_pixmap *pixmap = fz_render_t3_glyph_pixmap(ctx, font, gid, trm, model, scissor, aa); return fz_new_glyph_from_pixmap(ctx, pixmap); } void -fz_render_t3_glyph_direct(fz_context *ctx, fz_device *dev, fz_font *font, int gid, const fz_matrix *trm, void *gstate, int nested_depth, fz_default_colorspaces *def_cs) +fz_render_t3_glyph_direct(fz_context *ctx, fz_device *dev, fz_font *font, int gid, fz_matrix trm, void *gstate, int nested_depth, fz_default_colorspaces *def_cs) { fz_matrix ctm; void *contents; @@ -1520,8 +1517,8 @@ fz_render_t3_glyph_direct(fz_context *ctx, fz_device *dev, fz_font *font, int gi fz_warn(ctx, "type3 glyph doesn't specify masked or colored"); } - ctm = fz_concat(font->t3matrix, *trm); - font->t3run(ctx, font->t3doc, font->t3resources, contents, dev, &ctm, gstate, nested_depth, def_cs); + ctm = fz_concat(font->t3matrix, trm); + font->t3run(ctx, font->t3doc, font->t3resources, contents, dev, ctm, gstate, nested_depth, def_cs); } fz_rect @@ -1552,7 +1549,7 @@ fz_bound_glyph(fz_context *ctx, fz_font *font, int gid, fz_matrix trm) } fz_path * -fz_outline_glyph(fz_context *ctx, fz_font *font, int gid, const fz_matrix *ctm) +fz_outline_glyph(fz_context *ctx, fz_font *font, int gid, fz_matrix ctm) { if (!font->ft_face) return NULL; diff --git a/source/fitz/glyph-cache-imp.h b/source/fitz/glyph-cache-imp.h index f6226ae4..df4e2d76 100644 --- a/source/fitz/glyph-cache-imp.h +++ b/source/fitz/glyph-cache-imp.h @@ -1,16 +1,16 @@ #ifndef MUPDF_FITZ_GLYPH_CACHE_IMP_H #define MUPDF_FITZ_GLYPH_CACHE_IMP_H -fz_path *fz_outline_glyph(fz_context *ctx, fz_font *font, int gid, const fz_matrix *ctm); -fz_path *fz_outline_ft_glyph(fz_context *ctx, fz_font *font, int gid, const fz_matrix *trm); -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, int aa); -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, int aa); -fz_glyph *fz_render_ft_stroked_glyph(fz_context *ctx, fz_font *font, int gid, const fz_matrix *trm, const fz_matrix *ctm, const fz_stroke_state *state, int aa); -fz_pixmap *fz_render_ft_stroked_glyph_pixmap(fz_context *ctx, fz_font *font, int gid, const fz_matrix *trm, const fz_matrix *ctm, const fz_stroke_state *state, int aa); +fz_path *fz_outline_glyph(fz_context *ctx, fz_font *font, int gid, fz_matrix ctm); +fz_path *fz_outline_ft_glyph(fz_context *ctx, fz_font *font, int gid, fz_matrix trm); +fz_glyph *fz_render_ft_glyph(fz_context *ctx, fz_font *font, int cid, fz_matrix trm, int aa); +fz_pixmap *fz_render_ft_glyph_pixmap(fz_context *ctx, fz_font *font, int cid, fz_matrix trm, int aa); +fz_glyph *fz_render_t3_glyph(fz_context *ctx, fz_font *font, int cid, fz_matrix trm, fz_colorspace *model, const fz_irect *scissor, int aa); +fz_pixmap *fz_render_t3_glyph_pixmap(fz_context *ctx, fz_font *font, int cid, fz_matrix trm, fz_colorspace *model, const fz_irect *scissor, int aa); +fz_glyph *fz_render_ft_stroked_glyph(fz_context *ctx, fz_font *font, int gid, fz_matrix trm, fz_matrix ctm, const fz_stroke_state *state, int aa); +fz_pixmap *fz_render_ft_stroked_glyph_pixmap(fz_context *ctx, fz_font *font, int gid, fz_matrix trm, fz_matrix ctm, const fz_stroke_state *state, int aa); fz_glyph *fz_render_glyph(fz_context *ctx, fz_font*, int gid, fz_matrix *, fz_colorspace *model, const fz_irect *scissor, int alpha, int aa); -fz_glyph *fz_render_stroked_glyph(fz_context *ctx, fz_font*, int, fz_matrix *, const fz_matrix *, const fz_stroke_state *stroke, const fz_irect *scissor, int aa); -fz_pixmap *fz_render_stroked_glyph_pixmap(fz_context *ctx, fz_font*, int, fz_matrix *, const fz_matrix *, const fz_stroke_state *stroke, const fz_irect *scissor, int aa); +fz_glyph *fz_render_stroked_glyph(fz_context *ctx, fz_font*, int, fz_matrix *, fz_matrix , const fz_stroke_state *stroke, const fz_irect *scissor, int aa); +fz_pixmap *fz_render_stroked_glyph_pixmap(fz_context *ctx, fz_font*, int, fz_matrix *, fz_matrix , const fz_stroke_state *stroke, const fz_irect *scissor, int aa); #endif diff --git a/source/fitz/halftone.c b/source/fitz/halftone.c index c99653f6..05cbcf2e 100644 --- a/source/fitz/halftone.c +++ b/source/fitz/halftone.c @@ -156,11 +156,11 @@ typedef void (threshold_fn)(const unsigned char *ht_line, const unsigned char *p #ifdef ARCH_ARM static void -do_threshold_1(const unsigned char * FZ_RESTRICT ht_line, const unsigned char * FZ_RESTRICT pixmap, unsigned char *FZ_RESTRICT out, int w, int ht_len) +do_threshold_1(const unsigned char * FZ_RESTRICT ht_line, const unsigned char * FZ_RESTRICT pixmap, unsigned char * FZ_RESTRICT out, int w, int ht_len) __attribute__((naked)); static void -do_threshold_1(const unsigned char * FZ_RESTRICT ht_line, const unsigned char * FZ_RESTRICT pixmap, unsigned char *FZ_RESTRICT out, int w, int ht_len) +do_threshold_1(const unsigned char * FZ_RESTRICT ht_line, const unsigned char * FZ_RESTRICT pixmap, unsigned char * FZ_RESTRICT out, int w, int ht_len) { asm volatile( ENTER_ARM @@ -348,11 +348,11 @@ static void do_threshold_1(const unsigned char * FZ_RESTRICT ht_line, const unsi */ #ifdef ARCH_ARM static void -do_threshold_4(const unsigned char * FZ_RESTRICT ht_line, const unsigned char * FZ_RESTRICT pixmap, unsigned char *FZ_RESTRICT out, int w, int ht_len) +do_threshold_4(const unsigned char * FZ_RESTRICT ht_line, const unsigned char * FZ_RESTRICT pixmap, unsigned char * FZ_RESTRICT out, int w, int ht_len) __attribute__((naked)); static void -do_threshold_4(const unsigned char * FZ_RESTRICT ht_line, const unsigned char * FZ_RESTRICT pixmap, unsigned char *FZ_RESTRICT out, int w, int ht_len) +do_threshold_4(const unsigned char * FZ_RESTRICT ht_line, const unsigned char * FZ_RESTRICT pixmap, unsigned char * FZ_RESTRICT out, int w, int ht_len) { asm volatile( ENTER_ARM diff --git a/source/fitz/image.c b/source/fitz/image.c index 8cda9687..7936adf8 100644 --- a/source/fitz/image.c +++ b/source/fitz/image.c @@ -252,7 +252,7 @@ static void fz_adjust_image_subarea(fz_context *ctx, fz_image *image, fz_irect * subarea->y1 = image->h; } -static void fz_compute_image_key(fz_context *ctx, fz_image *image, const fz_matrix *ctm, +static void fz_compute_image_key(fz_context *ctx, fz_image *image, fz_matrix *ctm, fz_image_key *key, const fz_irect *subarea, int l2factor, int *w, int *h, int *dw, int *dh) { key->refs = 1; @@ -1142,10 +1142,10 @@ display_list_image_get_pixmap(fz_context *ctx, fz_image *image_, fz_irect *subar ctm = fz_pre_scale(image->transform, w, h); fz_clear_pixmap(ctx, pix); /* clear to transparent */ - dev = fz_new_draw_device(ctx, &ctm, pix); + dev = fz_new_draw_device(ctx, ctm, pix); fz_try(ctx) { - fz_run_display_list(ctx, image->list, dev, &fz_identity, NULL, NULL); + fz_run_display_list(ctx, image->list, dev, fz_identity, NULL, NULL); fz_close_device(ctx, dev); } fz_always(ctx) diff --git a/source/fitz/list-device.c b/source/fitz/list-device.c index 883d6383..88ad2110 100644 --- a/source/fitz/list-device.c +++ b/source/fitz/list-device.c @@ -661,10 +661,10 @@ fz_unpack_color_params(fz_color_params *color_params, int flags) } static void -fz_list_fill_path(fz_context *ctx, fz_device *dev, const fz_path *path, int even_odd, const fz_matrix *ctm, +fz_list_fill_path(fz_context *ctx, fz_device *dev, const fz_path *path, int even_odd, fz_matrix ctm, fz_colorspace *colorspace, const float *color, float alpha, const fz_color_params *color_params) { - fz_rect rect = fz_bound_path(ctx, path, NULL, *ctm); + fz_rect rect = fz_bound_path(ctx, path, NULL, ctm); fz_append_display_node( ctx, dev, @@ -675,7 +675,7 @@ fz_list_fill_path(fz_context *ctx, fz_device *dev, const fz_path *path, int even color, colorspace, &alpha, /* alpha */ - ctm, + &ctm, NULL, /* stroke_state */ NULL, /* private_data */ 0); /* private_data_len */ @@ -683,9 +683,9 @@ fz_list_fill_path(fz_context *ctx, fz_device *dev, const fz_path *path, int even static void fz_list_stroke_path(fz_context *ctx, fz_device *dev, const fz_path *path, const fz_stroke_state *stroke, - const fz_matrix *ctm, fz_colorspace *colorspace, const float *color, float alpha, const fz_color_params *color_params) + fz_matrix ctm, fz_colorspace *colorspace, const float *color, float alpha, const fz_color_params *color_params) { - fz_rect rect = fz_bound_path(ctx, path, stroke, *ctm); + fz_rect rect = fz_bound_path(ctx, path, stroke, ctm); fz_append_display_node( ctx, dev, @@ -696,16 +696,16 @@ fz_list_stroke_path(fz_context *ctx, fz_device *dev, const fz_path *path, const color, colorspace, &alpha, /* alpha */ - ctm, /* ctm */ + &ctm, /* ctm */ stroke, NULL, /* private_data */ 0); /* private_data_len */ } static void -fz_list_clip_path(fz_context *ctx, fz_device *dev, const fz_path *path, int even_odd, const fz_matrix *ctm, const fz_rect *scissor) +fz_list_clip_path(fz_context *ctx, fz_device *dev, const fz_path *path, int even_odd, fz_matrix ctm, const fz_rect *scissor) { - fz_rect rect = fz_bound_path(ctx, path, NULL, *ctm); + fz_rect rect = fz_bound_path(ctx, path, NULL, ctm); if (scissor) rect = fz_intersect_rect(rect, *scissor); fz_append_display_node( @@ -718,16 +718,16 @@ fz_list_clip_path(fz_context *ctx, fz_device *dev, const fz_path *path, int even NULL, /* color */ NULL, /* colorspace */ NULL, /* alpha */ - ctm, /* ctm */ + &ctm, /* ctm */ NULL, /* stroke */ NULL, /* private_data */ 0); /* private_data_len */ } static void -fz_list_clip_stroke_path(fz_context *ctx, fz_device *dev, const fz_path *path, const fz_stroke_state *stroke, const fz_matrix *ctm, const fz_rect *scissor) +fz_list_clip_stroke_path(fz_context *ctx, fz_device *dev, const fz_path *path, const fz_stroke_state *stroke, fz_matrix ctm, const fz_rect *scissor) { - fz_rect rect = fz_bound_path(ctx, path, stroke, *ctm); + fz_rect rect = fz_bound_path(ctx, path, stroke, ctm); if (scissor) rect = fz_intersect_rect(rect, *scissor); fz_append_display_node( @@ -740,20 +740,20 @@ fz_list_clip_stroke_path(fz_context *ctx, fz_device *dev, const fz_path *path, c NULL, /* color */ NULL, /* colorspace */ NULL, /* alpha */ - ctm, /* ctm */ + &ctm, /* ctm */ stroke, /* stroke */ NULL, /* private_data */ 0); /* private_data_len */ } static void -fz_list_fill_text(fz_context *ctx, fz_device *dev, const fz_text *text, const fz_matrix *ctm, +fz_list_fill_text(fz_context *ctx, fz_device *dev, const fz_text *text, fz_matrix ctm, fz_colorspace *colorspace, const float *color, float alpha, const fz_color_params *color_params) { fz_text *cloned_text = fz_keep_text(ctx, text); fz_try(ctx) { - fz_rect rect = fz_bound_text(ctx, text, NULL, *ctm); + fz_rect rect = fz_bound_text(ctx, text, NULL, ctm); fz_append_display_node( ctx, dev, @@ -764,7 +764,7 @@ fz_list_fill_text(fz_context *ctx, fz_device *dev, const fz_text *text, const fz color, /* color */ colorspace, /* colorspace */ &alpha, /* alpha */ - ctm, /* ctm */ + &ctm, /* ctm */ NULL, /* stroke */ &cloned_text, /* private_data */ sizeof(cloned_text)); /* private_data_len */ @@ -777,13 +777,13 @@ fz_list_fill_text(fz_context *ctx, fz_device *dev, const fz_text *text, const fz } static void -fz_list_stroke_text(fz_context *ctx, fz_device *dev, const fz_text *text, const fz_stroke_state *stroke, const fz_matrix *ctm, +fz_list_stroke_text(fz_context *ctx, fz_device *dev, const fz_text *text, const fz_stroke_state *stroke, fz_matrix ctm, fz_colorspace *colorspace, const float *color, float alpha, const fz_color_params *color_params) { fz_text *cloned_text = fz_keep_text(ctx, text); fz_try(ctx) { - fz_rect rect = fz_bound_text(ctx, text, stroke, *ctm); + fz_rect rect = fz_bound_text(ctx, text, stroke, ctm); fz_append_display_node( ctx, dev, @@ -794,7 +794,7 @@ fz_list_stroke_text(fz_context *ctx, fz_device *dev, const fz_text *text, const color, /* color */ colorspace, /* colorspace */ &alpha, /* alpha */ - ctm, /* ctm */ + &ctm, /* ctm */ stroke, &cloned_text, /* private_data */ sizeof(cloned_text)); /* private_data_len */ @@ -807,12 +807,12 @@ fz_list_stroke_text(fz_context *ctx, fz_device *dev, const fz_text *text, const } static void -fz_list_clip_text(fz_context *ctx, fz_device *dev, const fz_text *text, const fz_matrix *ctm, const fz_rect *scissor) +fz_list_clip_text(fz_context *ctx, fz_device *dev, const fz_text *text, fz_matrix ctm, const fz_rect *scissor) { fz_text *cloned_text = fz_keep_text(ctx, text); fz_try(ctx) { - fz_rect rect = fz_bound_text(ctx, text, NULL, *ctm); + fz_rect rect = fz_bound_text(ctx, text, NULL, ctm); if (scissor) rect = fz_intersect_rect(rect, *scissor); fz_append_display_node( @@ -825,7 +825,7 @@ fz_list_clip_text(fz_context *ctx, fz_device *dev, const fz_text *text, const fz NULL, /* color */ NULL, /* colorspace */ NULL, /* alpha */ - ctm, /* ctm */ + &ctm, /* ctm */ NULL, /* stroke */ &cloned_text, /* private_data */ sizeof(cloned_text)); /* private_data_len */ @@ -838,12 +838,12 @@ fz_list_clip_text(fz_context *ctx, fz_device *dev, const fz_text *text, const fz } static void -fz_list_clip_stroke_text(fz_context *ctx, fz_device *dev, const fz_text *text, const fz_stroke_state *stroke, const fz_matrix *ctm, const fz_rect *scissor) +fz_list_clip_stroke_text(fz_context *ctx, fz_device *dev, const fz_text *text, const fz_stroke_state *stroke, fz_matrix ctm, const fz_rect *scissor) { fz_text *cloned_text = fz_keep_text(ctx, text); fz_try(ctx) { - fz_rect rect = fz_bound_text(ctx, text, stroke, *ctm); + fz_rect rect = fz_bound_text(ctx, text, stroke, ctm); if (scissor) rect = fz_intersect_rect(rect, *scissor); fz_append_display_node( @@ -856,7 +856,7 @@ fz_list_clip_stroke_text(fz_context *ctx, fz_device *dev, const fz_text *text, c NULL, /* color */ NULL, /* colorspace */ NULL, /* alpha */ - ctm, /* ctm */ + &ctm, /* ctm */ stroke, /* stroke */ &cloned_text, /* private_data */ sizeof(cloned_text)); /* private_data_len */ @@ -869,12 +869,12 @@ fz_list_clip_stroke_text(fz_context *ctx, fz_device *dev, const fz_text *text, c } static void -fz_list_ignore_text(fz_context *ctx, fz_device *dev, const fz_text *text, const fz_matrix *ctm) +fz_list_ignore_text(fz_context *ctx, fz_device *dev, const fz_text *text, fz_matrix ctm) { fz_text *cloned_text = fz_keep_text(ctx, text); fz_try(ctx) { - fz_rect rect = fz_bound_text(ctx, text, NULL, *ctm); + fz_rect rect = fz_bound_text(ctx, text, NULL, ctm); fz_append_display_node( ctx, dev, @@ -885,7 +885,7 @@ fz_list_ignore_text(fz_context *ctx, fz_device *dev, const fz_text *text, const NULL, /* color */ NULL, /* colorspace */ NULL, /* alpha */ - ctm, /* ctm */ + &ctm, /* ctm */ NULL, /* stroke */ &cloned_text, /* private_data */ sizeof(cloned_text)); /* private_data_len */ @@ -917,12 +917,12 @@ fz_list_pop_clip(fz_context *ctx, fz_device *dev) } static void -fz_list_fill_shade(fz_context *ctx, fz_device *dev, fz_shade *shade, const fz_matrix *ctm, float alpha, const fz_color_params *color_params) +fz_list_fill_shade(fz_context *ctx, fz_device *dev, fz_shade *shade, fz_matrix ctm, float alpha, const fz_color_params *color_params) { fz_shade *shade2 = fz_keep_shade(ctx, shade); fz_try(ctx) { - fz_rect rect = fz_bound_shade(ctx, shade, *ctm); + fz_rect rect = fz_bound_shade(ctx, shade, ctm); fz_append_display_node( ctx, dev, @@ -933,7 +933,7 @@ fz_list_fill_shade(fz_context *ctx, fz_device *dev, fz_shade *shade, const fz_ma NULL, /* color */ NULL, /* colorspace */ &alpha, /* alpha */ - ctm, + &ctm, /* ctm */ NULL, /* stroke */ &shade2, /* private_data */ sizeof(shade2)); /* private_data_len */ @@ -946,12 +946,12 @@ fz_list_fill_shade(fz_context *ctx, fz_device *dev, fz_shade *shade, const fz_ma } static void -fz_list_fill_image(fz_context *ctx, fz_device *dev, fz_image *image, const fz_matrix *ctm, float alpha, const fz_color_params *color_params) +fz_list_fill_image(fz_context *ctx, fz_device *dev, fz_image *image, fz_matrix ctm, float alpha, const fz_color_params *color_params) { fz_image *image2 = fz_keep_image(ctx, image); fz_try(ctx) { - fz_rect rect = fz_transform_rect(fz_unit_rect, *ctm); + fz_rect rect = fz_transform_rect(fz_unit_rect, ctm); fz_append_display_node( ctx, dev, @@ -962,7 +962,7 @@ fz_list_fill_image(fz_context *ctx, fz_device *dev, fz_image *image, const fz_ma NULL, /* color */ NULL, /* colorspace */ &alpha, /* alpha */ - ctm, + &ctm, /* ctm */ NULL, /* stroke */ &image2, /* private_data */ sizeof(image2)); /* private_data_len */ @@ -975,14 +975,14 @@ fz_list_fill_image(fz_context *ctx, fz_device *dev, fz_image *image, const fz_ma } static void -fz_list_fill_image_mask(fz_context *ctx, fz_device *dev, fz_image *image, const fz_matrix *ctm, +fz_list_fill_image_mask(fz_context *ctx, fz_device *dev, fz_image *image, fz_matrix ctm, fz_colorspace *colorspace, const float *color, float alpha, const fz_color_params *color_params) { fz_image *image2 = fz_keep_image(ctx, image); fz_try(ctx) { - fz_rect rect = fz_transform_rect(fz_unit_rect, *ctm); + fz_rect rect = fz_transform_rect(fz_unit_rect, ctm); fz_append_display_node( ctx, dev, @@ -993,7 +993,7 @@ fz_list_fill_image_mask(fz_context *ctx, fz_device *dev, fz_image *image, const color, colorspace, &alpha, /* alpha */ - ctm, + &ctm, /* ctm */ NULL, /* stroke */ &image2, /* private_data */ sizeof(image2)); /* private_data_len */ @@ -1006,12 +1006,12 @@ fz_list_fill_image_mask(fz_context *ctx, fz_device *dev, fz_image *image, const } static void -fz_list_clip_image_mask(fz_context *ctx, fz_device *dev, fz_image *image, const fz_matrix *ctm, const fz_rect *scissor) +fz_list_clip_image_mask(fz_context *ctx, fz_device *dev, fz_image *image, fz_matrix ctm, const fz_rect *scissor) { fz_image *image2 = fz_keep_image(ctx, image); fz_try(ctx) { - fz_rect rect = fz_transform_rect(fz_unit_rect, *ctm); + fz_rect rect = fz_transform_rect(fz_unit_rect, ctm); if (scissor) rect = fz_intersect_rect(rect, *scissor); fz_append_display_node( @@ -1024,7 +1024,7 @@ fz_list_clip_image_mask(fz_context *ctx, fz_device *dev, fz_image *image, const NULL, /* color */ NULL, /* colorspace */ NULL, /* alpha */ - ctm, + &ctm, /* ctm */ NULL, /* stroke */ &image2, /* private_data */ sizeof(image2)); /* private_data_len */ @@ -1141,7 +1141,7 @@ struct fz_list_tile_data_s }; static int -fz_list_begin_tile(fz_context *ctx, fz_device *dev, const fz_rect *area, const fz_rect *view, float xstep, float ystep, const fz_matrix *ctm, int id) +fz_list_begin_tile(fz_context *ctx, fz_device *dev, const fz_rect *area, const fz_rect *view, float xstep, float ystep, fz_matrix ctm, int id) { fz_list_tile_data tile; @@ -1159,7 +1159,7 @@ fz_list_begin_tile(fz_context *ctx, fz_device *dev, const fz_rect *area, const f NULL, /* color */ NULL, /* colorspace */ NULL, /* alpha */ - ctm, + &ctm, /* ctm */ NULL, /* stroke */ &tile, /* private_data */ sizeof(tile)); /* private_data_len */ @@ -1476,7 +1476,7 @@ int fz_display_list_is_empty(fz_context *ctx, const fz_display_list *list) } void -fz_run_display_list(fz_context *ctx, fz_display_list *list, fz_device *dev, const fz_matrix *top_ctm, const fz_rect *scissor, fz_cookie *cookie) +fz_run_display_list(fz_context *ctx, fz_display_list *list, fz_device *dev, fz_matrix top_ctm, const fz_rect *scissor, fz_cookie *cookie) { fz_display_node *node; fz_display_node *node_end; @@ -1656,7 +1656,7 @@ fz_run_display_list(fz_context *ctx, fz_display_list *list, fz_device *dev, cons continue; } - trans_rect = fz_transform_rect(rect, *top_ctm); + trans_rect = fz_transform_rect(rect, top_ctm); /* cull objects to draw using a quick visibility test */ @@ -1701,7 +1701,7 @@ fz_run_display_list(fz_context *ctx, fz_display_list *list, fz_device *dev, cons } visible: - trans_ctm = fz_concat(ctm, *top_ctm); + trans_ctm = fz_concat(ctm, top_ctm); fz_try(ctx) { @@ -1709,49 +1709,49 @@ visible: { case FZ_CMD_FILL_PATH: fz_unpack_color_params(&color_params, n.flags); - fz_fill_path(ctx, dev, path, n.flags & 1, &trans_ctm, colorspace, color, alpha, &color_params); + fz_fill_path(ctx, dev, path, n.flags & 1, trans_ctm, colorspace, color, alpha, &color_params); break; case FZ_CMD_STROKE_PATH: fz_unpack_color_params(&color_params, n.flags); - fz_stroke_path(ctx, dev, path, stroke, &trans_ctm, colorspace, color, alpha, &color_params); + fz_stroke_path(ctx, dev, path, stroke, trans_ctm, colorspace, color, alpha, &color_params); break; case FZ_CMD_CLIP_PATH: - fz_clip_path(ctx, dev, path, n.flags, &trans_ctm, &trans_rect); + fz_clip_path(ctx, dev, path, n.flags, trans_ctm, &trans_rect); break; case FZ_CMD_CLIP_STROKE_PATH: - fz_clip_stroke_path(ctx, dev, path, stroke, &trans_ctm, &trans_rect); + fz_clip_stroke_path(ctx, dev, path, stroke, trans_ctm, &trans_rect); break; case FZ_CMD_FILL_TEXT: fz_unpack_color_params(&color_params, n.flags); - fz_fill_text(ctx, dev, *(fz_text **)node, &trans_ctm, colorspace, color, alpha, &color_params); + fz_fill_text(ctx, dev, *(fz_text **)node, trans_ctm, colorspace, color, alpha, &color_params); break; case FZ_CMD_STROKE_TEXT: fz_unpack_color_params(&color_params, n.flags); - fz_stroke_text(ctx, dev, *(fz_text **)node, stroke, &trans_ctm, colorspace, color, alpha, &color_params); + fz_stroke_text(ctx, dev, *(fz_text **)node, stroke, trans_ctm, colorspace, color, alpha, &color_params); break; case FZ_CMD_CLIP_TEXT: - fz_clip_text(ctx, dev, *(fz_text **)node, &trans_ctm, &trans_rect); + fz_clip_text(ctx, dev, *(fz_text **)node, trans_ctm, &trans_rect); break; case FZ_CMD_CLIP_STROKE_TEXT: - fz_clip_stroke_text(ctx, dev, *(fz_text **)node, stroke, &trans_ctm, &trans_rect); + fz_clip_stroke_text(ctx, dev, *(fz_text **)node, stroke, trans_ctm, &trans_rect); break; case FZ_CMD_IGNORE_TEXT: - fz_ignore_text(ctx, dev, *(fz_text **)node, &trans_ctm); + fz_ignore_text(ctx, dev, *(fz_text **)node, trans_ctm); break; case FZ_CMD_FILL_SHADE: fz_unpack_color_params(&color_params, n.flags); - fz_fill_shade(ctx, dev, *(fz_shade **)node, &trans_ctm, alpha, &color_params); + fz_fill_shade(ctx, dev, *(fz_shade **)node, trans_ctm, alpha, &color_params); break; case FZ_CMD_FILL_IMAGE: fz_unpack_color_params(&color_params, n.flags); - fz_fill_image(ctx, dev, *(fz_image **)node, &trans_ctm, alpha, &color_params); + fz_fill_image(ctx, dev, *(fz_image **)node, trans_ctm, alpha, &color_params); break; case FZ_CMD_FILL_IMAGE_MASK: fz_unpack_color_params(&color_params, n.flags); - fz_fill_image_mask(ctx, dev, *(fz_image **)node, &trans_ctm, colorspace, color, alpha, &color_params); + fz_fill_image_mask(ctx, dev, *(fz_image **)node, trans_ctm, colorspace, color, alpha, &color_params); break; case FZ_CMD_CLIP_IMAGE_MASK: - fz_clip_image_mask(ctx, dev, *(fz_image **)node, &trans_ctm, &trans_rect); + fz_clip_image_mask(ctx, dev, *(fz_image **)node, trans_ctm, &trans_rect); break; case FZ_CMD_POP_CLIP: fz_pop_clip(ctx, dev); @@ -1776,7 +1776,7 @@ visible: fz_rect tile_rect; tiled++; tile_rect = data->view; - cached = fz_begin_tile_id(ctx, dev, &rect, &tile_rect, data->xstep, data->ystep, &trans_ctm, data->id); + cached = fz_begin_tile_id(ctx, dev, &rect, &tile_rect, data->xstep, data->ystep, trans_ctm, data->id); if (cached) tile_skip_depth = 1; break; diff --git a/source/fitz/paint-glyph.h b/source/fitz/paint-glyph.h index cb0d0340..263e9628 100644 --- a/source/fitz/paint-glyph.h +++ b/source/fitz/paint-glyph.h @@ -35,9 +35,9 @@ FUNCTION_NAME(NAME,N,NAME2,NAME3)(const unsigned char * FZ_RESTRICT colorbv, #ifndef N const int n1, #endif - int span, unsigned char * FZ_RESTRICT dp, const fz_glyph * FZ_RESTRICT glyph, int w, int h, int skip_x, int skip_y + int span, unsigned char * FZ_RESTRICT dp, const fz_glyph *glyph, int w, int h, int skip_x, int skip_y #ifdef EOP - , const fz_overprint * FZ_RESTRICT eop + , const fz_overprint *eop #endif ) { diff --git a/source/fitz/stext-device.c b/source/fitz/stext-device.c index a4a8d002..346d9bc2 100644 --- a/source/fitz/stext-device.c +++ b/source/fitz/stext-device.c @@ -91,13 +91,13 @@ add_text_block_to_page(fz_context *ctx, fz_stext_page *page) } static fz_stext_block * -add_image_block_to_page(fz_context *ctx, fz_stext_page *page, const fz_matrix *ctm, fz_image *image) +add_image_block_to_page(fz_context *ctx, fz_stext_page *page, fz_matrix ctm, fz_image *image) { fz_stext_block *block = add_block_to_page(ctx, page); block->type = FZ_STEXT_BLOCK_IMAGE; - block->u.i.transform = *ctm; + block->u.i.transform = ctm; block->u.i.image = fz_keep_image(ctx, image); - block->bbox = fz_transform_rect(fz_unit_rect, *ctm); + block->bbox = fz_transform_rect(fz_unit_rect, ctm); return block; } @@ -494,61 +494,61 @@ fz_stext_extract(fz_context *ctx, fz_stext_device *dev, fz_text_span *span, fz_m } static void -fz_stext_fill_text(fz_context *ctx, fz_device *dev, const fz_text *text, const fz_matrix *ctm, +fz_stext_fill_text(fz_context *ctx, fz_device *dev, const fz_text *text, fz_matrix ctm, fz_colorspace *colorspace, const float *color, float alpha, const fz_color_params *color_params) { fz_stext_device *tdev = (fz_stext_device*)dev; fz_text_span *span; tdev->new_obj = 1; for (span = text->head; span; span = span->next) - fz_stext_extract(ctx, tdev, span, *ctm); + fz_stext_extract(ctx, tdev, span, ctm); } static void -fz_stext_stroke_text(fz_context *ctx, fz_device *dev, const fz_text *text, const fz_stroke_state *stroke, const fz_matrix *ctm, +fz_stext_stroke_text(fz_context *ctx, fz_device *dev, const fz_text *text, const fz_stroke_state *stroke, fz_matrix ctm, fz_colorspace *colorspace, const float *color, float alpha, const fz_color_params *color_params) { fz_stext_device *tdev = (fz_stext_device*)dev; fz_text_span *span; tdev->new_obj = 1; for (span = text->head; span; span = span->next) - fz_stext_extract(ctx, tdev, span, *ctm); + fz_stext_extract(ctx, tdev, span, ctm); } static void -fz_stext_clip_text(fz_context *ctx, fz_device *dev, const fz_text *text, const fz_matrix *ctm, const fz_rect *scissor) +fz_stext_clip_text(fz_context *ctx, fz_device *dev, const fz_text *text, fz_matrix ctm, const fz_rect *scissor) { fz_stext_device *tdev = (fz_stext_device*)dev; fz_text_span *span; tdev->new_obj = 1; for (span = text->head; span; span = span->next) - fz_stext_extract(ctx, tdev, span, *ctm); + fz_stext_extract(ctx, tdev, span, ctm); } static void -fz_stext_clip_stroke_text(fz_context *ctx, fz_device *dev, const fz_text *text, const fz_stroke_state *stroke, const fz_matrix *ctm, const fz_rect *scissor) +fz_stext_clip_stroke_text(fz_context *ctx, fz_device *dev, const fz_text *text, const fz_stroke_state *stroke, fz_matrix ctm, const fz_rect *scissor) { fz_stext_device *tdev = (fz_stext_device*)dev; fz_text_span *span; tdev->new_obj = 1; for (span = text->head; span; span = span->next) - fz_stext_extract(ctx, tdev, span, *ctm); + fz_stext_extract(ctx, tdev, span, ctm); } static void -fz_stext_ignore_text(fz_context *ctx, fz_device *dev, const fz_text *text, const fz_matrix *ctm) +fz_stext_ignore_text(fz_context *ctx, fz_device *dev, const fz_text *text, fz_matrix ctm) { fz_stext_device *tdev = (fz_stext_device*)dev; fz_text_span *span; tdev->new_obj = 1; for (span = text->head; span; span = span->next) - fz_stext_extract(ctx, tdev, span, *ctm); + fz_stext_extract(ctx, tdev, span, ctm); } /* Images and shadings */ static void -fz_stext_fill_image(fz_context *ctx, fz_device *dev, fz_image *img, const fz_matrix *ctm, float alpha, const fz_color_params *color_params) +fz_stext_fill_image(fz_context *ctx, fz_device *dev, fz_image *img, fz_matrix ctm, float alpha, const fz_color_params *color_params) { fz_stext_device *tdev = (fz_stext_device*)dev; @@ -560,7 +560,7 @@ fz_stext_fill_image(fz_context *ctx, fz_device *dev, fz_image *img, const fz_mat } static void -fz_stext_fill_image_mask(fz_context *ctx, fz_device *dev, fz_image *img, const fz_matrix *ctm, +fz_stext_fill_image_mask(fz_context *ctx, fz_device *dev, fz_image *img, fz_matrix ctm, fz_colorspace *cspace, const float *color, float alpha, const fz_color_params *color_params) { fz_stext_fill_image(ctx, dev, img, ctm, alpha, color_params); @@ -586,7 +586,7 @@ fz_new_image_from_shade(fz_context *ctx, fz_shade *shade, fz_matrix *in_out_ctm, fz_fill_pixmap_with_color(ctx, pix, shade->colorspace, shade->background, color_params); else fz_clear_pixmap(ctx, pix); - fz_paint_shade(ctx, shade, NULL, &ctm, pix, color_params, &bbox, NULL); + fz_paint_shade(ctx, shade, NULL, ctm, pix, color_params, &bbox, NULL); img = fz_new_image_from_pixmap(ctx, pix, NULL); } fz_always(ctx) @@ -604,13 +604,13 @@ fz_new_image_from_shade(fz_context *ctx, fz_shade *shade, fz_matrix *in_out_ctm, } static void -fz_stext_fill_shade(fz_context *ctx, fz_device *dev, fz_shade *shade, const fz_matrix *ctm, float alpha, const fz_color_params *color_params) +fz_stext_fill_shade(fz_context *ctx, fz_device *dev, fz_shade *shade, fz_matrix ctm, float alpha, const fz_color_params *color_params) { - fz_matrix local_ctm = *ctm; + fz_matrix local_ctm = ctm; const fz_rect *scissor = fz_device_current_scissor(ctx, dev); fz_image *image = fz_new_image_from_shade(ctx, shade, &local_ctm, color_params, scissor); fz_try(ctx) - fz_stext_fill_image(ctx, dev, image, &local_ctm, alpha, color_params); + fz_stext_fill_image(ctx, dev, image, local_ctm, alpha, color_params); fz_always(ctx) fz_drop_image(ctx, image); fz_catch(ctx) diff --git a/source/fitz/svg-device.c b/source/fitz/svg-device.c index 28f3a4d6..ec3441a3 100644 --- a/source/fitz/svg-device.c +++ b/source/fitz/svg-device.c @@ -156,24 +156,24 @@ svg_dev_path(fz_context *ctx, svg_device *sdev, const fz_path *path) } static void -svg_dev_ctm(fz_context *ctx, svg_device *sdev, const fz_matrix *ctm) +svg_dev_ctm(fz_context *ctx, svg_device *sdev, fz_matrix ctm) { fz_output *out = sdev->out; - if (ctm->a != 1.0f || ctm->b != 0 || ctm->c != 0 || ctm->d != 1.0f || ctm->e != 0 || ctm->f != 0) + if (ctm.a != 1.0f || ctm.b != 0 || ctm.c != 0 || ctm.d != 1.0f || ctm.e != 0 || ctm.f != 0) { fz_write_printf(ctx, out, " transform=\"matrix(%g,%g,%g,%g,%g,%g)\"", - ctm->a, ctm->b, ctm->c, ctm->d, ctm->e, ctm->f); + ctm.a, ctm.b, ctm.c, ctm.d, ctm.e, ctm.f); } } static void -svg_dev_stroke_state(fz_context *ctx, svg_device *sdev, const fz_stroke_state *stroke_state, const fz_matrix *ctm) +svg_dev_stroke_state(fz_context *ctx, svg_device *sdev, const fz_stroke_state *stroke_state, fz_matrix ctm) { fz_output *out = sdev->out; float exp; - exp = fz_matrix_expansion(*ctm); + exp = fz_matrix_expansion(ctm); if (exp == 0) exp = 1; exp = stroke_state->linewidth/exp; @@ -313,7 +313,7 @@ svg_cluster_advance(fz_context *ctx, const fz_text_span *span, int i, int end) } static void -svg_dev_text_span(fz_context *ctx, svg_device *sdev, const fz_matrix *ctm, const fz_text_span *span) +svg_dev_text_span(fz_context *ctx, svg_device *sdev, fz_matrix ctm, const fz_text_span *span) { fz_output *out = sdev->out; char font_family[100]; @@ -340,7 +340,7 @@ svg_dev_text_span(fz_context *ctx, svg_device *sdev, const fz_matrix *ctm, const final_tm.e = 0; final_tm.f = 0; inv_tm = fz_invert_matrix(final_tm); - final_tm = fz_concat(final_tm, *ctm); + final_tm = fz_concat(final_tm, ctm); tm.e = span->items[0].x; tm.f = span->items[0].y; @@ -419,7 +419,7 @@ svg_dev_text_span(fz_context *ctx, svg_device *sdev, const fz_matrix *ctm, const } static font * -svg_dev_text_span_as_paths_defs(fz_context *ctx, fz_device *dev, fz_text_span *span, const fz_matrix *ctm) +svg_dev_text_span_as_paths_defs(fz_context *ctx, fz_device *dev, fz_text_span *span, fz_matrix ctm) { svg_device *sdev = (svg_device*)dev; fz_output *out = sdev->out; @@ -473,7 +473,7 @@ svg_dev_text_span_as_paths_defs(fz_context *ctx, fz_device *dev, fz_text_span *s /* Need to send this one */ fz_rect rect; fz_path *path; - path = fz_outline_glyph(ctx, span->font, gid, &fz_identity); + path = fz_outline_glyph(ctx, span->font, gid, fz_identity); if (path) { rect = fz_bound_path(ctx, path, NULL, fz_identity); @@ -494,7 +494,7 @@ svg_dev_text_span_as_paths_defs(fz_context *ctx, fz_device *dev, fz_text_span *s shift.f = -rect.y0; out = start_def(ctx, sdev); fz_write_printf(ctx, out, "<symbol id=\"font_%x_%x\">\n", fnt->id, gid); - fz_run_t3_glyph(ctx, span->font, gid, &shift, dev); + fz_run_t3_glyph(ctx, span->font, gid, shift, dev); } fz_write_printf(ctx, out, "</symbol>\n"); out = end_def(ctx, sdev); @@ -506,40 +506,38 @@ svg_dev_text_span_as_paths_defs(fz_context *ctx, fz_device *dev, fz_text_span *s } static void -svg_dev_text_span_as_paths_fill(fz_context *ctx, fz_device *dev, const fz_text_span *span, const fz_matrix *ctm, +svg_dev_text_span_as_paths_fill(fz_context *ctx, fz_device *dev, const fz_text_span *span, fz_matrix ctm, fz_colorspace *colorspace, const float *color, float alpha, font *fnt, const fz_color_params *color_params) { svg_device *sdev = (svg_device*)dev; fz_output *out = sdev->out; - - fz_matrix local_trm, local_trm2; - int i; fz_matrix shift = { 1, 0, 0, 1, 0, 0}; + fz_matrix trm, mtx; + int i; /* Rely on the fact that trm.{e,f} == 0 */ - local_trm.a = span->trm.a; - local_trm.b = span->trm.b; - local_trm.c = span->trm.c; - local_trm.d = span->trm.d; - local_trm.e = 0; - local_trm.f = 0; + trm.a = span->trm.a; + trm.b = span->trm.b; + trm.c = span->trm.c; + trm.d = span->trm.d; + trm.e = 0; + trm.f = 0; for (i=0; i < span->len; i++) { fz_text_item *it = &span->items[i]; int gid = it->gid; - if (gid < 0) continue; shift.e = fnt->sentlist[gid].x_off; shift.f = fnt->sentlist[gid].y_off; - local_trm.e = it->x; - local_trm.f = it->y; - local_trm2 = fz_concat(local_trm, *ctm); - local_trm2 = fz_concat(shift, local_trm2); + trm.e = it->x; + trm.f = it->y; + mtx = fz_concat(shift, fz_concat(trm, ctm)); + fz_write_printf(ctx, out, "<use xlink:href=\"#font_%x_%x\"", fnt->id, gid); - svg_dev_ctm(ctx, sdev, &local_trm2); + svg_dev_ctm(ctx, sdev, mtx); svg_dev_fill_color(ctx, sdev, colorspace, color, alpha, color_params); fz_write_printf(ctx, out, "/>\n"); } @@ -547,40 +545,39 @@ svg_dev_text_span_as_paths_fill(fz_context *ctx, fz_device *dev, const fz_text_s static void svg_dev_text_span_as_paths_stroke(fz_context *ctx, fz_device *dev, const fz_text_span *span, - const fz_stroke_state *stroke, const fz_matrix *ctm, + const fz_stroke_state *stroke, fz_matrix ctm, fz_colorspace *colorspace, const float *color, float alpha, font *fnt, const fz_color_params *color_params) { svg_device *sdev = (svg_device*)dev; fz_output *out = sdev->out; - fz_matrix local_trm, local_trm2; - int i; fz_matrix shift = { 1, 0, 0, 1, 0, 0}; + fz_matrix trm, mtx; + int i; /* Rely on the fact that trm.{e,f} == 0 */ - local_trm.a = span->trm.a; - local_trm.b = span->trm.b; - local_trm.c = span->trm.c; - local_trm.d = span->trm.d; - local_trm.e = 0; - local_trm.f = 0; + trm.a = span->trm.a; + trm.b = span->trm.b; + trm.c = span->trm.c; + trm.d = span->trm.d; + trm.e = 0; + trm.f = 0; for (i=0; i < span->len; i++) { fz_text_item *it = &span->items[i]; int gid = it->gid; - if (gid < 0) continue; shift.e = fnt->sentlist[gid].x_off; shift.f = fnt->sentlist[gid].y_off; - local_trm.e = it->x; - local_trm.f = it->y; - local_trm2 = fz_concat(local_trm, *ctm); - local_trm2 = fz_concat(shift, local_trm2); + trm.e = it->x; + trm.f = it->y; + mtx = fz_concat(shift, fz_concat(trm, ctm)); + fz_write_printf(ctx, out, "<use xlink:href=\"#font_%x_%x\"", fnt->id, gid); - svg_dev_stroke_state(ctx, sdev, stroke, &local_trm2); - svg_dev_ctm(ctx, sdev, &local_trm2); + svg_dev_stroke_state(ctx, sdev, stroke, mtx); + svg_dev_ctm(ctx, sdev, mtx); svg_dev_stroke_color(ctx, sdev, colorspace, color, alpha, color_params); fz_write_printf(ctx, out, "/>\n"); } @@ -589,7 +586,7 @@ svg_dev_text_span_as_paths_stroke(fz_context *ctx, fz_device *dev, const fz_text /* Entry points */ static void -svg_dev_fill_path(fz_context *ctx, fz_device *dev, const fz_path *path, int even_odd, const fz_matrix *ctm, +svg_dev_fill_path(fz_context *ctx, fz_device *dev, const fz_path *path, int even_odd, fz_matrix ctm, fz_colorspace *colorspace, const float *color, float alpha, const fz_color_params *color_params) { svg_device *sdev = (svg_device*)dev; @@ -605,7 +602,7 @@ svg_dev_fill_path(fz_context *ctx, fz_device *dev, const fz_path *path, int even } static void -svg_dev_stroke_path(fz_context *ctx, fz_device *dev, const fz_path *path, const fz_stroke_state *stroke, const fz_matrix *ctm, +svg_dev_stroke_path(fz_context *ctx, fz_device *dev, const fz_path *path, const fz_stroke_state *stroke, fz_matrix ctm, fz_colorspace *colorspace, const float *color, float alpha, const fz_color_params *color_params) { svg_device *sdev = (svg_device*)dev; @@ -613,14 +610,14 @@ svg_dev_stroke_path(fz_context *ctx, fz_device *dev, const fz_path *path, const fz_write_printf(ctx, out, "<path"); svg_dev_ctm(ctx, sdev, ctm); - svg_dev_stroke_state(ctx, sdev, stroke, &fz_identity); + svg_dev_stroke_state(ctx, sdev, stroke, fz_identity); svg_dev_stroke_color(ctx, sdev, colorspace, color, alpha, color_params); svg_dev_path(ctx, sdev, path); fz_write_printf(ctx, out, "/>\n"); } static void -svg_dev_clip_path(fz_context *ctx, fz_device *dev, const fz_path *path, int even_odd, const fz_matrix *ctm, const fz_rect *scissor) +svg_dev_clip_path(fz_context *ctx, fz_device *dev, const fz_path *path, int even_odd, fz_matrix ctm, const fz_rect *scissor) { svg_device *sdev = (svg_device*)dev; fz_output *out; @@ -640,7 +637,7 @@ svg_dev_clip_path(fz_context *ctx, fz_device *dev, const fz_path *path, int even } static void -svg_dev_clip_stroke_path(fz_context *ctx, fz_device *dev, const fz_path *path, const fz_stroke_state *stroke, const fz_matrix *ctm, const fz_rect *scissor) +svg_dev_clip_stroke_path(fz_context *ctx, fz_device *dev, const fz_path *path, const fz_stroke_state *stroke, fz_matrix ctm, const fz_rect *scissor) { svg_device *sdev = (svg_device*)dev; @@ -649,14 +646,14 @@ svg_dev_clip_stroke_path(fz_context *ctx, fz_device *dev, const fz_path *path, c int num = sdev->id++; float white[3] = { 1, 1, 1 }; - bounds = fz_bound_path(ctx, path, stroke, *ctm); + bounds = fz_bound_path(ctx, path, stroke, ctm); out = start_def(ctx, sdev); fz_write_printf(ctx, out, "<mask id=\"ma%d\" x=\"%g\" y=\"%g\" width=\"%g\" height=\"%g\" maskUnits=\"userSpaceOnUse\" maskContentUnits=\"userSpaceOnUse\">\n", num, bounds.x0, bounds.y0, bounds.x1 - bounds.x0, bounds.y1 - bounds.y0); fz_write_printf(ctx, out, "<path"); svg_dev_ctm(ctx, sdev, ctm); - svg_dev_stroke_state(ctx, sdev, stroke, &fz_identity); + svg_dev_stroke_state(ctx, sdev, stroke, fz_identity); svg_dev_stroke_color(ctx, sdev, fz_device_rgb(ctx), white, 1, NULL); svg_dev_path(ctx, sdev, path); fz_write_printf(ctx, out, "/>\n</mask>\n"); @@ -665,7 +662,7 @@ svg_dev_clip_stroke_path(fz_context *ctx, fz_device *dev, const fz_path *path, c } static void -svg_dev_fill_text(fz_context *ctx, fz_device *dev, const fz_text *text, const fz_matrix *ctm, +svg_dev_fill_text(fz_context *ctx, fz_device *dev, const fz_text *text, fz_matrix ctm, fz_colorspace *colorspace, const float *color, float alpha, const fz_color_params *color_params) { svg_device *sdev = (svg_device*)dev; @@ -693,7 +690,7 @@ svg_dev_fill_text(fz_context *ctx, fz_device *dev, const fz_text *text, const fz } static void -svg_dev_stroke_text(fz_context *ctx, fz_device *dev, const fz_text *text, const fz_stroke_state *stroke, const fz_matrix *ctm, +svg_dev_stroke_text(fz_context *ctx, fz_device *dev, const fz_text *text, const fz_stroke_state *stroke, fz_matrix ctm, fz_colorspace *colorspace, const float *color, float alpha, const fz_color_params *color_params) { svg_device *sdev = (svg_device*)dev; @@ -721,7 +718,7 @@ svg_dev_stroke_text(fz_context *ctx, fz_device *dev, const fz_text *text, const } static void -svg_dev_clip_text(fz_context *ctx, fz_device *dev, const fz_text *text, const fz_matrix *ctm, const fz_rect *scissor) +svg_dev_clip_text(fz_context *ctx, fz_device *dev, const fz_text *text, fz_matrix ctm, const fz_rect *scissor) { svg_device *sdev = (svg_device*)dev; fz_output *out = sdev->out; @@ -732,7 +729,7 @@ svg_dev_clip_text(fz_context *ctx, fz_device *dev, const fz_text *text, const fz font *fnt; fz_text_span *span; - bounds = fz_bound_text(ctx, text, NULL, *ctm); + bounds = fz_bound_text(ctx, text, NULL, ctm); out = start_def(ctx, sdev); fz_write_printf(ctx, out, "<mask id=\"ma%d\" x=\"%g\" y=\"%g\" width=\"%g\" height=\"%g\"", @@ -761,7 +758,7 @@ svg_dev_clip_text(fz_context *ctx, fz_device *dev, const fz_text *text, const fz } static void -svg_dev_clip_stroke_text(fz_context *ctx, fz_device *dev, const fz_text *text, const fz_stroke_state *stroke, const fz_matrix *ctm, const fz_rect *scissor) +svg_dev_clip_stroke_text(fz_context *ctx, fz_device *dev, const fz_text *text, const fz_stroke_state *stroke, fz_matrix ctm, const fz_rect *scissor) { svg_device *sdev = (svg_device*)dev; @@ -772,7 +769,7 @@ svg_dev_clip_stroke_text(fz_context *ctx, fz_device *dev, const fz_text *text, c font *fnt; fz_text_span *span; - bounds = fz_bound_text(ctx, text, NULL, *ctm); + bounds = fz_bound_text(ctx, text, NULL, ctm); out = start_def(ctx, sdev); fz_write_printf(ctx, out, "<mask id=\"ma%d\" x=\"%g\" y=\"%g\" width=\"%g\" height=\"%g\"", @@ -783,7 +780,7 @@ svg_dev_clip_stroke_text(fz_context *ctx, fz_device *dev, const fz_text *text, c for (span = text->head; span; span = span->next) { fz_write_printf(ctx, out, "<text"); - svg_dev_stroke_state(ctx, sdev, stroke, &fz_identity); + svg_dev_stroke_state(ctx, sdev, stroke, fz_identity); svg_dev_stroke_color(ctx, sdev, fz_device_rgb(ctx), white, 1, NULL); svg_dev_text_span(ctx, sdev, ctm, span); } @@ -802,7 +799,7 @@ svg_dev_clip_stroke_text(fz_context *ctx, fz_device *dev, const fz_text *text, c } static void -svg_dev_ignore_text(fz_context *ctx, fz_device *dev, const fz_text *text, const fz_matrix *ctm) +svg_dev_ignore_text(fz_context *ctx, fz_device *dev, const fz_text *text, fz_matrix ctm) { svg_device *sdev = (svg_device*)dev; fz_output *out = sdev->out; @@ -879,29 +876,29 @@ svg_send_image(fz_context *ctx, svg_device *sdev, fz_image *img, const fz_color_ } static void -svg_dev_fill_image(fz_context *ctx, fz_device *dev, fz_image *image, const fz_matrix *ctm, float alpha, const fz_color_params *color_params) +svg_dev_fill_image(fz_context *ctx, fz_device *dev, fz_image *image, fz_matrix ctm, float alpha, const fz_color_params *color_params) { svg_device *sdev = (svg_device*)dev; fz_output *out = sdev->out; - fz_matrix local_ctm = *ctm; + fz_matrix local_ctm = ctm; fz_matrix scale = { 0 }; scale.a = 1.0f / image->w; scale.d = 1.0f / image->h; - local_ctm = fz_concat(scale, *ctm); + local_ctm = fz_concat(scale, ctm); fz_write_printf(ctx, out, "<g"); if (alpha != 1.0f) fz_write_printf(ctx, out, " opacity=\"%g\"", alpha); - svg_dev_ctm(ctx, sdev, &local_ctm); + svg_dev_ctm(ctx, sdev, local_ctm); fz_write_printf(ctx, out, ">\n"); svg_send_image(ctx, sdev, image, color_params); fz_write_printf(ctx, out, "</g>\n"); } static void -svg_dev_fill_shade(fz_context *ctx, fz_device *dev, fz_shade *shade, const fz_matrix *ctm, float alpha, const fz_color_params *color_params) +svg_dev_fill_shade(fz_context *ctx, fz_device *dev, fz_shade *shade, fz_matrix ctm, float alpha, const fz_color_params *color_params) { svg_device *sdev = (svg_device*)dev; fz_output *out = sdev->out; @@ -914,7 +911,7 @@ svg_dev_fill_shade(fz_context *ctx, fz_device *dev, fz_shade *shade, const fz_ma if (dev->container_len == 0) return; - bbox = fz_round_rect(fz_intersect_rect(fz_bound_shade(ctx, shade, *ctm), dev->container[dev->container_len-1].scissor)); + bbox = fz_round_rect(fz_intersect_rect(fz_bound_shade(ctx, shade, ctm), dev->container[dev->container_len-1].scissor)); if (fz_is_empty_irect(bbox)) return; pix = fz_new_pixmap_with_bbox(ctx, fz_device_rgb(ctx), bbox, NULL, 1); @@ -944,19 +941,19 @@ svg_dev_fill_shade(fz_context *ctx, fz_device *dev, fz_shade *shade, const fz_ma } static void -svg_dev_fill_image_mask(fz_context *ctx, fz_device *dev, fz_image *image, const fz_matrix *ctm, +svg_dev_fill_image_mask(fz_context *ctx, fz_device *dev, fz_image *image, fz_matrix ctm, fz_colorspace *colorspace, const float *color, float alpha, const fz_color_params *color_params) { svg_device *sdev = (svg_device*)dev; fz_output *out; - fz_matrix local_ctm = *ctm; + fz_matrix local_ctm = ctm; fz_matrix scale = { 0 }; int mask = sdev->id++; scale.a = 1.0f / image->w; scale.d = 1.0f / image->h; - local_ctm = fz_concat(scale, *ctm); + local_ctm = fz_concat(scale, ctm); out = start_def(ctx, sdev); fz_write_printf(ctx, out, "<mask id=\"ma%d\">\n", mask); svg_send_image(ctx, sdev, image, color_params); @@ -964,26 +961,26 @@ svg_dev_fill_image_mask(fz_context *ctx, fz_device *dev, fz_image *image, const out = end_def(ctx, sdev); fz_write_printf(ctx, out, "<rect x=\"0\" y=\"0\" width=\"%d\" height=\"%d\"", image->w, image->h); svg_dev_fill_color(ctx, sdev, colorspace, color, alpha, color_params); - svg_dev_ctm(ctx, sdev, &local_ctm); + svg_dev_ctm(ctx, sdev, local_ctm); fz_write_printf(ctx, out, " mask=\"url(#ma%d)\"/>\n", mask); } static void -svg_dev_clip_image_mask(fz_context *ctx, fz_device *dev, fz_image *image, const fz_matrix *ctm, const fz_rect *scissor) +svg_dev_clip_image_mask(fz_context *ctx, fz_device *dev, fz_image *image, fz_matrix ctm, const fz_rect *scissor) { svg_device *sdev = (svg_device*)dev; fz_output *out; - fz_matrix local_ctm = *ctm; + fz_matrix local_ctm = ctm; fz_matrix scale = { 0 }; int mask = sdev->id++; scale.a = 1.0f / image->w; scale.d = 1.0f / image->h; - local_ctm = fz_concat(scale, *ctm); + local_ctm = fz_concat(scale, ctm); out = start_def(ctx, sdev); fz_write_printf(ctx, out, "<mask id=\"ma%d\">\n<g", mask); - svg_dev_ctm(ctx, sdev, &local_ctm); + svg_dev_ctm(ctx, sdev, local_ctm); fz_write_printf(ctx, out, ">\n"); svg_send_image(ctx, sdev, image, NULL/* FIXME */); fz_write_printf(ctx, out, "</g>\n</mask>\n"); @@ -1053,7 +1050,7 @@ svg_dev_end_group(fz_context *ctx, fz_device *dev) } static int -svg_dev_begin_tile(fz_context *ctx, fz_device *dev, const fz_rect *area, const fz_rect *view, float xstep, float ystep, const fz_matrix *ctm, int id) +svg_dev_begin_tile(fz_context *ctx, fz_device *dev, const fz_rect *area, const fz_rect *view, float xstep, float ystep, fz_matrix ctm, int id) { svg_device *sdev = (svg_device*)dev; fz_output *out; @@ -1071,7 +1068,7 @@ svg_dev_begin_tile(fz_context *ctx, fz_device *dev, const fz_rect *area, const f t = &sdev->tiles[num]; t->area = *area; t->view = *view; - t->ctm = *ctm; + t->ctm = ctm; t->pattern = sdev->id++; t->step.x = xstep; t->step.y = ystep; @@ -1140,7 +1137,7 @@ svg_dev_end_tile(fz_context *ctx, fz_device *dev) * undo the current one to allow for this */ inverse = fz_invert_matrix(t->ctm); fz_write_printf(ctx, out, "<g"); - svg_dev_ctm(ctx, sdev, &inverse); + svg_dev_ctm(ctx, sdev, inverse); fz_write_printf(ctx, out, ">\n"); w = t->view.x1 - t->view.x0; @@ -1158,7 +1155,7 @@ svg_dev_end_tile(fz_context *ctx, fz_device *dev) /* Finally, fill a rectangle with the pattern. */ fz_write_printf(ctx, out, "<rect"); - svg_dev_ctm(ctx, sdev, &t->ctm); + svg_dev_ctm(ctx, sdev, t->ctm); fz_write_printf(ctx, out, " fill=\"url(#pa%d)\" x=\"%g\" y=\"%g\" width=\"%g\" height=\"%g\"/>\n", t->pattern, t->area.x0, t->area.y0, t->area.x1 - t->area.x0, t->area.y1 - t->area.y0); } diff --git a/source/fitz/test-device.c b/source/fitz/test-device.c index 6eb1709e..ce8923a4 100644 --- a/source/fitz/test-device.c +++ b/source/fitz/test-device.c @@ -61,7 +61,7 @@ fz_test_color(fz_context *ctx, fz_test_device *t, fz_colorspace *colorspace, con } static void -fz_test_fill_path(fz_context *ctx, fz_device *dev_, const fz_path *path, int even_odd, const fz_matrix *ctm, +fz_test_fill_path(fz_context *ctx, fz_device *dev_, const fz_path *path, int even_odd, fz_matrix ctm, fz_colorspace *colorspace, const float *color, float alpha, const fz_color_params *color_params) { fz_test_device *dev = (fz_test_device*)dev_; @@ -78,7 +78,7 @@ fz_test_fill_path(fz_context *ctx, fz_device *dev_, const fz_path *path, int eve static void fz_test_stroke_path(fz_context *ctx, fz_device *dev_, const fz_path *path, const fz_stroke_state *stroke, - const fz_matrix *ctm, fz_colorspace *colorspace, const float *color, float alpha, const fz_color_params *color_params) + fz_matrix ctm, fz_colorspace *colorspace, const float *color, float alpha, const fz_color_params *color_params) { fz_test_device *dev = (fz_test_device*)dev_; @@ -93,7 +93,7 @@ fz_test_stroke_path(fz_context *ctx, fz_device *dev_, const fz_path *path, const } static void -fz_test_fill_text(fz_context *ctx, fz_device *dev_, const fz_text *text, const fz_matrix *ctm, +fz_test_fill_text(fz_context *ctx, fz_device *dev_, const fz_text *text, fz_matrix ctm, fz_colorspace *colorspace, const float *color, float alpha, const fz_color_params *color_params) { fz_test_device *dev = (fz_test_device*)dev_; @@ -110,7 +110,7 @@ fz_test_fill_text(fz_context *ctx, fz_device *dev_, const fz_text *text, const f static void fz_test_stroke_text(fz_context *ctx, fz_device *dev_, const fz_text *text, const fz_stroke_state *stroke, - const fz_matrix *ctm, fz_colorspace *colorspace, const float *color, float alpha, const fz_color_params *color_params) + fz_matrix ctm, fz_colorspace *colorspace, const float *color, float alpha, const fz_color_params *color_params) { fz_test_device *dev = (fz_test_device*)dev_; @@ -142,7 +142,7 @@ prepare_vertex(fz_context *ctx, void *arg_, fz_vertex *v, const float *color) } static void -fz_test_fill_shade(fz_context *ctx, fz_device *dev_, fz_shade *shade, const fz_matrix *ctm, float alpha, const fz_color_params *color_params) +fz_test_fill_shade(fz_context *ctx, fz_device *dev_, fz_shade *shade, fz_matrix ctm, float alpha, const fz_color_params *color_params) { fz_test_device *dev = (fz_test_device*)dev_; @@ -177,7 +177,7 @@ fz_test_fill_shade(fz_context *ctx, fz_device *dev_, fz_shade *shade, const fz_m arg.dev = dev; arg.shade = shade; arg.color_params = color_params; - fz_process_shade(ctx, shade, *ctm, prepare_vertex, NULL, &arg); + fz_process_shade(ctx, shade, ctm, prepare_vertex, NULL, &arg); } } } @@ -186,7 +186,7 @@ fz_test_fill_shade(fz_context *ctx, fz_device *dev_, fz_shade *shade, const fz_m } static void -fz_test_fill_image(fz_context *ctx, fz_device *dev_, fz_image *image, const fz_matrix *ctm, float alpha, const fz_color_params *color_params) +fz_test_fill_image(fz_context *ctx, fz_device *dev_, fz_image *image, fz_matrix ctm, float alpha, const fz_color_params *color_params) { fz_test_device *dev = (fz_test_device*)dev_; @@ -363,7 +363,7 @@ fz_test_fill_image(fz_context *ctx, fz_device *dev_, fz_image *image, const fz_m } static void -fz_test_fill_image_mask(fz_context *ctx, fz_device *dev_, fz_image *image, const fz_matrix *ctm, +fz_test_fill_image_mask(fz_context *ctx, fz_device *dev_, fz_image *image, fz_matrix ctm, fz_colorspace *colorspace, const float *color, float alpha, const fz_color_params *color_params) { fz_test_device *dev = (fz_test_device*)dev_; @@ -381,7 +381,7 @@ fz_test_fill_image_mask(fz_context *ctx, fz_device *dev_, fz_image *image, const } static void -fz_test_clip_path(fz_context *ctx, fz_device *dev_, const fz_path *path, int even_odd, const fz_matrix *ctm, const fz_rect *scissor) +fz_test_clip_path(fz_context *ctx, fz_device *dev_, const fz_path *path, int even_odd, fz_matrix ctm, const fz_rect *scissor) { fz_test_device *dev = (fz_test_device*)dev_; @@ -389,7 +389,7 @@ fz_test_clip_path(fz_context *ctx, fz_device *dev_, const fz_path *path, int eve } static void -fz_test_clip_stroke_path(fz_context *ctx, fz_device *dev_, const fz_path *path, const fz_stroke_state *stroke, const fz_matrix *ctm, const fz_rect *scissor) +fz_test_clip_stroke_path(fz_context *ctx, fz_device *dev_, const fz_path *path, const fz_stroke_state *stroke, fz_matrix ctm, const fz_rect *scissor) { fz_test_device *dev = (fz_test_device*)dev_; @@ -397,7 +397,7 @@ fz_test_clip_stroke_path(fz_context *ctx, fz_device *dev_, const fz_path *path, } static void -fz_test_clip_text(fz_context *ctx, fz_device *dev_, const fz_text *text, const fz_matrix *ctm, const fz_rect *scissor) +fz_test_clip_text(fz_context *ctx, fz_device *dev_, const fz_text *text, fz_matrix ctm, const fz_rect *scissor) { fz_test_device *dev = (fz_test_device*)dev_; @@ -405,7 +405,7 @@ fz_test_clip_text(fz_context *ctx, fz_device *dev_, const fz_text *text, const f } static void -fz_test_clip_stroke_text(fz_context *ctx, fz_device *dev_, const fz_text *text, const fz_stroke_state *stroke, const fz_matrix *ctm, const fz_rect *scissor) +fz_test_clip_stroke_text(fz_context *ctx, fz_device *dev_, const fz_text *text, const fz_stroke_state *stroke, fz_matrix ctm, const fz_rect *scissor) { fz_test_device *dev = (fz_test_device*)dev_; @@ -413,7 +413,7 @@ fz_test_clip_stroke_text(fz_context *ctx, fz_device *dev_, const fz_text *text, } static void -fz_test_ignore_text(fz_context *ctx, fz_device *dev_, const fz_text *text, const fz_matrix *ctm) +fz_test_ignore_text(fz_context *ctx, fz_device *dev_, const fz_text *text, fz_matrix ctm) { fz_test_device *dev = (fz_test_device*)dev_; @@ -421,7 +421,7 @@ fz_test_ignore_text(fz_context *ctx, fz_device *dev_, const fz_text *text, const } static void -fz_test_clip_image_mask(fz_context *ctx, fz_device *dev_, fz_image *img, const fz_matrix *ctm, const fz_rect *scissor) +fz_test_clip_image_mask(fz_context *ctx, fz_device *dev_, fz_image *img, fz_matrix ctm, const fz_rect *scissor) { fz_test_device *dev = (fz_test_device*)dev_; @@ -469,7 +469,7 @@ fz_test_end_group(fz_context *ctx, fz_device *dev_) } static int -fz_test_begin_tile(fz_context *ctx, fz_device *dev_, const fz_rect *area, const fz_rect *view, float xstep, float ystep, const fz_matrix *ctm, int id) +fz_test_begin_tile(fz_context *ctx, fz_device *dev_, const fz_rect *area, const fz_rect *view, float xstep, float ystep, fz_matrix ctm, int id) { fz_test_device *dev = (fz_test_device*)dev_; diff --git a/source/fitz/text.c b/source/fitz/text.c index 7fb46ae5..ef57db4b 100644 --- a/source/fitz/text.c +++ b/source/fitz/text.c @@ -107,8 +107,8 @@ fz_show_glyph(fz_context *ctx, fz_text *text, fz_font *font, fz_matrix trm, int span->len++; } -void -fz_show_string(fz_context *ctx, fz_text *text, fz_font *user_font, fz_matrix *trm, const char *s, int wmode, int bidi_level, fz_bidi_direction markup_dir, fz_text_language language) +fz_matrix +fz_show_string(fz_context *ctx, fz_text *text, fz_font *user_font, fz_matrix trm, const char *s, int wmode, int bidi_level, fz_bidi_direction markup_dir, fz_text_language language) { fz_font *font; int gid, ucs; @@ -118,13 +118,15 @@ fz_show_string(fz_context *ctx, fz_text *text, fz_font *user_font, fz_matrix *tr { s += fz_chartorune(&ucs, s); gid = fz_encode_character_with_fallback(ctx, user_font, ucs, 0, language, &font); - fz_show_glyph(ctx, text, font, *trm, gid, ucs, wmode, bidi_level, markup_dir, language); + fz_show_glyph(ctx, text, font, trm, gid, ucs, wmode, bidi_level, markup_dir, language); adv = fz_advance_glyph(ctx, font, gid, wmode); if (wmode == 0) - *trm = fz_pre_translate(*trm, adv, 0); + trm = fz_pre_translate(trm, adv, 0); else - *trm = fz_pre_translate(*trm, 0, -adv); + trm = fz_pre_translate(trm, 0, -adv); } + + return trm; } fz_rect diff --git a/source/fitz/trace-device.c b/source/fitz/trace-device.c index 59d625c7..b89661ad 100644 --- a/source/fitz/trace-device.c +++ b/source/fitz/trace-device.c @@ -7,10 +7,9 @@ typedef struct fz_trace_device_s } fz_trace_device; static void -fz_trace_matrix(fz_context *ctx, fz_output *out, const fz_matrix *ctm) +fz_trace_matrix(fz_context *ctx, fz_output *out, fz_matrix ctm) { - fz_write_printf(ctx, out, " matrix=\"%g %g %g %g %g %g\"", - ctm->a, ctm->b, ctm->c, ctm->d, ctm->e, ctm->f); + fz_write_printf(ctx, out, " matrix=\"%g %g %g %g %g %g\"", ctm.a, ctm.b, ctm.c, ctm.d, ctm.e, ctm.f); } static void @@ -116,7 +115,7 @@ fz_trace_path(fz_context *ctx, fz_output *out, const fz_path *path) } static void -fz_trace_fill_path(fz_context *ctx, fz_device *dev, const fz_path *path, int even_odd, const fz_matrix *ctm, +fz_trace_fill_path(fz_context *ctx, fz_device *dev, const fz_path *path, int even_odd, fz_matrix ctm, fz_colorspace *colorspace, const float *color, float alpha, const fz_color_params *color_params) { fz_output *out = ((fz_trace_device*)dev)->out; @@ -133,7 +132,7 @@ fz_trace_fill_path(fz_context *ctx, fz_device *dev, const fz_path *path, int eve } static void -fz_trace_stroke_path(fz_context *ctx, fz_device *dev, const fz_path *path, const fz_stroke_state *stroke, const fz_matrix *ctm, +fz_trace_stroke_path(fz_context *ctx, fz_device *dev, const fz_path *path, const fz_stroke_state *stroke, fz_matrix ctm, fz_colorspace *colorspace, const float *color, float alpha, const fz_color_params *color_params) { fz_output *out = ((fz_trace_device*)dev)->out; @@ -163,7 +162,7 @@ fz_trace_stroke_path(fz_context *ctx, fz_device *dev, const fz_path *path, const } static void -fz_trace_clip_path(fz_context *ctx, fz_device *dev, const fz_path *path, int even_odd, const fz_matrix *ctm, const fz_rect *scissor) +fz_trace_clip_path(fz_context *ctx, fz_device *dev, const fz_path *path, int even_odd, fz_matrix ctm, const fz_rect *scissor) { fz_output *out = ((fz_trace_device*)dev)->out; fz_write_printf(ctx, out, "<clip_path"); @@ -178,7 +177,7 @@ fz_trace_clip_path(fz_context *ctx, fz_device *dev, const fz_path *path, int eve } static void -fz_trace_clip_stroke_path(fz_context *ctx, fz_device *dev, const fz_path *path, const fz_stroke_state *stroke, const fz_matrix *ctm, const fz_rect *scissor) +fz_trace_clip_stroke_path(fz_context *ctx, fz_device *dev, const fz_path *path, const fz_stroke_state *stroke, fz_matrix ctm, const fz_rect *scissor) { fz_output *out = ((fz_trace_device*)dev)->out; fz_write_printf(ctx, out, "<clip_stroke_path"); @@ -189,7 +188,7 @@ fz_trace_clip_stroke_path(fz_context *ctx, fz_device *dev, const fz_path *path, } static void -fz_trace_fill_text(fz_context *ctx, fz_device *dev, const fz_text *text, const fz_matrix *ctm, +fz_trace_fill_text(fz_context *ctx, fz_device *dev, const fz_text *text, fz_matrix ctm, fz_colorspace *colorspace, const float *color, float alpha, const fz_color_params *color_params) { fz_output *out = ((fz_trace_device*)dev)->out; @@ -202,7 +201,7 @@ fz_trace_fill_text(fz_context *ctx, fz_device *dev, const fz_text *text, const f } static void -fz_trace_stroke_text(fz_context *ctx, fz_device *dev, const fz_text *text, const fz_stroke_state *stroke, const fz_matrix *ctm, +fz_trace_stroke_text(fz_context *ctx, fz_device *dev, const fz_text *text, const fz_stroke_state *stroke, fz_matrix ctm, fz_colorspace *colorspace, const float *color, float alpha, const fz_color_params *color_params) { fz_output *out = ((fz_trace_device*)dev)->out; @@ -215,7 +214,7 @@ fz_trace_stroke_text(fz_context *ctx, fz_device *dev, const fz_text *text, const } static void -fz_trace_clip_text(fz_context *ctx, fz_device *dev, const fz_text *text, const fz_matrix *ctm, const fz_rect *scissor) +fz_trace_clip_text(fz_context *ctx, fz_device *dev, const fz_text *text, fz_matrix ctm, const fz_rect *scissor) { fz_output *out = ((fz_trace_device*)dev)->out; fz_write_printf(ctx, out, "<clip_text"); @@ -226,7 +225,7 @@ fz_trace_clip_text(fz_context *ctx, fz_device *dev, const fz_text *text, const f } static void -fz_trace_clip_stroke_text(fz_context *ctx, fz_device *dev, const fz_text *text, const fz_stroke_state *stroke, const fz_matrix *ctm, const fz_rect *scissor) +fz_trace_clip_stroke_text(fz_context *ctx, fz_device *dev, const fz_text *text, const fz_stroke_state *stroke, fz_matrix ctm, const fz_rect *scissor) { fz_output *out = ((fz_trace_device*)dev)->out; fz_write_printf(ctx, out, "<clip_stroke_text"); @@ -237,7 +236,7 @@ fz_trace_clip_stroke_text(fz_context *ctx, fz_device *dev, const fz_text *text, } static void -fz_trace_ignore_text(fz_context *ctx, fz_device *dev, const fz_text *text, const fz_matrix *ctm) +fz_trace_ignore_text(fz_context *ctx, fz_device *dev, const fz_text *text, fz_matrix ctm) { fz_output *out = ((fz_trace_device*)dev)->out; fz_write_printf(ctx, out, "<ignore_text"); @@ -248,7 +247,7 @@ fz_trace_ignore_text(fz_context *ctx, fz_device *dev, const fz_text *text, const } static void -fz_trace_fill_image(fz_context *ctx, fz_device *dev, fz_image *image, const fz_matrix *ctm, float alpha, const fz_color_params *color_params) +fz_trace_fill_image(fz_context *ctx, fz_device *dev, fz_image *image, fz_matrix ctm, float alpha, const fz_color_params *color_params) { fz_output *out = ((fz_trace_device*)dev)->out; fz_write_printf(ctx, out, "<fill_image alpha=\"%g\"", alpha); @@ -258,7 +257,7 @@ fz_trace_fill_image(fz_context *ctx, fz_device *dev, fz_image *image, const fz_m } static void -fz_trace_fill_shade(fz_context *ctx, fz_device *dev, fz_shade *shade, const fz_matrix *ctm, float alpha, const fz_color_params *color_params) +fz_trace_fill_shade(fz_context *ctx, fz_device *dev, fz_shade *shade, fz_matrix ctm, float alpha, const fz_color_params *color_params) { fz_output *out = ((fz_trace_device*)dev)->out; fz_write_printf(ctx, out, "<fill_shade alpha=\"%g\"", alpha); @@ -267,7 +266,7 @@ fz_trace_fill_shade(fz_context *ctx, fz_device *dev, fz_shade *shade, const fz_m } static void -fz_trace_fill_image_mask(fz_context *ctx, fz_device *dev, fz_image *image, const fz_matrix *ctm, +fz_trace_fill_image_mask(fz_context *ctx, fz_device *dev, fz_image *image, fz_matrix ctm, fz_colorspace *colorspace, const float *color, float alpha, const fz_color_params *color_params) { fz_output *out = ((fz_trace_device*)dev)->out; @@ -279,7 +278,7 @@ fz_trace_fill_image_mask(fz_context *ctx, fz_device *dev, fz_image *image, const } static void -fz_trace_clip_image_mask(fz_context *ctx, fz_device *dev, fz_image *image, const fz_matrix *ctm, const fz_rect *scissor) +fz_trace_clip_image_mask(fz_context *ctx, fz_device *dev, fz_image *image, fz_matrix ctm, const fz_rect *scissor) { fz_output *out = ((fz_trace_device*)dev)->out; fz_write_printf(ctx, out, "<clip_image_mask"); @@ -329,7 +328,7 @@ fz_trace_end_group(fz_context *ctx, fz_device *dev) } static int -fz_trace_begin_tile(fz_context *ctx, fz_device *dev, const fz_rect *area, const fz_rect *view, float xstep, float ystep, const fz_matrix *ctm, int id) +fz_trace_begin_tile(fz_context *ctx, fz_device *dev, const fz_rect *area, const fz_rect *view, float xstep, float ystep, fz_matrix ctm, int id) { fz_output *out = ((fz_trace_device*)dev)->out; fz_write_printf(ctx, out, "<tile id=\"%d\"", id); diff --git a/source/fitz/util.c b/source/fitz/util.c index ddbb36b8..4e1f4e1e 100644 --- a/source/fitz/util.c +++ b/source/fitz/util.c @@ -12,7 +12,7 @@ fz_new_display_list_from_page(fz_context *ctx, fz_page *page) fz_try(ctx) { dev = fz_new_list_device(ctx, list); - fz_run_page(ctx, page, dev, &fz_identity, NULL); + fz_run_page(ctx, page, dev, fz_identity, NULL); fz_close_device(ctx, dev); } fz_always(ctx) @@ -55,7 +55,7 @@ fz_new_display_list_from_page_contents(fz_context *ctx, fz_page *page) fz_try(ctx) { dev = fz_new_list_device(ctx, list); - fz_run_page_contents(ctx, page, dev, &fz_identity, NULL); + fz_run_page_contents(ctx, page, dev, fz_identity, NULL); fz_close_device(ctx, dev); } fz_always(ctx) @@ -82,7 +82,7 @@ fz_new_display_list_from_annot(fz_context *ctx, fz_annot *annot) fz_try(ctx) { dev = fz_new_list_device(ctx, list); - fz_run_annot(ctx, annot, dev, &fz_identity, NULL); + fz_run_annot(ctx, annot, dev, fz_identity, NULL); fz_close_device(ctx, dev); } fz_always(ctx) @@ -99,7 +99,7 @@ fz_new_display_list_from_annot(fz_context *ctx, fz_annot *annot) } fz_pixmap * -fz_new_pixmap_from_display_list(fz_context *ctx, fz_display_list *list, const fz_matrix *ctm, fz_colorspace *cs, int alpha) +fz_new_pixmap_from_display_list(fz_context *ctx, fz_display_list *list, fz_matrix ctm, fz_colorspace *cs, int alpha) { fz_rect rect; fz_irect bbox; @@ -107,7 +107,7 @@ fz_new_pixmap_from_display_list(fz_context *ctx, fz_display_list *list, const fz fz_device *dev = NULL; rect = fz_bound_display_list(ctx, list); - rect = fz_transform_rect(rect, *ctm); + rect = fz_transform_rect(rect, ctm); bbox = fz_round_rect(rect); pix = fz_new_pixmap_with_bbox(ctx, cs, bbox, 0, alpha); @@ -119,7 +119,7 @@ fz_new_pixmap_from_display_list(fz_context *ctx, fz_display_list *list, const fz fz_try(ctx) { dev = fz_new_draw_device(ctx, ctm, pix); - fz_run_display_list(ctx, list, dev, &fz_identity, NULL, NULL); + fz_run_display_list(ctx, list, dev, fz_identity, NULL, NULL); fz_close_device(ctx, dev); } fz_always(ctx) @@ -136,7 +136,7 @@ fz_new_pixmap_from_display_list(fz_context *ctx, fz_display_list *list, const fz } fz_pixmap * -fz_new_pixmap_from_page_contents(fz_context *ctx, fz_page *page, const fz_matrix *ctm, fz_colorspace *cs, int alpha) +fz_new_pixmap_from_page_contents(fz_context *ctx, fz_page *page, fz_matrix ctm, fz_colorspace *cs, int alpha) { fz_rect rect; fz_irect bbox; @@ -144,7 +144,7 @@ fz_new_pixmap_from_page_contents(fz_context *ctx, fz_page *page, const fz_matrix fz_device *dev = NULL; rect = fz_bound_page(ctx, page); - rect = fz_transform_rect(rect, *ctm); + rect = fz_transform_rect(rect, ctm); bbox = fz_round_rect(rect); pix = fz_new_pixmap_with_bbox(ctx, cs, bbox, 0, alpha); @@ -156,7 +156,7 @@ fz_new_pixmap_from_page_contents(fz_context *ctx, fz_page *page, const fz_matrix fz_try(ctx) { dev = fz_new_draw_device(ctx, ctm, pix); - fz_run_page_contents(ctx, page, dev, &fz_identity, NULL); + fz_run_page_contents(ctx, page, dev, fz_identity, NULL); fz_close_device(ctx, dev); } fz_always(ctx) @@ -173,7 +173,7 @@ fz_new_pixmap_from_page_contents(fz_context *ctx, fz_page *page, const fz_matrix } fz_pixmap * -fz_new_pixmap_from_annot(fz_context *ctx, fz_annot *annot, const fz_matrix *ctm, fz_colorspace *cs, int alpha) +fz_new_pixmap_from_annot(fz_context *ctx, fz_annot *annot, fz_matrix ctm, fz_colorspace *cs, int alpha) { fz_rect rect; fz_irect bbox; @@ -181,7 +181,7 @@ fz_new_pixmap_from_annot(fz_context *ctx, fz_annot *annot, const fz_matrix *ctm, fz_device *dev = NULL; rect = fz_bound_annot(ctx, annot); - rect = fz_transform_rect(rect, *ctm); + rect = fz_transform_rect(rect, ctm); bbox = fz_round_rect(rect); pix = fz_new_pixmap_with_bbox(ctx, cs, bbox, 0, alpha); @@ -193,7 +193,7 @@ fz_new_pixmap_from_annot(fz_context *ctx, fz_annot *annot, const fz_matrix *ctm, fz_try(ctx) { dev = fz_new_draw_device(ctx, ctm, pix); - fz_run_annot(ctx, annot, dev, &fz_identity, NULL); + fz_run_annot(ctx, annot, dev, fz_identity, NULL); fz_close_device(ctx, dev); } fz_always(ctx) @@ -210,7 +210,7 @@ fz_new_pixmap_from_annot(fz_context *ctx, fz_annot *annot, const fz_matrix *ctm, } fz_pixmap * -fz_new_pixmap_from_page(fz_context *ctx, fz_page *page, const fz_matrix *ctm, fz_colorspace *cs, int alpha) +fz_new_pixmap_from_page(fz_context *ctx, fz_page *page, fz_matrix ctm, fz_colorspace *cs, int alpha) { fz_rect rect; fz_irect bbox; @@ -218,7 +218,7 @@ fz_new_pixmap_from_page(fz_context *ctx, fz_page *page, const fz_matrix *ctm, fz fz_device *dev = NULL; rect = fz_bound_page(ctx, page); - rect = fz_transform_rect(rect, *ctm); + rect = fz_transform_rect(rect, ctm); bbox = fz_round_rect(rect); pix = fz_new_pixmap_with_bbox(ctx, cs, bbox, 0, alpha); @@ -230,7 +230,7 @@ fz_new_pixmap_from_page(fz_context *ctx, fz_page *page, const fz_matrix *ctm, fz fz_try(ctx) { dev = fz_new_draw_device(ctx, ctm, pix); - fz_run_page(ctx, page, dev, &fz_identity, NULL); + fz_run_page(ctx, page, dev, fz_identity, NULL); fz_close_device(ctx, dev); } fz_always(ctx) @@ -247,7 +247,7 @@ fz_new_pixmap_from_page(fz_context *ctx, fz_page *page, const fz_matrix *ctm, fz } fz_pixmap * -fz_new_pixmap_from_page_number(fz_context *ctx, fz_document *doc, int number, const fz_matrix *ctm, fz_colorspace *cs, int alpha) +fz_new_pixmap_from_page_number(fz_context *ctx, fz_document *doc, int number, fz_matrix ctm, fz_colorspace *cs, int alpha) { fz_page *page; fz_pixmap *pix = NULL; @@ -275,7 +275,7 @@ fz_new_stext_page_from_display_list(fz_context *ctx, fz_display_list *list, cons fz_try(ctx) { dev = fz_new_stext_device(ctx, text, options); - fz_run_display_list(ctx, list, dev, &fz_identity, NULL, NULL); + fz_run_display_list(ctx, list, dev, fz_identity, NULL, NULL); fz_close_device(ctx, dev); } fz_always(ctx) @@ -304,7 +304,7 @@ fz_new_stext_page_from_page(fz_context *ctx, fz_page *page, const fz_stext_optio fz_try(ctx) { dev = fz_new_stext_device(ctx, text, options); - fz_run_page_contents(ctx, page, dev, &fz_identity, NULL); + fz_run_page_contents(ctx, page, dev, fz_identity, NULL); fz_close_device(ctx, dev); } fz_always(ctx) diff --git a/source/gprf/gprf-doc.c b/source/gprf/gprf-doc.c index 44e12ebc..ff242001 100644 --- a/source/gprf/gprf-doc.c +++ b/source/gprf/gprf-doc.c @@ -810,7 +810,7 @@ read_tiles(fz_context *ctx, gprf_page *page) } static void -gprf_run_page(fz_context *ctx, fz_page *page_, fz_device *dev, const fz_matrix *ctm, fz_cookie *cookie) +gprf_run_page(fz_context *ctx, fz_page *page_, fz_device *dev, fz_matrix ctm, fz_cookie *cookie) { gprf_page *page = (gprf_page*)page_; gprf_document *doc = page->doc; @@ -844,8 +844,8 @@ gprf_run_page(fz_context *ctx, fz_page *page_, fz_device *dev, const fz_matrix * local.d = scale_y; local.e = x * scale; local.f = y * scale; - fz_concat(&local, &local, ctm); - fz_fill_image(ctx, dev, page->tiles[i++], &local, 1.0f, NULL); + local = fz_concat(local, ctm); + fz_fill_image(ctx, dev, page->tiles[i++], local, 1.0f, NULL); } } fz_render_flags(ctx, dev, 0, FZ_DEVFLAG_GRIDFIT_AS_TILED); diff --git a/source/html/epub-doc.c b/source/html/epub-doc.c index 5325c316..85c84624 100644 --- a/source/html/epub-doc.c +++ b/source/html/epub-doc.c @@ -149,7 +149,7 @@ epub_bound_page(fz_context *ctx, fz_page *page_) } static void -epub_run_page(fz_context *ctx, fz_page *page_, fz_device *dev, const fz_matrix *ctm, fz_cookie *cookie) +epub_run_page(fz_context *ctx, fz_page *page_, fz_device *dev, fz_matrix ctm, fz_cookie *cookie) { epub_page *page = (epub_page*)page_; epub_document *doc = page->doc; @@ -162,7 +162,7 @@ epub_run_page(fz_context *ctx, fz_page *page_, fz_device *dev, const fz_matrix * int cn = count_chapter_pages(ch); if (n < count + cn) { - fz_draw_html(ctx, dev, *ctm, ch->html, n-count); + fz_draw_html(ctx, dev, ctm, ch->html, n-count); break; } count += cn; diff --git a/source/html/html-doc.c b/source/html/html-doc.c index 45fbd8f9..21c9c653 100644 --- a/source/html/html-doc.c +++ b/source/html/html-doc.c @@ -88,11 +88,11 @@ htdoc_bound_page(fz_context *ctx, fz_page *page_) } static void -htdoc_run_page(fz_context *ctx, fz_page *page_, fz_device *dev, const fz_matrix *ctm, fz_cookie *cookie) +htdoc_run_page(fz_context *ctx, fz_page *page_, fz_device *dev, fz_matrix ctm, fz_cookie *cookie) { html_page *page = (html_page*)page_; html_document *doc = page->doc; - fz_draw_html(ctx, dev, *ctm, doc->html, page->number); + fz_draw_html(ctx, dev, ctm, doc->html, page->number); } static fz_link * diff --git a/source/html/html-layout.c b/source/html/html-layout.c index 5f67c4e7..56ad3a45 100644 --- a/source/html/html-layout.c +++ b/source/html/html-layout.c @@ -1652,7 +1652,7 @@ static void draw_flow_box(fz_context *ctx, fz_html_box *box, float page_top, flo { if (text) { - fz_fill_text(ctx, dev, text, &ctm, fz_device_rgb(ctx), prev_color, 1, NULL); + fz_fill_text(ctx, dev, text, ctm, fz_device_rgb(ctx), prev_color, 1, NULL); fz_drop_text(ctx, text); text = NULL; } @@ -1739,7 +1739,7 @@ static void draw_flow_box(fz_context *ctx, fz_html_box *box, float page_top, flo { if (text) { - fz_fill_text(ctx, dev, text, &ctm, fz_device_rgb(ctx), color, 1, NULL); + fz_fill_text(ctx, dev, text, ctm, fz_device_rgb(ctx), color, 1, NULL); fz_drop_text(ctx, text); text = NULL; } @@ -1747,14 +1747,14 @@ static void draw_flow_box(fz_context *ctx, fz_html_box *box, float page_top, flo { fz_matrix itm = fz_pre_translate(ctm, node->x, node->y - page_top); itm = fz_pre_scale(itm, node->w, node->h); - fz_fill_image(ctx, dev, node->content.image, &itm, 1, NULL); + fz_fill_image(ctx, dev, node->content.image, itm, 1, NULL); } } } if (text) { - fz_fill_text(ctx, dev, text, &ctm, fz_device_rgb(ctx), color, 1, NULL); + fz_fill_text(ctx, dev, text, ctm, fz_device_rgb(ctx), color, 1, NULL); fz_drop_text(ctx, text); text = NULL; } @@ -1778,7 +1778,7 @@ static void draw_rect(fz_context *ctx, fz_device *dev, fz_matrix ctm, float page rgb[1] = color.g / 255.0f; rgb[2] = color.b / 255.0f; - fz_fill_path(ctx, dev, path, 0, &ctm, fz_device_rgb(ctx), rgb, color.a / 255.0f, NULL); + fz_fill_path(ctx, dev, path, 0, ctm, fz_device_rgb(ctx), rgb, color.a / 255.0f, NULL); fz_drop_path(ctx, path); } @@ -1936,7 +1936,7 @@ static void draw_list_mark(fz_context *ctx, fz_html_box *box, float page_top, fl color[1] = box->style.color.g / 255.0f; color[2] = box->style.color.b / 255.0f; - fz_fill_text(ctx, dev, text, &ctm, fz_device_rgb(ctx), color, 1, NULL); + fz_fill_text(ctx, dev, text, ctm, fz_device_rgb(ctx), color, 1, NULL); } fz_always(ctx) fz_drop_text(ctx, text); diff --git a/source/pdf/pdf-device.c b/source/pdf/pdf-device.c index 4358508e..97621b49 100644 --- a/source/pdf/pdf-device.c +++ b/source/pdf/pdf-device.c @@ -200,16 +200,16 @@ pdf_dev_path(fz_context *ctx, pdf_device *pdev, const fz_path *path) } static void -pdf_dev_ctm(fz_context *ctx, pdf_device *pdev, const fz_matrix *ctm) +pdf_dev_ctm(fz_context *ctx, pdf_device *pdev, fz_matrix ctm) { fz_matrix inverse; gstate *gs = CURRENT_GSTATE(pdev); - if (memcmp(&gs->ctm, ctm, sizeof(*ctm)) == 0) + if (memcmp(&gs->ctm, &ctm, sizeof(ctm)) == 0) return; inverse = fz_invert_matrix(gs->ctm); - inverse = fz_concat(*ctm, inverse); - gs->ctm = *ctm; + inverse = fz_concat(ctm, inverse); + gs->ctm = ctm; fz_append_printf(ctx, gs->buf, "%M cm\n", &inverse); } @@ -503,7 +503,7 @@ pdf_dev_trm(fz_context *ctx, pdf_device *pdev, int trm) } static void -pdf_dev_begin_text(fz_context *ctx, pdf_device *pdev, const fz_matrix *tm, int trm) +pdf_dev_begin_text(fz_context *ctx, pdf_device *pdev, fz_matrix tm, int trm) { pdf_dev_trm(ctx, pdev, trm); if (!pdev->in_text) @@ -631,7 +631,7 @@ pdf_dev_new_form(fz_context *ctx, pdf_obj **form_ref, pdf_device *pdev, const fz /* Entry points */ static void -pdf_dev_fill_path(fz_context *ctx, fz_device *dev, const fz_path *path, int even_odd, const fz_matrix *ctm, +pdf_dev_fill_path(fz_context *ctx, fz_device *dev, const fz_path *path, int even_odd, fz_matrix ctm, fz_colorspace *colorspace, const float *color, float alpha, const fz_color_params *color_params) { pdf_device *pdev = (pdf_device*)dev; @@ -646,7 +646,7 @@ pdf_dev_fill_path(fz_context *ctx, fz_device *dev, const fz_path *path, int even } static void -pdf_dev_stroke_path(fz_context *ctx, fz_device *dev, const fz_path *path, const fz_stroke_state *stroke, const fz_matrix *ctm, +pdf_dev_stroke_path(fz_context *ctx, fz_device *dev, const fz_path *path, const fz_stroke_state *stroke, fz_matrix ctm, fz_colorspace *colorspace, const float *color, float alpha, const fz_color_params *color_params) { pdf_device *pdev = (pdf_device*)dev; @@ -662,7 +662,7 @@ pdf_dev_stroke_path(fz_context *ctx, fz_device *dev, const fz_path *path, const } static void -pdf_dev_clip_path(fz_context *ctx, fz_device *dev, const fz_path *path, int even_odd, const fz_matrix *ctm, const fz_rect *scissor) +pdf_dev_clip_path(fz_context *ctx, fz_device *dev, const fz_path *path, int even_odd, fz_matrix ctm, const fz_rect *scissor) { pdf_device *pdev = (pdf_device*)dev; gstate *gs; @@ -676,7 +676,7 @@ pdf_dev_clip_path(fz_context *ctx, fz_device *dev, const fz_path *path, int even } static void -pdf_dev_clip_stroke_path(fz_context *ctx, fz_device *dev, const fz_path *path, const fz_stroke_state *stroke, const fz_matrix *ctm, const fz_rect *scissor) +pdf_dev_clip_stroke_path(fz_context *ctx, fz_device *dev, const fz_path *path, const fz_stroke_state *stroke, fz_matrix ctm, const fz_rect *scissor) { pdf_device *pdev = (pdf_device*)dev; gstate *gs; @@ -694,7 +694,7 @@ pdf_dev_clip_stroke_path(fz_context *ctx, fz_device *dev, const fz_path *path, c } static void -pdf_dev_fill_text(fz_context *ctx, fz_device *dev, const fz_text *text, const fz_matrix *ctm, +pdf_dev_fill_text(fz_context *ctx, fz_device *dev, const fz_text *text, fz_matrix ctm, fz_colorspace *colorspace, const float *color, float alpha, const fz_color_params *color_params) { pdf_device *pdev = (pdf_device*)dev; @@ -703,7 +703,7 @@ pdf_dev_fill_text(fz_context *ctx, fz_device *dev, const fz_text *text, const fz for (span = text->head; span; span = span->next) { fz_matrix trm = span->trm; - pdf_dev_begin_text(ctx, pdev, &trm, 0); + pdf_dev_begin_text(ctx, pdev, trm, 0); pdf_dev_font(ctx, pdev, span->font); pdf_dev_ctm(ctx, pdev, ctm); pdf_dev_alpha(ctx, pdev, alpha, 0); @@ -713,7 +713,7 @@ pdf_dev_fill_text(fz_context *ctx, fz_device *dev, const fz_text *text, const fz } static void -pdf_dev_stroke_text(fz_context *ctx, fz_device *dev, const fz_text *text, const fz_stroke_state *stroke, const fz_matrix *ctm, +pdf_dev_stroke_text(fz_context *ctx, fz_device *dev, const fz_text *text, const fz_stroke_state *stroke, fz_matrix ctm, fz_colorspace *colorspace, const float *color, float alpha, const fz_color_params *color_params) { pdf_device *pdev = (pdf_device*)dev; @@ -721,7 +721,7 @@ pdf_dev_stroke_text(fz_context *ctx, fz_device *dev, const fz_text *text, const for (span = text->head; span; span = span->next) { - pdf_dev_begin_text(ctx, pdev, &span->trm, 1); + pdf_dev_begin_text(ctx, pdev, span->trm, 1); pdf_dev_font(ctx, pdev, span->font); pdf_dev_ctm(ctx, pdev, ctm); pdf_dev_alpha(ctx, pdev, alpha, 1); @@ -731,13 +731,13 @@ pdf_dev_stroke_text(fz_context *ctx, fz_device *dev, const fz_text *text, const } static void -pdf_dev_clip_text(fz_context *ctx, fz_device *dev, const fz_text *text, const fz_matrix *ctm, const fz_rect *scissor) +pdf_dev_clip_text(fz_context *ctx, fz_device *dev, const fz_text *text, fz_matrix ctm, const fz_rect *scissor) { pdf_device *pdev = (pdf_device*)dev; fz_text_span *span; for (span = text->head; span; span = span->next) { - pdf_dev_begin_text(ctx, pdev, &span->trm, 0); + pdf_dev_begin_text(ctx, pdev, span->trm, 0); pdf_dev_ctm(ctx, pdev, ctm); pdf_dev_font(ctx, pdev, span->font); pdf_dev_text_span(ctx, pdev, span); @@ -745,13 +745,13 @@ pdf_dev_clip_text(fz_context *ctx, fz_device *dev, const fz_text *text, const fz } static void -pdf_dev_clip_stroke_text(fz_context *ctx, fz_device *dev, const fz_text *text, const fz_stroke_state *stroke, const fz_matrix *ctm, const fz_rect *scissor) +pdf_dev_clip_stroke_text(fz_context *ctx, fz_device *dev, const fz_text *text, const fz_stroke_state *stroke, fz_matrix ctm, const fz_rect *scissor) { pdf_device *pdev = (pdf_device*)dev; fz_text_span *span; for (span = text->head; span; span = span->next) { - pdf_dev_begin_text(ctx, pdev, &span->trm, 0); + pdf_dev_begin_text(ctx, pdev, span->trm, 0); pdf_dev_font(ctx, pdev, span->font); pdf_dev_ctm(ctx, pdev, ctm); pdf_dev_text_span(ctx, pdev, span); @@ -759,13 +759,13 @@ pdf_dev_clip_stroke_text(fz_context *ctx, fz_device *dev, const fz_text *text, c } static void -pdf_dev_ignore_text(fz_context *ctx, fz_device *dev, const fz_text *text, const fz_matrix *ctm) +pdf_dev_ignore_text(fz_context *ctx, fz_device *dev, const fz_text *text, fz_matrix ctm) { pdf_device *pdev = (pdf_device*)dev; fz_text_span *span; for (span = text->head; span; span = span->next) { - pdf_dev_begin_text(ctx, pdev, &span->trm, 0); + pdf_dev_begin_text(ctx, pdev, span->trm, 0); pdf_dev_ctm(ctx, pdev, ctm); pdf_dev_font(ctx, pdev, span->font); pdf_dev_text_span(ctx, pdev, span); @@ -805,12 +805,11 @@ pdf_dev_add_image_res(fz_context *ctx, fz_device *dev, pdf_obj *im_res) } static void -pdf_dev_fill_image(fz_context *ctx, fz_device *dev, fz_image *image, const fz_matrix *ctm, float alpha, const fz_color_params *color_params) +pdf_dev_fill_image(fz_context *ctx, fz_device *dev, fz_image *image, fz_matrix ctm, float alpha, const fz_color_params *color_params) { pdf_device *pdev = (pdf_device*)dev; pdf_obj *im_res; gstate *gs = CURRENT_GSTATE(pdev); - fz_matrix local_ctm = *ctm; pdf_dev_end_text(ctx, pdev); im_res = pdf_add_image(ctx, pdev->doc, image, 0); @@ -822,9 +821,9 @@ pdf_dev_fill_image(fz_context *ctx, fz_device *dev, fz_image *image, const fz_ma pdf_dev_alpha(ctx, pdev, alpha, 0); /* PDF images are upside down, so fiddle the ctm */ - local_ctm = fz_pre_scale(local_ctm, 1, -1); - local_ctm = fz_pre_translate(local_ctm, 0, -1); - pdf_dev_ctm(ctx, pdev, &local_ctm); + ctm = fz_pre_scale(ctm, 1, -1); + ctm = fz_pre_translate(ctm, 0, -1); + pdf_dev_ctm(ctx, pdev, ctm); fz_append_printf(ctx, gs->buf, "/Img%d Do\n", pdf_to_num(ctx, im_res)); /* Possibly add to page resources */ @@ -833,7 +832,7 @@ pdf_dev_fill_image(fz_context *ctx, fz_device *dev, fz_image *image, const fz_ma } static void -pdf_dev_fill_shade(fz_context *ctx, fz_device *dev, fz_shade *shade, const fz_matrix *ctm, float alpha, const fz_color_params *color_params) +pdf_dev_fill_shade(fz_context *ctx, fz_device *dev, fz_shade *shade, fz_matrix ctm, float alpha, const fz_color_params *color_params) { pdf_device *pdev = (pdf_device*)dev; @@ -842,13 +841,12 @@ pdf_dev_fill_shade(fz_context *ctx, fz_device *dev, fz_shade *shade, const fz_ma } static void -pdf_dev_fill_image_mask(fz_context *ctx, fz_device *dev, fz_image *image, const fz_matrix *ctm, +pdf_dev_fill_image_mask(fz_context *ctx, fz_device *dev, fz_image *image, fz_matrix ctm, fz_colorspace *colorspace, const float *color, float alpha, const fz_color_params *color_params) { pdf_device *pdev = (pdf_device*)dev; pdf_obj *im_res = NULL; gstate *gs = CURRENT_GSTATE(pdev); - fz_matrix local_ctm = *ctm; pdf_dev_end_text(ctx, pdev); im_res = pdf_add_image(ctx, pdev->doc, image, 1); @@ -862,9 +860,9 @@ pdf_dev_fill_image_mask(fz_context *ctx, fz_device *dev, fz_image *image, const pdf_dev_color(ctx, pdev, colorspace, color, 0, color_params); /* PDF images are upside down, so fiddle the ctm */ - local_ctm = fz_pre_scale(local_ctm, 1, -1); - local_ctm = fz_pre_translate(local_ctm, 0, -1); - pdf_dev_ctm(ctx, pdev, &local_ctm); + ctm = fz_pre_scale(ctm, 1, -1); + ctm = fz_pre_translate(ctm, 0, -1); + pdf_dev_ctm(ctx, pdev, ctm); fz_append_printf(ctx, gs->buf, "/Img%d Do Q\n", pdf_to_num(ctx, im_res)); /* Possibly add to page resources */ @@ -873,7 +871,7 @@ pdf_dev_fill_image_mask(fz_context *ctx, fz_device *dev, fz_image *image, const } static void -pdf_dev_clip_image_mask(fz_context *ctx, fz_device *dev, fz_image *image, const fz_matrix *ctm, const fz_rect *scissor) +pdf_dev_clip_image_mask(fz_context *ctx, fz_device *dev, fz_image *image, fz_matrix ctm, const fz_rect *scissor) { pdf_device *pdev = (pdf_device*)dev; @@ -1031,7 +1029,7 @@ pdf_dev_end_group(fz_context *ctx, fz_device *dev) } static int -pdf_dev_begin_tile(fz_context *ctx, fz_device *dev, const fz_rect *area, const fz_rect *view, float xstep, float ystep, const fz_matrix *ctm, int id) +pdf_dev_begin_tile(fz_context *ctx, fz_device *dev, const fz_rect *area, const fz_rect *view, float xstep, float ystep, fz_matrix ctm, int id) { pdf_device *pdev = (pdf_device*)dev; @@ -1080,7 +1078,7 @@ pdf_dev_drop_device(fz_context *ctx, fz_device *dev) fz_free(ctx, pdev->gstates); } -fz_device *pdf_new_pdf_device(fz_context *ctx, pdf_document *doc, const fz_matrix *topctm, const fz_rect *mediabox, pdf_obj *resources, fz_buffer *buf) +fz_device *pdf_new_pdf_device(fz_context *ctx, pdf_document *doc, fz_matrix topctm, const fz_rect *mediabox, pdf_obj *resources, fz_buffer *buf) { pdf_device *dev = fz_new_derived_device(ctx, pdf_device); @@ -1133,7 +1131,7 @@ fz_device *pdf_new_pdf_device(fz_context *ctx, pdf_document *doc, const fz_matri dev->num_gstates = 1; dev->max_gstates = 1; - if (topctm != &fz_identity) + if (!fz_is_identity(topctm)) fz_append_printf(ctx, buf, "%M cm\n", topctm); } fz_catch(ctx) @@ -1153,5 +1151,5 @@ fz_device *pdf_page_write(fz_context *ctx, pdf_document *doc, fz_matrix pagectm = { 1, 0, 0, -1, -mediabox->x0, mediabox->y1 }; *presources = pdf_new_dict(ctx, doc, 0); *pcontents = fz_new_buffer(ctx, 0); - return pdf_new_pdf_device(ctx, doc, &pagectm, mediabox, *presources, *pcontents); + return pdf_new_pdf_device(ctx, doc, pagectm, mediabox, *presources, *pcontents); } diff --git a/source/pdf/pdf-link.c b/source/pdf/pdf-link.c index 6fe6f334..ae5beaa3 100644 --- a/source/pdf/pdf-link.c +++ b/source/pdf/pdf-link.c @@ -239,7 +239,7 @@ pdf_parse_link_action(fz_context *ctx, pdf_document *doc, pdf_obj *action, int p } static fz_link * -pdf_load_link(fz_context *ctx, pdf_document *doc, pdf_obj *dict, int pagenum, const fz_matrix *page_ctm) +pdf_load_link(fz_context *ctx, pdf_document *doc, pdf_obj *dict, int pagenum, fz_matrix page_ctm) { pdf_obj *action; pdf_obj *obj; @@ -256,7 +256,7 @@ pdf_load_link(fz_context *ctx, pdf_document *doc, pdf_obj *dict, int pagenum, co return NULL; bbox = pdf_to_rect(ctx, obj); - bbox = fz_transform_rect(bbox, *page_ctm); + bbox = fz_transform_rect(bbox, page_ctm); obj = pdf_dict_get(ctx, dict, PDF_NAME(Dest)); if (obj) @@ -284,7 +284,7 @@ pdf_load_link(fz_context *ctx, pdf_document *doc, pdf_obj *dict, int pagenum, co } fz_link * -pdf_load_link_annots(fz_context *ctx, pdf_document *doc, pdf_obj *annots, int pagenum, const fz_matrix *page_ctm) +pdf_load_link_annots(fz_context *ctx, pdf_document *doc, pdf_obj *annots, int pagenum, fz_matrix page_ctm) { fz_link *link, *head, *tail; pdf_obj *obj; diff --git a/source/pdf/pdf-op-filter.c b/source/pdf/pdf-op-filter.c index 10138cda..145dbfe2 100644 --- a/source/pdf/pdf-op-filter.c +++ b/source/pdf/pdf-op-filter.c @@ -436,7 +436,7 @@ filter_show_char(fz_context *ctx, pdf_filter_processor *p, int cid) } if (p->text_filter) - remove = p->text_filter(ctx, p->opaque, ucsbuf, ucslen, &trm, &p->tos.char_bbox); + remove = p->text_filter(ctx, p->opaque, ucsbuf, ucslen, trm, p->tos.char_bbox); pdf_tos_move_after_char(ctx, &p->tos); @@ -1040,7 +1040,7 @@ pdf_filter_ET(fz_context *ctx, pdf_processor *proc) fz_matrix ctm = fz_concat(p->gstate->sent.ctm, p->gstate->pending.ctm); if (p->chain->op_q) p->chain->op_q(ctx, p->chain); - p->after_text(ctx, p->opaque, p->doc, p->chain, &ctm); + p->after_text(ctx, p->opaque, p->doc, p->chain, ctm); if (p->chain->op_Q) p->chain->op_Q(ctx, p->chain); } diff --git a/source/pdf/pdf-op-run.c b/source/pdf/pdf-op-run.c index 61729f0c..b08657a6 100644 --- a/source/pdf/pdf-op-run.c +++ b/source/pdf/pdf-op-run.c @@ -13,7 +13,7 @@ typedef struct pdf_material_s pdf_material; typedef struct pdf_run_processor_s pdf_run_processor; -static void pdf_run_xobject(fz_context *ctx, pdf_run_processor *proc, pdf_obj *xobj, pdf_obj *page_resources, const fz_matrix *transform, int is_smask); +static void pdf_run_xobject(fz_context *ctx, pdf_run_processor *proc, pdf_obj *xobj, pdf_obj *page_resources, fz_matrix transform, int is_smask); enum { @@ -140,7 +140,7 @@ begin_softmask(fz_context *ctx, pdf_run_processor *pr, softmask_save *save) fz_try(ctx) { fz_begin_mask(ctx, pr->dev, &mask_bbox, gstate->luminosity, mask_colorspace, gstate->softmask_bc, &gstate->fill.color_params); - pdf_run_xobject(ctx, pr, softmask, save->page_resources, &fz_identity, 1); + pdf_run_xobject(ctx, pr, softmask, save->page_resources, fz_identity, 1); } fz_always(ctx) fz_drop_colorspace(ctx, mask_colorspace); @@ -214,7 +214,7 @@ pdf_show_shade(fz_context *ctx, pdf_run_processor *pr, fz_shade *shd) /* FIXME: The gstate->ctm in the next line may be wrong; maybe * it should be the parent gstates ctm? */ - fz_fill_shade(ctx, pr->dev, shd, &gstate->ctm, gstate->fill.alpha, &gstate->fill.color_params); + fz_fill_shade(ctx, pr->dev, shd, gstate->ctm, gstate->fill.alpha, &gstate->fill.color_params); pdf_end_group(ctx, pr, &softmask); } @@ -428,7 +428,7 @@ pdf_show_pattern(fz_context *ctx, pdf_run_processor *pr, pdf_pattern *pat, pdf_g if (0) #endif { - int cached = fz_begin_tile_id(ctx, pr->dev, &local_area, &pat->bbox, pat->xstep, pat->ystep, &ptm, id); + int cached = fz_begin_tile_id(ctx, pr->dev, &local_area, &pat->bbox, pat->xstep, pat->ystep, ptm, id); if (cached) { fz_end_tile(ctx, pr->dev); @@ -499,7 +499,7 @@ pdf_show_pattern(fz_context *ctx, pdf_run_processor *pr, pdf_pattern *pat, pdf_g } static void -pdf_show_image_imp(fz_context *ctx, pdf_run_processor *pr, fz_image *image, fz_matrix *image_ctm, fz_rect *bbox) +pdf_show_image_imp(fz_context *ctx, pdf_run_processor *pr, fz_image *image, fz_matrix image_ctm, fz_rect *bbox) { pdf_gstate *gstate = pr->gstate + pr->gtop; @@ -526,7 +526,7 @@ pdf_show_image_imp(fz_context *ctx, pdf_run_processor *pr, fz_image *image, fz_m { fz_clip_image_mask(ctx, pr->dev, image, image_ctm, bbox); fz_try(ctx) - fz_fill_shade(ctx, pr->dev, gstate->fill.shade, &pr->gstate[gstate->fill.gstate_num].ctm, gstate->fill.alpha, &gstate->fill.color_params); + fz_fill_shade(ctx, pr->dev, gstate->fill.shade, pr->gstate[gstate->fill.gstate_num].ctm, gstate->fill.alpha, &gstate->fill.color_params); fz_always(ctx) fz_pop_clip(ctx, pr->dev); fz_catch(ctx) @@ -555,7 +555,7 @@ pdf_show_image(fz_context *ctx, pdf_run_processor *pr, fz_image *image) fz_begin_group(ctx, pr->dev, &bbox, NULL, 0, 0, gstate->blendmode, 1); fz_try(ctx) - fz_clip_image_mask(ctx, pr->dev, image->mask, &image_ctm, &bbox); + fz_clip_image_mask(ctx, pr->dev, image->mask, image_ctm, &bbox); fz_catch(ctx) { fz_end_group(ctx, pr->dev); @@ -563,7 +563,7 @@ pdf_show_image(fz_context *ctx, pdf_run_processor *pr, fz_image *image) } fz_try(ctx) - pdf_show_image_imp(ctx, pr, image, &image_ctm, &bbox); + pdf_show_image_imp(ctx, pr, image, image_ctm, &bbox); fz_always(ctx) { fz_pop_clip(ctx, pr->dev); @@ -574,9 +574,9 @@ pdf_show_image(fz_context *ctx, pdf_run_processor *pr, fz_image *image) } else if (image->mask) { - fz_clip_image_mask(ctx, pr->dev, image->mask, &image_ctm, &bbox); + fz_clip_image_mask(ctx, pr->dev, image->mask, image_ctm, &bbox); fz_try(ctx) - pdf_show_image_imp(ctx, pr, image, &image_ctm, &bbox); + pdf_show_image_imp(ctx, pr, image, image_ctm, &bbox); fz_always(ctx) fz_pop_clip(ctx, pr->dev); fz_catch(ctx) @@ -589,7 +589,7 @@ pdf_show_image(fz_context *ctx, pdf_run_processor *pr, fz_image *image) gstate = pdf_begin_group(ctx, pr, &bbox, &softmask); fz_try(ctx) - pdf_show_image_imp(ctx, pr, image, &image_ctm, &bbox); + pdf_show_image_imp(ctx, pr, image, image_ctm, &bbox); fz_always(ctx) pdf_end_group(ctx, pr, &softmask); fz_catch(ctx) @@ -660,13 +660,13 @@ pdf_show_path(fz_context *ctx, pdf_run_processor *pr, int doclose, int dofill, i case PDF_MAT_NONE: break; case PDF_MAT_COLOR: - fz_fill_path(ctx, pr->dev, path, even_odd, &gstate->ctm, + fz_fill_path(ctx, pr->dev, path, even_odd, gstate->ctm, gstate->fill.colorspace, gstate->fill.v, gstate->fill.alpha, &gstate->fill.color_params); break; case PDF_MAT_PATTERN: if (gstate->fill.pattern) { - fz_clip_path(ctx, pr->dev, path, even_odd, &gstate->ctm, &bbox); + fz_clip_path(ctx, pr->dev, path, even_odd, gstate->ctm, &bbox); pdf_show_pattern(ctx, pr, gstate->fill.pattern, &pr->gstate[gstate->fill.gstate_num], &bbox, PDF_FILL); fz_pop_clip(ctx, pr->dev); } @@ -674,9 +674,9 @@ pdf_show_path(fz_context *ctx, pdf_run_processor *pr, int doclose, int dofill, i case PDF_MAT_SHADE: if (gstate->fill.shade) { - fz_clip_path(ctx, pr->dev, path, even_odd, &gstate->ctm, &bbox); + fz_clip_path(ctx, pr->dev, path, even_odd, gstate->ctm, &bbox); /* The cluster and page 2 of patterns.pdf shows that fz_fill_shade should NOT be called with gstate->ctm. */ - fz_fill_shade(ctx, pr->dev, gstate->fill.shade, &pr->gstate[gstate->fill.gstate_num].ctm, gstate->fill.alpha, &gstate->fill.color_params); + fz_fill_shade(ctx, pr->dev, gstate->fill.shade, pr->gstate[gstate->fill.gstate_num].ctm, gstate->fill.alpha, &gstate->fill.color_params); fz_pop_clip(ctx, pr->dev); } break; @@ -690,13 +690,13 @@ pdf_show_path(fz_context *ctx, pdf_run_processor *pr, int doclose, int dofill, i case PDF_MAT_NONE: break; case PDF_MAT_COLOR: - fz_stroke_path(ctx, pr->dev, path, gstate->stroke_state, &gstate->ctm, + fz_stroke_path(ctx, pr->dev, path, gstate->stroke_state, gstate->ctm, gstate->stroke.colorspace, gstate->stroke.v, gstate->stroke.alpha, &gstate->stroke.color_params); break; case PDF_MAT_PATTERN: if (gstate->stroke.pattern) { - fz_clip_stroke_path(ctx, pr->dev, path, gstate->stroke_state, &gstate->ctm, &bbox); + fz_clip_stroke_path(ctx, pr->dev, path, gstate->stroke_state, gstate->ctm, &bbox); pdf_show_pattern(ctx, pr, gstate->stroke.pattern, &pr->gstate[gstate->stroke.gstate_num], &bbox, PDF_STROKE); fz_pop_clip(ctx, pr->dev); } @@ -704,8 +704,8 @@ pdf_show_path(fz_context *ctx, pdf_run_processor *pr, int doclose, int dofill, i case PDF_MAT_SHADE: if (gstate->stroke.shade) { - fz_clip_stroke_path(ctx, pr->dev, path, gstate->stroke_state, &gstate->ctm, &bbox); - fz_fill_shade(ctx, pr->dev, gstate->stroke.shade, &pr->gstate[gstate->stroke.gstate_num].ctm, gstate->stroke.alpha, &gstate->stroke.color_params); + fz_clip_stroke_path(ctx, pr->dev, path, gstate->stroke_state, gstate->ctm, &bbox); + fz_fill_shade(ctx, pr->dev, gstate->stroke.shade, pr->gstate[gstate->stroke.gstate_num].ctm, gstate->stroke.alpha, &gstate->stroke.color_params); fz_pop_clip(ctx, pr->dev); } break; @@ -722,7 +722,7 @@ pdf_show_path(fz_context *ctx, pdf_run_processor *pr, int doclose, int dofill, i { gstate = pr->gstate + pr->gtop; /* in case it was changed by pdf_begin_group */ gstate->clip_depth++; - fz_clip_path(ctx, pr->dev, path, pr->clip_even_odd, &gstate->ctm, &bbox); + fz_clip_path(ctx, pr->dev, path, pr->clip_even_odd, gstate->ctm, &bbox); pr->clip = 0; } } @@ -804,7 +804,7 @@ pdf_flush_text(fz_context *ctx, pdf_run_processor *pr) } if (doinvisible) - fz_ignore_text(ctx, pr->dev, text, &gstate->ctm); + fz_ignore_text(ctx, pr->dev, text, gstate->ctm); if (dofill) { @@ -813,13 +813,13 @@ pdf_flush_text(fz_context *ctx, pdf_run_processor *pr) case PDF_MAT_NONE: break; case PDF_MAT_COLOR: - fz_fill_text(ctx, pr->dev, text, &gstate->ctm, + fz_fill_text(ctx, pr->dev, text, gstate->ctm, gstate->fill.colorspace, gstate->fill.v, gstate->fill.alpha, &gstate->fill.color_params); break; case PDF_MAT_PATTERN: if (gstate->fill.pattern) { - fz_clip_text(ctx, pr->dev, text, &gstate->ctm, &tb); + fz_clip_text(ctx, pr->dev, text, gstate->ctm, &tb); pdf_show_pattern(ctx, pr, gstate->fill.pattern, &pr->gstate[gstate->fill.gstate_num], &tb, PDF_FILL); fz_pop_clip(ctx, pr->dev); } @@ -827,9 +827,9 @@ pdf_flush_text(fz_context *ctx, pdf_run_processor *pr) case PDF_MAT_SHADE: if (gstate->fill.shade) { - fz_clip_text(ctx, pr->dev, text, &gstate->ctm, &tb); + fz_clip_text(ctx, pr->dev, text, gstate->ctm, &tb); /* Page 2 of patterns.pdf shows that fz_fill_shade should NOT be called with gstate->ctm */ - fz_fill_shade(ctx, pr->dev, gstate->fill.shade, &pr->gstate[gstate->fill.gstate_num].ctm, gstate->fill.alpha, &gstate->fill.color_params); + fz_fill_shade(ctx, pr->dev, gstate->fill.shade, pr->gstate[gstate->fill.gstate_num].ctm, gstate->fill.alpha, &gstate->fill.color_params); fz_pop_clip(ctx, pr->dev); } break; @@ -843,13 +843,13 @@ pdf_flush_text(fz_context *ctx, pdf_run_processor *pr) case PDF_MAT_NONE: break; case PDF_MAT_COLOR: - fz_stroke_text(ctx, pr->dev, text, gstate->stroke_state, &gstate->ctm, + fz_stroke_text(ctx, pr->dev, text, gstate->stroke_state, gstate->ctm, gstate->stroke.colorspace, gstate->stroke.v, gstate->stroke.alpha, &gstate->stroke.color_params); break; case PDF_MAT_PATTERN: if (gstate->stroke.pattern) { - fz_clip_stroke_text(ctx, pr->dev, text, gstate->stroke_state, &gstate->ctm, &tb); + fz_clip_stroke_text(ctx, pr->dev, text, gstate->stroke_state, gstate->ctm, &tb); pdf_show_pattern(ctx, pr, gstate->stroke.pattern, &pr->gstate[gstate->stroke.gstate_num], &tb, PDF_STROKE); fz_pop_clip(ctx, pr->dev); } @@ -857,8 +857,8 @@ pdf_flush_text(fz_context *ctx, pdf_run_processor *pr) case PDF_MAT_SHADE: if (gstate->stroke.shade) { - fz_clip_stroke_text(ctx, pr->dev, text, gstate->stroke_state, &gstate->ctm, &tb); - fz_fill_shade(ctx, pr->dev, gstate->stroke.shade, &pr->gstate[gstate->stroke.gstate_num].ctm, gstate->stroke.alpha, &gstate->stroke.color_params); + fz_clip_stroke_text(ctx, pr->dev, text, gstate->stroke_state, gstate->ctm, &tb); + fz_fill_shade(ctx, pr->dev, gstate->stroke.shade, pr->gstate[gstate->stroke.gstate_num].ctm, gstate->stroke.alpha, &gstate->stroke.color_params); fz_pop_clip(ctx, pr->dev); } break; @@ -874,7 +874,7 @@ pdf_flush_text(fz_context *ctx, pdf_run_processor *pr) if (doclip) { gstate->clip_depth++; - fz_clip_text(ctx, pr->dev, text, &gstate->ctm, &tb); + fz_clip_text(ctx, pr->dev, text, gstate->ctm, &tb); } } fz_always(ctx) @@ -920,7 +920,7 @@ pdf_show_char(fz_context *ctx, pdf_run_processor *pr, int cid) * type3 glyphs that seem to inherit current graphics * attributes, or type 3 glyphs within type3 glyphs). */ fz_matrix composed = fz_concat(trm, gstate->ctm); - fz_render_t3_glyph_direct(ctx, pr->dev, fontdesc->font, gid, &composed, gstate, pr->nested_depth, pr->default_cs); + fz_render_t3_glyph_direct(ctx, pr->dev, fontdesc->font, gid, composed, gstate, pr->nested_depth, pr->default_cs); /* Render text invisibly so that it can still be extracted. */ pr->tos.text_mode = 3; } @@ -1036,9 +1036,9 @@ pdf_show_text(fz_context *ctx, pdf_run_processor *pr, pdf_obj *text) */ static void -pdf_init_gstate(fz_context *ctx, pdf_gstate *gs, const fz_matrix *ctm) +pdf_init_gstate(fz_context *ctx, pdf_gstate *gs, fz_matrix ctm) { - gs->ctm = *ctm; + gs->ctm = ctm; gs->clip_depth = 0; gs->stroke_state = fz_new_stroke_state(ctx); @@ -1184,13 +1184,12 @@ pdf_set_pattern(fz_context *ctx, pdf_run_processor *pr, int what, pdf_pattern *p } static void -pdf_run_xobject(fz_context *ctx, pdf_run_processor *proc, pdf_obj *xobj, pdf_obj *page_resources, const fz_matrix *transform, int is_smask) +pdf_run_xobject(fz_context *ctx, pdf_run_processor *proc, pdf_obj *xobj, pdf_obj *page_resources, fz_matrix transform, int is_smask) { pdf_run_processor *pr = (pdf_run_processor *)proc; pdf_gstate *gstate = NULL; int oldtop = 0; int oldbot = -1; - fz_matrix local_transform = *transform; softmask_save softmask = { NULL }; int gparent_save; fz_matrix gparent_save_ctm; @@ -1230,8 +1229,8 @@ pdf_run_xobject(fz_context *ctx, pdf_run_processor *proc, pdf_obj *xobj, pdf_obj transparency = pdf_xobject_transparency(ctx, xobj); /* apply xobject's transform matrix */ - local_transform = fz_concat(xobj_matrix, local_transform); - gstate->ctm = fz_concat(local_transform, gstate->ctm); + transform = fz_concat(xobj_matrix, transform); + gstate->ctm = fz_concat(transform, gstate->ctm); /* The gparent is updated with the modified ctm */ gparent_save_ctm = pr->gstate[pr->gparent].ctm; @@ -1994,7 +1993,7 @@ static void pdf_run_Do_image(fz_context *ctx, pdf_processor *proc, const char *n static void pdf_run_Do_form(fz_context *ctx, pdf_processor *proc, const char *name, pdf_obj *xobj, pdf_obj *page_resources) { - pdf_run_xobject(ctx, (pdf_run_processor*)proc, xobj, page_resources, &fz_identity, 0); + pdf_run_xobject(ctx, (pdf_run_processor*)proc, xobj, page_resources, fz_identity, 0); } /* marked content */ @@ -2081,7 +2080,7 @@ pdf_drop_run_processor(fz_context *ctx, pdf_processor *proc) } pdf_processor * -pdf_new_run_processor(fz_context *ctx, fz_device *dev, const fz_matrix *ctm, const char *usage, pdf_gstate *gstate, int nested, fz_default_colorspaces *default_cs) +pdf_new_run_processor(fz_context *ctx, fz_device *dev, fz_matrix ctm, const char *usage, pdf_gstate *gstate, int nested, fz_default_colorspaces *default_cs) { pdf_run_processor *proc = pdf_new_processor(ctx, sizeof *proc); { @@ -2238,7 +2237,7 @@ pdf_new_run_processor(fz_context *ctx, fz_device *dev, const fz_matrix *ctm, con { pdf_copy_gstate(ctx, &proc->gstate[0], gstate); proc->gstate[0].clip_depth = 0; - proc->gstate[0].ctm = *ctm; + proc->gstate[0].ctm = ctm; } proc->gtop = 0; proc->gbot = 0; diff --git a/source/pdf/pdf-page.c b/source/pdf/pdf-page.c index f8131b2c..3d2c46a0 100644 --- a/source/pdf/pdf-page.c +++ b/source/pdf/pdf-page.c @@ -1082,7 +1082,7 @@ pdf_load_page(fz_context *ctx, pdf_document *doc, int number) fz_rect page_mediabox; fz_matrix page_ctm; pdf_page_transform(ctx, page, &page_mediabox, &page_ctm); - page->links = pdf_load_link_annots(ctx, doc, obj, number, &page_ctm); + page->links = pdf_load_link_annots(ctx, doc, obj, number, page_ctm); pdf_load_annots(ctx, page, obj); } } diff --git a/source/pdf/pdf-run.c b/source/pdf/pdf-run.c index 15339373..ae936253 100644 --- a/source/pdf/pdf-run.c +++ b/source/pdf/pdf-run.c @@ -2,9 +2,9 @@ #include "mupdf/pdf.h" static void -pdf_run_annot_with_usage(fz_context *ctx, pdf_document *doc, pdf_page *page, pdf_annot *annot, fz_device *dev, const fz_matrix *ctm, const char *usage, fz_cookie *cookie) +pdf_run_annot_with_usage(fz_context *ctx, pdf_document *doc, pdf_page *page, pdf_annot *annot, fz_device *dev, fz_matrix ctm, const char *usage, fz_cookie *cookie) { - fz_matrix local_ctm, page_ctm; + fz_matrix page_ctm; fz_rect mediabox; pdf_processor *proc = NULL; fz_default_colorspaces *default_cs; @@ -16,11 +16,11 @@ pdf_run_annot_with_usage(fz_context *ctx, pdf_document *doc, pdf_page *page, pdf fz_set_default_colorspaces(ctx, dev, default_cs); pdf_page_transform(ctx, page, &mediabox, &page_ctm); - local_ctm = fz_concat(page_ctm, *ctm); + ctm = fz_concat(page_ctm, ctm); fz_try(ctx) { - proc = pdf_new_run_processor(ctx, dev, &local_ctm, usage, NULL, 0, default_cs); + proc = pdf_new_run_processor(ctx, dev, ctm, usage, NULL, 0, default_cs); pdf_process_annot(ctx, proc, doc, page, annot, cookie); pdf_close_processor(ctx, proc); } @@ -34,9 +34,9 @@ pdf_run_annot_with_usage(fz_context *ctx, pdf_document *doc, pdf_page *page, pdf } static void -pdf_run_page_contents_with_usage(fz_context *ctx, pdf_document *doc, pdf_page *page, fz_device *dev, const fz_matrix *ctm, const char *usage, fz_cookie *cookie) +pdf_run_page_contents_with_usage(fz_context *ctx, pdf_document *doc, pdf_page *page, fz_device *dev, fz_matrix ctm, const char *usage, fz_cookie *cookie) { - fz_matrix local_ctm, page_ctm; + fz_matrix page_ctm; pdf_obj *resources; pdf_obj *contents; fz_rect mediabox; @@ -54,8 +54,8 @@ pdf_run_page_contents_with_usage(fz_context *ctx, pdf_document *doc, pdf_page *p fz_try(ctx) { pdf_page_transform(ctx, page, &mediabox, &page_ctm); - local_ctm = fz_concat(page_ctm, *ctm); - mediabox = fz_transform_rect(mediabox, local_ctm); + ctm = fz_concat(page_ctm, ctm); + mediabox = fz_transform_rect(mediabox, ctm); resources = pdf_page_resources(ctx, page); contents = pdf_page_contents(ctx, page); @@ -83,7 +83,7 @@ pdf_run_page_contents_with_usage(fz_context *ctx, pdf_document *doc, pdf_page *p colorspace = NULL; } - proc = pdf_new_run_processor(ctx, dev, &local_ctm, usage, NULL, 0, default_cs); + proc = pdf_new_run_processor(ctx, dev, ctm, usage, NULL, 0, default_cs); pdf_process_contents(ctx, proc, doc, resources, contents, cookie); pdf_close_processor(ctx, proc); } @@ -102,7 +102,7 @@ pdf_run_page_contents_with_usage(fz_context *ctx, pdf_document *doc, pdf_page *p fz_end_group(ctx, dev); } -void pdf_run_page_contents(fz_context *ctx, pdf_page *page, fz_device *dev, const fz_matrix *ctm, fz_cookie *cookie) +void pdf_run_page_contents(fz_context *ctx, pdf_page *page, fz_device *dev, fz_matrix ctm, fz_cookie *cookie) { pdf_document *doc = page->doc; int nocache; @@ -128,7 +128,7 @@ void pdf_run_page_contents(fz_context *ctx, pdf_page *page, fz_device *dev, cons fz_throw(ctx, FZ_ERROR_TRYLATER, "incomplete rendering"); } -void pdf_run_annot(fz_context *ctx, pdf_annot *annot, fz_device *dev, const fz_matrix *ctm, fz_cookie *cookie) +void pdf_run_annot(fz_context *ctx, pdf_annot *annot, fz_device *dev, fz_matrix ctm, fz_cookie *cookie) { pdf_page *page = annot->page; pdf_document *doc = page->doc; @@ -155,7 +155,7 @@ void pdf_run_annot(fz_context *ctx, pdf_annot *annot, fz_device *dev, const fz_m } static void -pdf_run_page_annots_with_usage(fz_context *ctx, pdf_document *doc, pdf_page *page, fz_device *dev, const fz_matrix *ctm, const char *usage, fz_cookie *cookie) +pdf_run_page_annots_with_usage(fz_context *ctx, pdf_document *doc, pdf_page *page, fz_device *dev, fz_matrix ctm, const char *usage, fz_cookie *cookie) { pdf_annot *annot; @@ -182,7 +182,7 @@ pdf_run_page_annots_with_usage(fz_context *ctx, pdf_document *doc, pdf_page *pag } void -pdf_run_page_with_usage(fz_context *ctx, pdf_document *doc, pdf_page *page, fz_device *dev, const fz_matrix *ctm, const char *usage, fz_cookie *cookie) +pdf_run_page_with_usage(fz_context *ctx, pdf_document *doc, pdf_page *page, fz_device *dev, fz_matrix ctm, const char *usage, fz_cookie *cookie) { int nocache = !!(dev->hints & FZ_NO_CACHE); @@ -207,14 +207,14 @@ pdf_run_page_with_usage(fz_context *ctx, pdf_document *doc, pdf_page *page, fz_d } void -pdf_run_page(fz_context *ctx, pdf_page *page, fz_device *dev, const fz_matrix *ctm, fz_cookie *cookie) +pdf_run_page(fz_context *ctx, pdf_page *page, fz_device *dev, fz_matrix ctm, fz_cookie *cookie) { pdf_document *doc = page->doc; pdf_run_page_with_usage(ctx, doc, page, dev, ctm, "View", cookie); } void -pdf_run_glyph(fz_context *ctx, pdf_document *doc, pdf_obj *resources, fz_buffer *contents, fz_device *dev, const fz_matrix *ctm, void *gstate, int nested_depth, fz_default_colorspaces *default_cs) +pdf_run_glyph(fz_context *ctx, pdf_document *doc, pdf_obj *resources, fz_buffer *contents, fz_device *dev, fz_matrix ctm, void *gstate, int nested_depth, fz_default_colorspaces *default_cs) { pdf_processor *proc; diff --git a/source/pdf/pdf-shade.c b/source/pdf/pdf-shade.c index d34e8440..13c1ebc8 100644 --- a/source/pdf/pdf-shade.c +++ b/source/pdf/pdf-shade.c @@ -293,7 +293,7 @@ pdf_load_type7_shade(fz_context *ctx, pdf_document *doc, fz_shade *shade, pdf_ob /* Load all of the shading dictionary parameters, then switch on the shading type. */ static fz_shade * -pdf_load_shading_dict(fz_context *ctx, pdf_document *doc, pdf_obj *dict, const fz_matrix *transform) +pdf_load_shading_dict(fz_context *ctx, pdf_document *doc, pdf_obj *dict, fz_matrix transform) { fz_shade *shade = NULL; pdf_function *func[FZ_MAX_COLORS] = { NULL }; @@ -314,7 +314,7 @@ pdf_load_shading_dict(fz_context *ctx, pdf_document *doc, pdf_obj *dict, const f shade->type = FZ_MESH_TYPE4; shade->use_background = 0; shade->use_function = 0; - shade->matrix = *transform; + shade->matrix = transform; shade->bbox = fz_infinite_rect; shade->colorspace = NULL; @@ -458,13 +458,13 @@ pdf_load_shading(fz_context *ctx, pdf_document *doc, pdf_obj *dict) if (!obj) fz_throw(ctx, FZ_ERROR_SYNTAX, "missing shading dictionary"); - shade = pdf_load_shading_dict(ctx, doc, obj, &mat); + shade = pdf_load_shading_dict(ctx, doc, obj, mat); } /* Naked shading dictionary */ else { - shade = pdf_load_shading_dict(ctx, doc, dict, &fz_identity); + shade = pdf_load_shading_dict(ctx, doc, dict, fz_identity); } pdf_store_item(ctx, dict, shade, fz_shade_size(ctx, shade)); diff --git a/source/pdf/pdf-type3.c b/source/pdf/pdf-type3.c index 9d32797e..d88d687a 100644 --- a/source/pdf/pdf-type3.c +++ b/source/pdf/pdf-type3.c @@ -4,7 +4,7 @@ #include "../fitz/font-imp.h" static void -pdf_run_glyph_func(fz_context *ctx, void *doc, void *rdb, fz_buffer *contents, fz_device *dev, const fz_matrix *ctm, void *gstate, int nested_depth, fz_default_colorspaces *default_cs) +pdf_run_glyph_func(fz_context *ctx, void *doc, void *rdb, fz_buffer *contents, fz_device *dev, fz_matrix ctm, void *gstate, int nested_depth, fz_default_colorspaces *default_cs) { pdf_run_glyph(ctx, doc, (pdf_obj *)rdb, contents, dev, ctm, gstate, nested_depth, default_cs); } diff --git a/source/svg/svg-doc.c b/source/svg/svg-doc.c index 89ff148c..112368cb 100644 --- a/source/svg/svg-doc.c +++ b/source/svg/svg-doc.c @@ -35,7 +35,7 @@ svg_bound_page(fz_context *ctx, fz_page *page_) } static void -svg_run_page(fz_context *ctx, fz_page *page_, fz_device *dev, const fz_matrix *ctm, fz_cookie *cookie) +svg_run_page(fz_context *ctx, fz_page *page_, fz_device *dev, fz_matrix ctm, fz_cookie *cookie) { svg_page *page = (svg_page*)page_; svg_document *doc = page->doc; diff --git a/source/svg/svg-imp.h b/source/svg/svg-imp.h index ad86b536..614304b8 100644 --- a/source/svg/svg-imp.h +++ b/source/svg/svg-imp.h @@ -20,7 +20,7 @@ float svg_parse_length(const char *str, float percent, float font_size); float svg_parse_angle(const char *str); void svg_parse_color(fz_context *ctx, svg_document *doc, char *str, float *rgb); -void svg_parse_transform(fz_context *ctx, svg_document *doc, char *str, fz_matrix *ctm); +fz_matrix svg_parse_transform(fz_context *ctx, svg_document *doc, char *str, fz_matrix transform); int svg_is_whitespace_or_comma(int c); int svg_is_whitespace(int c); @@ -30,6 +30,6 @@ int svg_is_digit(int c); /* Graphics content parsing. */ void svg_parse_document_bounds(fz_context *ctx, svg_document *doc, fz_xml *root); -void svg_run_document(fz_context *ctx, svg_document *doc, fz_xml *root, fz_device *dev, const fz_matrix *ctm); +void svg_run_document(fz_context *ctx, svg_document *doc, fz_xml *root, fz_device *dev, fz_matrix ctm); #endif diff --git a/source/svg/svg-parse.c b/source/svg/svg-parse.c index 5c7fc33a..c5b0a7db 100644 --- a/source/svg/svg-parse.c +++ b/source/svg/svg-parse.c @@ -117,8 +117,8 @@ svg_parse_angle(const char *str) } /* Coordinate transformations */ -void -svg_parse_transform(fz_context *ctx, svg_document *doc, char *str, fz_matrix *transform) +fz_matrix +svg_parse_transform(fz_context *ctx, svg_document *doc, char *str, fz_matrix transform) { char keyword[20]; int keywordlen; @@ -214,7 +214,7 @@ svg_parse_transform(fz_context *ctx, svg_document *doc, char *str, fz_matrix *tr m.e = args[4]; m.f = args[5]; - *transform = fz_concat(*transform, m); + transform = fz_concat(transform, m); } else if (!strcmp(keyword, "translate")) @@ -222,15 +222,15 @@ svg_parse_transform(fz_context *ctx, svg_document *doc, char *str, fz_matrix *tr if (nargs != 2) fz_throw(ctx, FZ_ERROR_SYNTAX, "wrong number of arguments to translate(): %d", nargs); - *transform = fz_pre_translate(*transform, args[0], args[1]); + transform = fz_pre_translate(transform, args[0], args[1]); } else if (!strcmp(keyword, "scale")) { if (nargs == 1) - *transform = fz_pre_scale(*transform, args[0], args[0]); + transform = fz_pre_scale(transform, args[0], args[0]); else if (nargs == 2) - *transform = fz_pre_scale(*transform, args[0], args[1]); + transform = fz_pre_scale(transform, args[0], args[1]); else fz_throw(ctx, FZ_ERROR_SYNTAX, "wrong number of arguments to scale(): %d", nargs); } @@ -239,7 +239,7 @@ svg_parse_transform(fz_context *ctx, svg_document *doc, char *str, fz_matrix *tr { if (nargs != 1) fz_throw(ctx, FZ_ERROR_SYNTAX, "wrong number of arguments to rotate(): %d", nargs); - *transform = fz_pre_rotate(*transform, args[0]); + transform = fz_pre_rotate(transform, args[0]); } else if (!strcmp(keyword, "skewX")) @@ -256,7 +256,7 @@ svg_parse_transform(fz_context *ctx, svg_document *doc, char *str, fz_matrix *tr m.e = 0; m.f = 0; - *transform = fz_concat(*transform, m); + transform = fz_concat(transform, m); } else if (!strcmp(keyword, "skewY")) @@ -273,7 +273,7 @@ svg_parse_transform(fz_context *ctx, svg_document *doc, char *str, fz_matrix *tr m.e = 0; m.f = 0; - *transform = fz_concat(*transform, m); + transform = fz_concat(transform, m); } else @@ -281,4 +281,6 @@ svg_parse_transform(fz_context *ctx, svg_document *doc, char *str, fz_matrix *tr fz_throw(ctx, FZ_ERROR_SYNTAX, "unknown transform function: %s", keyword); } } + + return transform; } diff --git a/source/svg/svg-run.c b/source/svg/svg-run.c index a3e6193f..94297866 100644 --- a/source/svg/svg-run.c +++ b/source/svg/svg-run.c @@ -39,13 +39,13 @@ static void svg_run_element(fz_context *ctx, fz_device *dev, svg_document *doc, static void svg_fill(fz_context *ctx, fz_device *dev, svg_document *doc, fz_path *path, svg_state *state) { float opacity = state->opacity * state->fill_opacity; - fz_fill_path(ctx, dev, path, state->fill_rule, &state->transform, fz_device_rgb(ctx), state->fill_color, opacity, NULL); + fz_fill_path(ctx, dev, path, state->fill_rule, state->transform, fz_device_rgb(ctx), state->fill_color, opacity, NULL); } static void svg_stroke(fz_context *ctx, fz_device *dev, svg_document *doc, fz_path *path, svg_state *state) { float opacity = state->opacity * state->stroke_opacity; - fz_stroke_path(ctx, dev, path, &state->stroke, &state->transform, fz_device_rgb(ctx), state->stroke_color, opacity, NULL); + fz_stroke_path(ctx, dev, path, &state->stroke, state->transform, fz_device_rgb(ctx), state->stroke_color, opacity, NULL); } static void svg_draw_path(fz_context *ctx, fz_device *dev, svg_document *doc, fz_path *path, svg_state *state) @@ -316,7 +316,7 @@ svg_run_polygon(fz_context *ctx, fz_device *dev, svg_document *doc, fz_xml *node } static void -svg_add_arc_segment(fz_context *ctx, fz_path *path, const fz_matrix *mtx, float th0, float th1, int iscw) +svg_add_arc_segment(fz_context *ctx, fz_path *path, fz_matrix mtx, float th0, float th1, int iscw) { float t, d; fz_point p; @@ -330,7 +330,7 @@ svg_add_arc_segment(fz_context *ctx, fz_path *path, const fz_matrix *mtx, float { for (t = th0 + d; t < th1 - d/2; t += d) { - p = fz_transform_point_xy(cosf(t), sinf(t), *mtx); + p = fz_transform_point_xy(cosf(t), sinf(t), mtx); fz_lineto(ctx, path, p.x, p.y); } } @@ -339,7 +339,7 @@ svg_add_arc_segment(fz_context *ctx, fz_path *path, const fz_matrix *mtx, float th0 += FZ_PI * 2; for (t = th0 - d; t > th1 + d/2; t -= d) { - p = fz_transform_point_xy(cosf(t), sinf(t), *mtx); + p = fz_transform_point_xy(cosf(t), sinf(t), mtx); fz_lineto(ctx, path, p.x, p.y); } } @@ -458,7 +458,7 @@ svg_add_arc(fz_context *ctx, fz_path *path, } mtx = fz_pre_scale(fz_pre_rotate(fz_translate(cx, cy), rotation_angle), rx, ry); - svg_add_arc_segment(ctx, path, &mtx, th1, th1 + dth, is_clockwise); + svg_add_arc_segment(ctx, path, mtx, th1, th1 + dth, is_clockwise); fz_lineto(ctx, path, point_x, point_y); } @@ -842,7 +842,6 @@ void svg_parse_common(fz_context *ctx, svg_document *doc, fz_xml *node, svg_state *state) { fz_stroke_state *stroke = &state->stroke; - fz_matrix *transform = &state->transform; char *transform_att = fz_xml_att(node, "transform"); @@ -872,7 +871,7 @@ svg_parse_common(fz_context *ctx, svg_document *doc, fz_xml *node, svg_state *st if (transform_att) { - svg_parse_transform(ctx, doc, transform_att, transform); + state->transform = svg_parse_transform(ctx, doc, transform_att, state->transform); } if (font_size_att) @@ -1156,14 +1155,14 @@ svg_parse_document_bounds(fz_context *ctx, svg_document *doc, fz_xml *root) } void -svg_run_document(fz_context *ctx, svg_document *doc, fz_xml *root, fz_device *dev, const fz_matrix *ctm) +svg_run_document(fz_context *ctx, svg_document *doc, fz_xml *root, fz_device *dev, fz_matrix ctm) { svg_state state; svg_parse_document_bounds(ctx, doc, root); /* Initial graphics state */ - state.transform = *ctm; + state.transform = ctm; state.stroke = fz_default_stroke_state; state.viewport_w = DEF_WIDTH; diff --git a/source/tools/mjsgen.c b/source/tools/mjsgen.c index 04c0a435..dc667e10 100644 --- a/source/tools/mjsgen.c +++ b/source/tools/mjsgen.c @@ -113,7 +113,7 @@ static void processpage(fz_context *ctx, FILE *output, fz_document *doc, int pag int w, h, len; int type = pdf_widget_type(ctx, widget); - pdf_bound_widget(ctx, widget, &rect); + rect = pdf_bound_widget(ctx, widget); w = (rect.x1 - rect.x0); h = (rect.y1 - rect.y0); ++count; diff --git a/source/tools/muconvert.c b/source/tools/muconvert.c index ed4b4615..e68a77c7 100644 --- a/source/tools/muconvert.c +++ b/source/tools/muconvert.c @@ -77,7 +77,7 @@ static void runpage(int number) { mediabox = fz_bound_page(ctx, page); dev = fz_begin_page(ctx, out, &mediabox); - fz_run_page(ctx, page, dev, &fz_identity, NULL); + fz_run_page(ctx, page, dev, fz_identity, NULL); } fz_always(ctx) { diff --git a/source/tools/mudraw.c b/source/tools/mudraw.c index 2e1e759d..828db0d0 100644 --- a/source/tools/mudraw.c +++ b/source/tools/mudraw.c @@ -461,7 +461,7 @@ file_level_trailers(fz_context *ctx) } -static void drawband(fz_context *ctx, fz_page *page, fz_display_list *list, const fz_matrix *ctm, const fz_rect *tbounds, fz_cookie *cookie, int band_start, fz_pixmap *pix, fz_bitmap **bit) +static void drawband(fz_context *ctx, fz_page *page, fz_display_list *list, fz_matrix ctm, const fz_rect *tbounds, fz_cookie *cookie, int band_start, fz_pixmap *pix, fz_bitmap **bit) { fz_device *dev = NULL; @@ -476,7 +476,7 @@ static void drawband(fz_context *ctx, fz_page *page, fz_display_list *list, cons else fz_clear_pixmap_with_value(ctx, pix, 255); - dev = fz_new_draw_device_with_proof(ctx, NULL, pix, proof_cs); + dev = fz_new_draw_device_with_proof(ctx, fz_identity, pix, proof_cs); if (lowmemory) fz_enable_device_hints(ctx, dev, FZ_NO_CACHE); if (alphabits_graphics == 0) @@ -538,9 +538,9 @@ static void dodrawpage(fz_context *ctx, fz_page *page, fz_display_list *list, in if (lowmemory) fz_enable_device_hints(ctx, dev, FZ_NO_CACHE); if (list) - fz_run_display_list(ctx, list, dev, &fz_identity, &fz_infinite_rect, cookie); + fz_run_display_list(ctx, list, dev, fz_identity, &fz_infinite_rect, cookie); else - fz_run_page(ctx, page, dev, &fz_identity, cookie); + fz_run_page(ctx, page, dev, fz_identity, cookie); fz_write_printf(ctx, out, "</page>\n"); fz_close_device(ctx, dev); } @@ -578,9 +578,9 @@ static void dodrawpage(fz_context *ctx, fz_page *page, fz_display_list *list, in if (lowmemory) fz_enable_device_hints(ctx, dev, FZ_NO_CACHE); if (list) - fz_run_display_list(ctx, list, dev, &ctm, &fz_infinite_rect, cookie); + fz_run_display_list(ctx, list, dev, ctm, &fz_infinite_rect, cookie); else - fz_run_page(ctx, page, dev, &ctm, cookie); + fz_run_page(ctx, page, dev, ctm, cookie); fz_close_device(ctx, dev); fz_drop_device(ctx, dev); dev = NULL; @@ -631,9 +631,9 @@ static void dodrawpage(fz_context *ctx, fz_page *page, fz_display_list *list, in dev = pdf_page_write(ctx, pdfout, &mediabox, &resources, &contents); if (list) - fz_run_display_list(ctx, list, dev, &fz_identity, NULL, cookie); + fz_run_display_list(ctx, list, dev, fz_identity, NULL, cookie); else - fz_run_page(ctx, page, dev, &fz_identity, cookie); + fz_run_page(ctx, page, dev, fz_identity, cookie); fz_close_device(ctx, dev); fz_drop_device(ctx, dev); dev = NULL; @@ -686,9 +686,9 @@ static void dodrawpage(fz_context *ctx, fz_page *page, fz_display_list *list, in if (lowmemory) fz_enable_device_hints(ctx, dev, FZ_NO_CACHE); if (list) - fz_run_display_list(ctx, list, dev, &ctm, &tbounds, cookie); + fz_run_display_list(ctx, list, dev, ctm, &tbounds, cookie); else - fz_run_page(ctx, page, dev, &ctm, cookie); + fz_run_page(ctx, page, dev, ctm, cookie); fz_close_device(ctx, dev); fz_close_output(ctx, out); } @@ -880,7 +880,7 @@ static void dodrawpage(fz_context *ctx, fz_page *page, fz_display_list *list, in cookie->errors += w->cookie.errors; } else - drawband(ctx, page, list, &ctm, &tbounds, cookie, band * band_height, pix, &bit); + drawband(ctx, page, list, ctm, &tbounds, cookie, band * band_height, pix, &bit); if (output) { @@ -1083,7 +1083,7 @@ static void drawpage(fz_context *ctx, fz_document *doc, int pagenum) dev = fz_new_list_device(ctx, list); if (lowmemory) fz_enable_device_hints(ctx, dev, FZ_NO_CACHE); - fz_run_page(ctx, page, dev, &fz_identity, &cookie); + fz_run_page(ctx, page, dev, fz_identity, &cookie); fz_close_device(ctx, dev); } fz_always(ctx) @@ -1115,9 +1115,9 @@ static void drawpage(fz_context *ctx, fz_document *doc, int pagenum) fz_try(ctx) { if (list) - fz_run_display_list(ctx, list, dev, &fz_identity, &fz_infinite_rect, NULL); + fz_run_display_list(ctx, list, dev, fz_identity, &fz_infinite_rect, NULL); else - fz_run_page(ctx, page, dev, &fz_identity, &cookie); + fz_run_page(ctx, page, dev, fz_identity, &cookie); fz_close_device(ctx, dev); } fz_always(ctx) @@ -1314,7 +1314,7 @@ static void worker_thread(void *arg) mu_wait_semaphore(&me->start); DEBUG_THREADS(("Worker %d woken for band %d\n", me->num, me->band)); if (me->band >= 0) - drawband(me->ctx, NULL, me->list, &me->ctm, &me->tbounds, &me->cookie, me->band * band_height, me->pix, &me->bit); + drawband(me->ctx, NULL, me->list, me->ctm, &me->tbounds, &me->cookie, me->band * band_height, me->pix, &me->bit); DEBUG_THREADS(("Worker %d completed band %d\n", me->num, me->band)); mu_trigger_semaphore(&me->stop); } diff --git a/source/tools/muraster.c b/source/tools/muraster.c index 956d420e..71e8dead 100644 --- a/source/tools/muraster.c +++ b/source/tools/muraster.c @@ -522,7 +522,7 @@ static int gettime(void) return (now.tv_sec - first.tv_sec) * 1000 + (now.tv_usec - first.tv_usec) / 1000; } -static int drawband(fz_context *ctx, fz_page *page, fz_display_list *list, const fz_matrix *ctm, const fz_rect *tbounds, fz_cookie *cookie, int band_start, fz_pixmap *pix, fz_bitmap **bit) +static int drawband(fz_context *ctx, fz_page *page, fz_display_list *list, fz_matrix ctm, const fz_rect *tbounds, fz_cookie *cookie, int band_start, fz_pixmap *pix, fz_bitmap **bit) { fz_device *dev = NULL; @@ -532,7 +532,7 @@ static int drawband(fz_context *ctx, fz_page *page, fz_display_list *list, const { fz_clear_pixmap_with_value(ctx, pix, 255); - dev = fz_new_draw_device(ctx, NULL, pix); + dev = fz_new_draw_device(ctx, fz_identity, pix); if (alphabits_graphics == 0) fz_enable_device_hints(ctx, dev, FZ_DONT_INTERPOLATE_IMAGES); if (list) @@ -598,7 +598,7 @@ static int dodrawpage(fz_context *ctx, int pagenum, fz_cookie *cookie, render_de if (remaining_height < band_height) ibounds.y1 = ibounds.y0 + remaining_height; remaining_height -= band_height; - w->pix = fz_new_pixmap_with_bbox(ctx, colorspace, &ibounds, NULL, 0); + w->pix = fz_new_pixmap_with_bbox(ctx, colorspace, ibounds, NULL, 0); fz_set_pixmap_resolution(ctx, w->pix, x_resolution, y_resolution); DEBUG_THREADS(("Worker %d, Pre-triggering band %d\n", band, band)); w->started = 1; @@ -609,7 +609,7 @@ static int dodrawpage(fz_context *ctx, int pagenum, fz_cookie *cookie, render_de } else { - pix = fz_new_pixmap_with_bbox(ctx, colorspace, &ibounds, NULL, 0); + pix = fz_new_pixmap_with_bbox(ctx, colorspace, ibounds, NULL, 0); fz_set_pixmap_resolution(ctx, pix, x_resolution, y_resolution); } fz_write_header(ctx, render->bander, pix->w, total_height, pix->n, pix->alpha, pix->xres, pix->yres, pagenum, pix->colorspace, pix->seps); @@ -636,7 +636,7 @@ static int dodrawpage(fz_context *ctx, int pagenum, fz_cookie *cookie, render_de cookie->errors += w->cookie.errors; } else - status = drawband(ctx, render->page, render->list, &ctm, &tbounds, cookie, band_start, pix, &bit); + status = drawband(ctx, render->page, render->list, ctm, &tbounds, cookie, band_start, pix, &bit); if (status != RENDER_OK) fz_throw(ctx, FZ_ERROR_GENERIC, "Render failed"); @@ -849,7 +849,7 @@ get_page_render_details(fz_context *ctx, fz_page *page, render_details *render) render->list = NULL; render->num_workers = num_workers; - fz_bound_page(ctx, page, &render->bounds); + render->bounds = fz_bound_page(ctx, page); page_width = (render->bounds.x1 - render->bounds.x0)/72; page_height = (render->bounds.y1 - render->bounds.y0)/72; @@ -916,9 +916,9 @@ get_page_render_details(fz_context *ctx, fz_page *page, render_details *render) rot = rotation; } - fz_pre_scale(fz_rotate(&render->ctm, rot), s_x, s_y); - render->tbounds = render->bounds; - fz_round_rect(&render->ibounds, fz_transform_rect(&render->tbounds, &render->ctm)); + render->ctm = fz_pre_scale(fz_rotate(rot), s_x, s_y); + render->tbounds = fz_transform_rect(render->bounds, render->ctm);; + render->ibounds = fz_round_rect(render->tbounds); } static void @@ -1040,14 +1040,14 @@ static void drawpage(fz_context *ctx, fz_document *doc, int pagenum) /* Make the display list, and see if we need color */ fz_try(ctx) { - list = fz_new_display_list(ctx, &render.bounds); + list = fz_new_display_list(ctx, render.bounds); list_dev = fz_new_list_device(ctx, list); #if GREY_FALLBACK != 0 test_dev = fz_new_test_device(ctx, &is_color, 0.01f, 0, list_dev); - fz_run_page(ctx, page, test_dev, &fz_identity, &cookie); + fz_run_page(ctx, page, test_dev, fz_identity, &cookie); fz_close_device(ctx, test_dev); #else - fz_run_page(ctx, page, list_dev, &fz_identity, &cookie); + fz_run_page(ctx, page, list_dev, fz_identity, &cookie); #endif fz_close_device(ctx, list_dev); } @@ -1077,7 +1077,7 @@ static void drawpage(fz_context *ctx, fz_document *doc, int pagenum) fz_try(ctx) { test_dev = fz_new_test_device(ctx, &is_color, 0.01f, 0, test_dev); - fz_run_page(ctx, page, test_dev, &fz_identity, &cookie); + fz_run_page(ctx, page, test_dev, fz_identity, &cookie); fz_close_device(ctx, test_dev); } fz_always(ctx) @@ -1328,7 +1328,7 @@ static void worker_thread(void *arg) DEBUG_THREADS(("Worker %d woken for band_start %d\n", me->num, me->band_start)); me->status = RENDER_OK; if (me->band_start >= 0) - me->status = drawband(me->ctx, NULL, me->list, &me->ctm, &me->tbounds, &me->cookie, me->band_start, me->pix, &me->bit); + me->status = drawband(me->ctx, NULL, me->list, me->ctm, &me->tbounds, &me->cookie, me->band_start, me->pix, &me->bit); DEBUG_THREADS(("Worker %d completed band_start %d (status=%d)\n", me->num, me->band_start, me->status)); mu_trigger_semaphore(&me->stop); } diff --git a/source/tools/murun.c b/source/tools/murun.c index a4e88ea2..b2a12484 100644 --- a/source/tools/murun.c +++ b/source/tools/murun.c @@ -814,7 +814,7 @@ typedef struct js_device_s } js_device; static void -js_dev_fill_path(fz_context *ctx, fz_device *dev, const fz_path *path, int even_odd, const fz_matrix *ctm, +js_dev_fill_path(fz_context *ctx, fz_device *dev, const fz_path *path, int even_odd, fz_matrix ctm, fz_colorspace *colorspace, const float *color, float alpha, const fz_color_params *color_params) { js_State *J = ((js_device*)dev)->J; @@ -824,7 +824,7 @@ js_dev_fill_path(fz_context *ctx, fz_device *dev, const fz_path *path, int even_ js_copy(J, -2); ffi_pushpath(J, path); js_pushboolean(J, even_odd); - ffi_pushmatrix(J, *ctm); + ffi_pushmatrix(J, ctm); ffi_pushcolor(J, colorspace, color, alpha); ffi_pushcolorparams(J, color_params); js_call(J, 7); @@ -834,7 +834,7 @@ js_dev_fill_path(fz_context *ctx, fz_device *dev, const fz_path *path, int even_ } static void -js_dev_clip_path(fz_context *ctx, fz_device *dev, const fz_path *path, int even_odd, const fz_matrix *ctm, +js_dev_clip_path(fz_context *ctx, fz_device *dev, const fz_path *path, int even_odd, fz_matrix ctm, const fz_rect *scissor) { js_State *J = ((js_device*)dev)->J; @@ -844,7 +844,7 @@ js_dev_clip_path(fz_context *ctx, fz_device *dev, const fz_path *path, int even_ js_copy(J, -2); ffi_pushpath(J, path); js_pushboolean(J, even_odd); - ffi_pushmatrix(J, *ctm); + ffi_pushmatrix(J, ctm); js_call(J, 3); js_pop(J, 1); } @@ -853,7 +853,7 @@ js_dev_clip_path(fz_context *ctx, fz_device *dev, const fz_path *path, int even_ static void js_dev_stroke_path(fz_context *ctx, fz_device *dev, const fz_path *path, - const fz_stroke_state *stroke, const fz_matrix *ctm, + const fz_stroke_state *stroke, fz_matrix ctm, fz_colorspace *colorspace, const float *color, float alpha, const fz_color_params *color_params) { js_State *J = ((js_device*)dev)->J; @@ -863,7 +863,7 @@ js_dev_stroke_path(fz_context *ctx, fz_device *dev, const fz_path *path, js_copy(J, -2); ffi_pushpath(J, path); ffi_pushstroke(J, stroke); - ffi_pushmatrix(J, *ctm); + ffi_pushmatrix(J, ctm); ffi_pushcolor(J, colorspace, color, alpha); ffi_pushcolorparams(J, color_params); js_call(J, 7); @@ -874,7 +874,7 @@ js_dev_stroke_path(fz_context *ctx, fz_device *dev, const fz_path *path, static void js_dev_clip_stroke_path(fz_context *ctx, fz_device *dev, const fz_path *path, const fz_stroke_state *stroke, - const fz_matrix *ctm, const fz_rect *scissor) + fz_matrix ctm, const fz_rect *scissor) { js_State *J = ((js_device*)dev)->J; if (js_try(J)) @@ -883,7 +883,7 @@ js_dev_clip_stroke_path(fz_context *ctx, fz_device *dev, const fz_path *path, co js_copy(J, -2); ffi_pushpath(J, path); ffi_pushstroke(J, stroke); - ffi_pushmatrix(J, *ctm); + ffi_pushmatrix(J, ctm); js_call(J, 3); js_pop(J, 1); } @@ -891,7 +891,7 @@ js_dev_clip_stroke_path(fz_context *ctx, fz_device *dev, const fz_path *path, co } static void -js_dev_fill_text(fz_context *ctx, fz_device *dev, const fz_text *text, const fz_matrix *ctm, +js_dev_fill_text(fz_context *ctx, fz_device *dev, const fz_text *text, fz_matrix ctm, fz_colorspace *colorspace, const float *color, float alpha, const fz_color_params *color_params) { js_State *J = ((js_device*)dev)->J; @@ -900,7 +900,7 @@ js_dev_fill_text(fz_context *ctx, fz_device *dev, const fz_text *text, const fz_ if (js_hasproperty(J, -1, "fillText")) { js_copy(J, -2); ffi_pushtext(J, text); - ffi_pushmatrix(J, *ctm); + ffi_pushmatrix(J, ctm); ffi_pushcolor(J, colorspace, color, alpha); ffi_pushcolorparams(J, color_params); js_call(J, 6); @@ -911,7 +911,7 @@ js_dev_fill_text(fz_context *ctx, fz_device *dev, const fz_text *text, const fz_ static void js_dev_stroke_text(fz_context *ctx, fz_device *dev, const fz_text *text, const fz_stroke_state *stroke, - const fz_matrix *ctm, fz_colorspace *colorspace, const float *color, float alpha, const fz_color_params *color_params) + fz_matrix ctm, fz_colorspace *colorspace, const float *color, float alpha, const fz_color_params *color_params) { js_State *J = ((js_device*)dev)->J; if (js_try(J)) @@ -920,7 +920,7 @@ js_dev_stroke_text(fz_context *ctx, fz_device *dev, const fz_text *text, const f js_copy(J, -2); ffi_pushtext(J, text); ffi_pushstroke(J, stroke); - ffi_pushmatrix(J, *ctm); + ffi_pushmatrix(J, ctm); ffi_pushcolor(J, colorspace, color, alpha); ffi_pushcolorparams(J, color_params); js_call(J, 7); @@ -930,7 +930,7 @@ js_dev_stroke_text(fz_context *ctx, fz_device *dev, const fz_text *text, const f } static void -js_dev_clip_text(fz_context *ctx, fz_device *dev, const fz_text *text, const fz_matrix *ctm, const fz_rect *scissor) +js_dev_clip_text(fz_context *ctx, fz_device *dev, const fz_text *text, fz_matrix ctm, const fz_rect *scissor) { js_State *J = ((js_device*)dev)->J; if (js_try(J)) @@ -938,7 +938,7 @@ js_dev_clip_text(fz_context *ctx, fz_device *dev, const fz_text *text, const fz_ if (js_hasproperty(J, -1, "clipText")) { js_copy(J, -2); ffi_pushtext(J, text); - ffi_pushmatrix(J, *ctm); + ffi_pushmatrix(J, ctm); js_call(J, 2); js_pop(J, 1); } @@ -947,7 +947,7 @@ js_dev_clip_text(fz_context *ctx, fz_device *dev, const fz_text *text, const fz_ static void js_dev_clip_stroke_text(fz_context *ctx, fz_device *dev, const fz_text *text, const fz_stroke_state *stroke, - const fz_matrix *ctm, const fz_rect *scissor) + fz_matrix ctm, const fz_rect *scissor) { js_State *J = ((js_device*)dev)->J; if (js_try(J)) @@ -956,7 +956,7 @@ js_dev_clip_stroke_text(fz_context *ctx, fz_device *dev, const fz_text *text, co js_copy(J, -2); ffi_pushtext(J, text); ffi_pushstroke(J, stroke); - ffi_pushmatrix(J, *ctm); + ffi_pushmatrix(J, ctm); js_call(J, 3); js_pop(J, 1); } @@ -964,7 +964,7 @@ js_dev_clip_stroke_text(fz_context *ctx, fz_device *dev, const fz_text *text, co } static void -js_dev_ignore_text(fz_context *ctx, fz_device *dev, const fz_text *text, const fz_matrix *ctm) +js_dev_ignore_text(fz_context *ctx, fz_device *dev, const fz_text *text, fz_matrix ctm) { js_State *J = ((js_device*)dev)->J; if (js_try(J)) @@ -972,7 +972,7 @@ js_dev_ignore_text(fz_context *ctx, fz_device *dev, const fz_text *text, const f if (js_hasproperty(J, -1, "ignoreText")) { js_copy(J, -2); ffi_pushtext(J, text); - ffi_pushmatrix(J, *ctm); + ffi_pushmatrix(J, ctm); js_call(J, 2); js_pop(J, 1); } @@ -980,7 +980,7 @@ js_dev_ignore_text(fz_context *ctx, fz_device *dev, const fz_text *text, const f } static void -js_dev_fill_shade(fz_context *ctx, fz_device *dev, fz_shade *shade, const fz_matrix *ctm, float alpha, const fz_color_params *color_params) +js_dev_fill_shade(fz_context *ctx, fz_device *dev, fz_shade *shade, fz_matrix ctm, float alpha, const fz_color_params *color_params) { js_State *J = ((js_device*)dev)->J; if (js_try(J)) @@ -988,7 +988,7 @@ js_dev_fill_shade(fz_context *ctx, fz_device *dev, fz_shade *shade, const fz_mat if (js_hasproperty(J, -1, "fillShade")) { js_copy(J, -2); ffi_pushshade(J, shade); - ffi_pushmatrix(J, *ctm); + ffi_pushmatrix(J, ctm); js_pushnumber(J, alpha); ffi_pushcolorparams(J, color_params); js_call(J, 4); @@ -998,7 +998,7 @@ js_dev_fill_shade(fz_context *ctx, fz_device *dev, fz_shade *shade, const fz_mat } static void -js_dev_fill_image(fz_context *ctx, fz_device *dev, fz_image *image, const fz_matrix *ctm, float alpha, const fz_color_params *color_params) +js_dev_fill_image(fz_context *ctx, fz_device *dev, fz_image *image, fz_matrix ctm, float alpha, const fz_color_params *color_params) { js_State *J = ((js_device*)dev)->J; if (js_try(J)) @@ -1006,7 +1006,7 @@ js_dev_fill_image(fz_context *ctx, fz_device *dev, fz_image *image, const fz_mat if (js_hasproperty(J, -1, "fillImage")) { js_copy(J, -2); ffi_pushimage(J, image); - ffi_pushmatrix(J, *ctm); + ffi_pushmatrix(J, ctm); js_pushnumber(J, alpha); ffi_pushcolorparams(J, color_params); js_call(J, 4); @@ -1016,7 +1016,7 @@ js_dev_fill_image(fz_context *ctx, fz_device *dev, fz_image *image, const fz_mat } static void -js_dev_fill_image_mask(fz_context *ctx, fz_device *dev, fz_image *image, const fz_matrix *ctm, +js_dev_fill_image_mask(fz_context *ctx, fz_device *dev, fz_image *image, fz_matrix ctm, fz_colorspace *colorspace, const float *color, float alpha, const fz_color_params *color_params) { js_State *J = ((js_device*)dev)->J; @@ -1025,7 +1025,7 @@ js_dev_fill_image_mask(fz_context *ctx, fz_device *dev, fz_image *image, const f if (js_hasproperty(J, -1, "fillImageMask")) { js_copy(J, -2); ffi_pushimage(J, image); - ffi_pushmatrix(J, *ctm); + ffi_pushmatrix(J, ctm); ffi_pushcolor(J, colorspace, color, alpha); ffi_pushcolorparams(J, color_params); js_call(J, 6); @@ -1035,7 +1035,7 @@ js_dev_fill_image_mask(fz_context *ctx, fz_device *dev, fz_image *image, const f } static void -js_dev_clip_image_mask(fz_context *ctx, fz_device *dev, fz_image *image, const fz_matrix *ctm, const fz_rect *scissor) +js_dev_clip_image_mask(fz_context *ctx, fz_device *dev, fz_image *image, fz_matrix ctm, const fz_rect *scissor) { js_State *J = ((js_device*)dev)->J; if (js_try(J)) @@ -1043,7 +1043,7 @@ js_dev_clip_image_mask(fz_context *ctx, fz_device *dev, fz_image *image, const f if (js_hasproperty(J, -1, "clipImageMask")) { js_copy(J, -2); ffi_pushimage(J, image); - ffi_pushmatrix(J, *ctm); + ffi_pushmatrix(J, ctm); js_call(J, 2); js_pop(J, 1); } @@ -1133,7 +1133,7 @@ js_dev_end_group(fz_context *ctx, fz_device *dev) static int js_dev_begin_tile(fz_context *ctx, fz_device *dev, const fz_rect *area, const fz_rect *view, - float xstep, float ystep, const fz_matrix *ctm, int id) + float xstep, float ystep, fz_matrix ctm, int id) { js_State *J = ((js_device*)dev)->J; if (js_try(J)) @@ -1145,7 +1145,7 @@ js_dev_begin_tile(fz_context *ctx, fz_device *dev, const fz_rect *area, const fz ffi_pushrect(J, *view); js_pushnumber(J, xstep); js_pushnumber(J, ystep); - ffi_pushmatrix(J, *ctm); + ffi_pushmatrix(J, ctm); js_pushnumber(J, id); js_call(J, 6); n = js_tointeger(J, -1); @@ -1258,7 +1258,7 @@ static void ffi_Device_fillPath(js_State *J) struct color c = ffi_tocolor(J, 4); fz_color_params *color_params = ffi_tocolorparams(J, 7); fz_try(ctx) - fz_fill_path(ctx, dev, path, even_odd, &ctm, c.colorspace, c.color, c.alpha, color_params); + fz_fill_path(ctx, dev, path, even_odd, ctm, c.colorspace, c.color, c.alpha, color_params); fz_catch(ctx) rethrow(J); } @@ -1273,7 +1273,7 @@ static void ffi_Device_strokePath(js_State *J) struct color c = ffi_tocolor(J, 4); fz_color_params *color_params = ffi_tocolorparams(J, 7); fz_try(ctx) - fz_stroke_path(ctx, dev, path, &stroke, &ctm, c.colorspace, c.color, c.alpha, color_params); + fz_stroke_path(ctx, dev, path, &stroke, ctm, c.colorspace, c.color, c.alpha, color_params); fz_catch(ctx) rethrow(J); } @@ -1286,7 +1286,7 @@ static void ffi_Device_clipPath(js_State *J) int even_odd = js_toboolean(J, 2); fz_matrix ctm = ffi_tomatrix(J, 3); fz_try(ctx) - fz_clip_path(ctx, dev, path, even_odd, &ctm, NULL); + fz_clip_path(ctx, dev, path, even_odd, ctm, NULL); fz_catch(ctx) rethrow(J); } @@ -1299,7 +1299,7 @@ static void ffi_Device_clipStrokePath(js_State *J) fz_stroke_state stroke = ffi_tostroke(J, 2); fz_matrix ctm = ffi_tomatrix(J, 3); fz_try(ctx) - fz_clip_stroke_path(ctx, dev, path, &stroke, &ctm, NULL); + fz_clip_stroke_path(ctx, dev, path, &stroke, ctm, NULL); fz_catch(ctx) rethrow(J); } @@ -1313,7 +1313,7 @@ static void ffi_Device_fillText(js_State *J) struct color c = ffi_tocolor(J, 3); fz_color_params *color_params = ffi_tocolorparams(J, 6); fz_try(ctx) - fz_fill_text(ctx, dev, text, &ctm, c.colorspace, c.color, c.alpha, color_params); + fz_fill_text(ctx, dev, text, ctm, c.colorspace, c.color, c.alpha, color_params); fz_catch(ctx) rethrow(J); } @@ -1328,7 +1328,7 @@ static void ffi_Device_strokeText(js_State *J) struct color c = ffi_tocolor(J, 4); fz_color_params *color_params = ffi_tocolorparams(J, 7); fz_try(ctx) - fz_stroke_text(ctx, dev, text, &stroke, &ctm, c.colorspace, c.color, c.alpha, color_params); + fz_stroke_text(ctx, dev, text, &stroke, ctm, c.colorspace, c.color, c.alpha, color_params); fz_catch(ctx) rethrow(J); } @@ -1340,7 +1340,7 @@ static void ffi_Device_clipText(js_State *J) fz_text *text = js_touserdata(J, 1, "fz_text"); fz_matrix ctm = ffi_tomatrix(J, 2); fz_try(ctx) - fz_clip_text(ctx, dev, text, &ctm, NULL); + fz_clip_text(ctx, dev, text, ctm, NULL); fz_catch(ctx) rethrow(J); } @@ -1353,7 +1353,7 @@ static void ffi_Device_clipStrokeText(js_State *J) fz_stroke_state stroke = ffi_tostroke(J, 2); fz_matrix ctm = ffi_tomatrix(J, 3); fz_try(ctx) - fz_clip_stroke_text(ctx, dev, text, &stroke, &ctm, NULL); + fz_clip_stroke_text(ctx, dev, text, &stroke, ctm, NULL); fz_catch(ctx) rethrow(J); } @@ -1365,7 +1365,7 @@ static void ffi_Device_ignoreText(js_State *J) fz_text *text = js_touserdata(J, 1, "fz_text"); fz_matrix ctm = ffi_tomatrix(J, 2); fz_try(ctx) - fz_ignore_text(ctx, dev, text, &ctm); + fz_ignore_text(ctx, dev, text, ctm); fz_catch(ctx) rethrow(J); } @@ -1379,7 +1379,7 @@ static void ffi_Device_fillShade(js_State *J) float alpha = js_tonumber(J, 3); fz_color_params *color_params = ffi_tocolorparams(J, 4); fz_try(ctx) - fz_fill_shade(ctx, dev, shade, &ctm, alpha, color_params); + fz_fill_shade(ctx, dev, shade, ctm, alpha, color_params); fz_catch(ctx) rethrow(J); } @@ -1393,7 +1393,7 @@ static void ffi_Device_fillImage(js_State *J) float alpha = js_tonumber(J, 3); fz_color_params *color_params = ffi_tocolorparams(J, 4); fz_try(ctx) - fz_fill_image(ctx, dev, image, &ctm, alpha, color_params); + fz_fill_image(ctx, dev, image, ctm, alpha, color_params); fz_catch(ctx) rethrow(J); } @@ -1407,7 +1407,7 @@ static void ffi_Device_fillImageMask(js_State *J) struct color c = ffi_tocolor(J, 3); fz_color_params *color_params = ffi_tocolorparams(J, 6); fz_try(ctx) - fz_fill_image_mask(ctx, dev, image, &ctm, c.colorspace, c.color, c.alpha, color_params); + fz_fill_image_mask(ctx, dev, image, ctm, c.colorspace, c.color, c.alpha, color_params); fz_catch(ctx) rethrow(J); } @@ -1419,7 +1419,7 @@ static void ffi_Device_clipImageMask(js_State *J) fz_image *image = js_touserdata(J, 1, "fz_image"); fz_matrix ctm = ffi_tomatrix(J, 2); fz_try(ctx) - fz_clip_image_mask(ctx, dev, image, &ctm, NULL); + fz_clip_image_mask(ctx, dev, image, ctm, NULL); fz_catch(ctx) rethrow(J); } @@ -1495,7 +1495,7 @@ static void ffi_Device_beginTile(js_State *J) int id = js_tonumber(J, 6); int n = 0; fz_try(ctx) - n = fz_begin_tile_id(ctx, dev, &area, &view, xstep, ystep, &ctm, id); + n = fz_begin_tile_id(ctx, dev, &area, &view, xstep, ystep, ctm, id); fz_catch(ctx) rethrow(J); js_pushnumber(J, n); @@ -1848,9 +1848,9 @@ static void ffi_Page_run(js_State *J) device = js_touserdata(J, 1, "fz_device"); fz_try(ctx) if (no_annots) - fz_run_page_contents(ctx, page, device, &ctm, NULL); + fz_run_page_contents(ctx, page, device, ctm, NULL); else - fz_run_page(ctx, page, device, &ctm, NULL); + fz_run_page(ctx, page, device, ctm, NULL); fz_catch(ctx) rethrow(J); } else { @@ -1858,9 +1858,9 @@ static void ffi_Page_run(js_State *J) js_copy(J, 1); /* put the js device on the top so the callbacks know where to get it */ fz_try(ctx) { if (no_annots) - fz_run_page_contents(ctx, page, device, &ctm, NULL); + fz_run_page_contents(ctx, page, device, ctm, NULL); else - fz_run_page(ctx, page, device, &ctm, NULL); + fz_run_page(ctx, page, device, ctm, NULL); fz_close_device(ctx, device); } fz_always(ctx) @@ -1901,9 +1901,9 @@ static void ffi_Page_toPixmap(js_State *J) fz_try(ctx) if (no_annots) - pixmap = fz_new_pixmap_from_page_contents(ctx, page, &ctm, colorspace, alpha); + pixmap = fz_new_pixmap_from_page_contents(ctx, page, ctm, colorspace, alpha); else - pixmap = fz_new_pixmap_from_page(ctx, page, &ctm, colorspace, alpha); + pixmap = fz_new_pixmap_from_page(ctx, page, ctm, colorspace, alpha); fz_catch(ctx) rethrow(J); @@ -2034,14 +2034,14 @@ static void ffi_Annotation_run(js_State *J) if (js_isuserdata(J, 1, "fz_device")) { device = js_touserdata(J, 1, "fz_device"); fz_try(ctx) - fz_run_annot(ctx, annot, device, &ctm, NULL); + fz_run_annot(ctx, annot, device, ctm, NULL); fz_catch(ctx) rethrow(J); } else { device = new_js_device(ctx, J); js_copy(J, 1); /* put the js device on the top so the callbacks know where to get it */ fz_try(ctx) { - fz_run_annot(ctx, annot, device, &ctm, NULL); + fz_run_annot(ctx, annot, device, ctm, NULL); fz_close_device(ctx, device); } fz_always(ctx) @@ -2076,7 +2076,7 @@ static void ffi_Annotation_toPixmap(js_State *J) fz_pixmap *pixmap = NULL; fz_try(ctx) - pixmap = fz_new_pixmap_from_annot(ctx, annot, &ctm, colorspace, alpha); + pixmap = fz_new_pixmap_from_annot(ctx, annot, ctm, colorspace, alpha); fz_catch(ctx) rethrow(J); @@ -2474,7 +2474,7 @@ static void ffi_Text_showString(js_State *J) int wmode = js_isdefined(J, 4) ? js_toboolean(J, 4) : 0; fz_try(ctx) - fz_show_string(ctx, text, font, &trm, s, wmode, 0, FZ_BIDI_NEUTRAL, FZ_LANG_UNSET); + trm = fz_show_string(ctx, text, font, trm, s, wmode, 0, FZ_BIDI_NEUTRAL, FZ_LANG_UNSET); fz_catch(ctx) rethrow(J); @@ -2731,14 +2731,14 @@ static void ffi_DisplayList_run(js_State *J) if (js_isuserdata(J, 1, "fz_device")) { device = js_touserdata(J, 1, "fz_device"); fz_try(ctx) - fz_run_display_list(ctx, list, device, &ctm, NULL, NULL); + fz_run_display_list(ctx, list, device, ctm, NULL, NULL); fz_catch(ctx) rethrow(J); } else { device = new_js_device(ctx, J); js_copy(J, 1); fz_try(ctx) { - fz_run_display_list(ctx, list, device, &ctm, NULL, NULL); + fz_run_display_list(ctx, list, device, ctm, NULL, NULL); fz_close_device(ctx, device); } fz_always(ctx) @@ -2758,7 +2758,7 @@ static void ffi_DisplayList_toPixmap(js_State *J) fz_pixmap *pixmap = NULL; fz_try(ctx) - pixmap = fz_new_pixmap_from_display_list(ctx, list, &ctm, colorspace, alpha); + pixmap = fz_new_pixmap_from_display_list(ctx, list, ctm, colorspace, alpha); fz_catch(ctx) rethrow(J); @@ -2890,7 +2890,7 @@ static void ffi_new_DrawDevice(js_State *J) fz_device *device = NULL; fz_try(ctx) - device = fz_new_draw_device(ctx, &transform, pixmap); + device = fz_new_draw_device(ctx, transform, pixmap); fz_catch(ctx) rethrow(J); diff --git a/source/tools/mutrace.c b/source/tools/mutrace.c index 350de919..c9e988b9 100644 --- a/source/tools/mutrace.c +++ b/source/tools/mutrace.c @@ -51,11 +51,11 @@ static void runpage(fz_context *ctx, fz_document *doc, int number) if (use_display_list) { list = fz_new_display_list_from_page(ctx, page); - fz_run_display_list(ctx, list, dev, &fz_identity, NULL, NULL); + fz_run_display_list(ctx, list, dev, fz_identity, NULL, NULL); } else { - fz_run_page(ctx, page, dev, &fz_identity, NULL); + fz_run_page(ctx, page, dev, fz_identity, NULL); } printf("</page>\n"); } diff --git a/source/xps/xps-glyphs.c b/source/xps/xps-glyphs.c index 1effccc2..de9b4f45 100644 --- a/source/xps/xps-glyphs.c +++ b/source/xps/xps-glyphs.c @@ -606,15 +606,14 @@ xps_parse_glyphs(fz_context *ctx, xps_document *doc, fz_matrix ctm, samples[0] *= fz_atof(fill_opacity_att); xps_set_color(ctx, doc, colorspace, samples); - fz_fill_text(ctx, dev, text, &ctm, - doc->colorspace, doc->color, doc->alpha, NULL); + fz_fill_text(ctx, dev, text, ctm, doc->colorspace, doc->color, doc->alpha, NULL); } /* If it's a complex brush, use the charpath as a clip mask */ if (fill_tag) { - fz_clip_text(ctx, dev, text, &ctm, &area); + fz_clip_text(ctx, dev, text, ctm, &area); xps_parse_brush(ctx, doc, ctm, area, fill_uri, dict, fill_tag); fz_pop_clip(ctx, dev); } diff --git a/source/xps/xps-gradient.c b/source/xps/xps-gradient.c index 73022790..aefb6f21 100644 --- a/source/xps/xps-gradient.c +++ b/source/xps/xps-gradient.c @@ -240,7 +240,7 @@ xps_draw_one_radial_gradient(fz_context *ctx, xps_document *doc, fz_matrix ctm, shade->u.l_or_r.coords[1][1] = y1; shade->u.l_or_r.coords[1][2] = r1; - fz_fill_shade(ctx, dev, shade, &ctm, 1, fz_default_color_params(ctx)); + fz_fill_shade(ctx, dev, shade, ctm, 1, fz_default_color_params(ctx)); fz_drop_shade(ctx, shade); } @@ -279,7 +279,7 @@ xps_draw_one_linear_gradient(fz_context *ctx, xps_document *doc, fz_matrix ctm, shade->u.l_or_r.coords[1][1] = y1; shade->u.l_or_r.coords[1][2] = 0; - fz_fill_shade(ctx, dev, shade, &ctm, doc->opacity[doc->opacity_top], fz_default_color_params(ctx)); + fz_fill_shade(ctx, dev, shade, ctm, doc->opacity[doc->opacity_top], fz_default_color_params(ctx)); fz_drop_shade(ctx, shade); } diff --git a/source/xps/xps-image.c b/source/xps/xps-image.c index b5affe35..dca10178 100644 --- a/source/xps/xps-image.c +++ b/source/xps/xps-image.c @@ -22,7 +22,7 @@ xps_paint_image_brush(fz_context *ctx, xps_document *doc, fz_matrix ctm, fz_rect xs = image->w * 96 / image->xres; ys = image->h * 96 / image->yres; ctm = fz_pre_scale(ctm, xs, ys); - fz_fill_image(ctx, doc->dev, image, &ctm, doc->opacity[doc->opacity_top], fz_default_color_params(ctx)); + fz_fill_image(ctx, doc->dev, image, ctm, doc->opacity[doc->opacity_top], fz_default_color_params(ctx)); } static void diff --git a/source/xps/xps-imp.h b/source/xps/xps-imp.h index fc820033..ce372e21 100644 --- a/source/xps/xps-imp.h +++ b/source/xps/xps-imp.h @@ -12,7 +12,7 @@ fz_document *xps_open_document_with_stream(fz_context *ctx, fz_stream *file); int xps_count_pages(fz_context *ctx, fz_document *doc); fz_page *xps_load_page(fz_context *ctx, fz_document *doc, int number); fz_outline *xps_load_outline(fz_context *ctx, fz_document *doc); -void xps_run_page(fz_context *ctx, fz_page *page, fz_device *dev, const fz_matrix *ctm, fz_cookie *cookie); +void xps_run_page(fz_context *ctx, fz_page *page, fz_device *dev, fz_matrix ctm, fz_cookie *cookie); fz_link *xps_load_links(fz_context *ctx, fz_page *page); int xps_lookup_link_target(fz_context *ctx, fz_document *doc, const char *target_uri, float *xp, float *yp); diff --git a/source/xps/xps-path.c b/source/xps/xps-path.c index ad8ea535..42ecd2b1 100644 --- a/source/xps/xps-path.c +++ b/source/xps/xps-path.c @@ -767,7 +767,7 @@ xps_clip(fz_context *ctx, xps_document *doc, fz_matrix ctm, xps_resource *dict, path = xps_parse_path_geometry(ctx, doc, dict, clip_tag, 0, &fill_rule); else path = fz_new_path(ctx); - fz_clip_path(ctx, dev, path, fill_rule == 0, &ctm, NULL); + fz_clip_path(ctx, dev, path, fill_rule == 0, ctm, NULL); fz_drop_path(ctx, path); } @@ -1001,13 +1001,13 @@ xps_parse_path(fz_context *ctx, xps_document *doc, fz_matrix ctm, char *base_uri if (fill_opacity_att) samples[0] *= fz_atof(fill_opacity_att); xps_set_color(ctx, doc, colorspace, samples); - fz_fill_path(ctx, dev, path, fill_rule == 0, &ctm, + fz_fill_path(ctx, dev, path, fill_rule == 0, ctm, doc->colorspace, doc->color, doc->alpha, NULL); } if (fill_tag) { - fz_clip_path(ctx, dev, path, fill_rule == 0, &ctm, &area); + fz_clip_path(ctx, dev, path, fill_rule == 0, ctm, &area); xps_parse_brush(ctx, doc, ctm, area, fill_uri, dict, fill_tag); fz_pop_clip(ctx, dev); } @@ -1018,13 +1018,13 @@ xps_parse_path(fz_context *ctx, xps_document *doc, fz_matrix ctm, char *base_uri if (stroke_opacity_att) samples[0] *= fz_atof(stroke_opacity_att); xps_set_color(ctx, doc, colorspace, samples); - fz_stroke_path(ctx, dev, stroke_path, stroke, &ctm, + fz_stroke_path(ctx, dev, stroke_path, stroke, ctm, doc->colorspace, doc->color, doc->alpha, NULL); } if (stroke_tag) { - fz_clip_stroke_path(ctx, dev, stroke_path, stroke, &ctm, &area); + fz_clip_stroke_path(ctx, dev, stroke_path, stroke, ctm, &area); xps_parse_brush(ctx, doc, ctm, area, stroke_uri, dict, stroke_tag); fz_pop_clip(ctx, dev); } diff --git a/source/xps/xps-tile.c b/source/xps/xps-tile.c index 6a75481f..83903dd2 100644 --- a/source/xps/xps-tile.c +++ b/source/xps/xps-tile.c @@ -33,7 +33,7 @@ xps_paint_tiling_brush_clipped(fz_context *ctx, xps_document *doc, fz_matrix ctm fz_lineto(ctx, path, viewbox.x1, viewbox.y1); fz_lineto(ctx, path, viewbox.x1, viewbox.y0); fz_closepath(ctx, path); - fz_clip_path(ctx, dev, path, 0, &ctm, NULL); + fz_clip_path(ctx, dev, path, 0, ctm, NULL); fz_drop_path(ctx, path); c->func(ctx, doc, ctm, viewbox, c->base_uri, c->dict, c->root, c->user); fz_pop_clip(ctx, dev); @@ -183,7 +183,7 @@ xps_parse_tiling_brush(fz_context *ctx, xps_document *doc, fz_matrix ctm, fz_rec fz_rect bigview = viewbox; bigview.x1 = bigview.x0 + xstep; bigview.y1 = bigview.y0 + ystep; - fz_begin_tile(ctx, dev, &area, &bigview, xstep, ystep, &ctm); + fz_begin_tile(ctx, dev, &area, &bigview, xstep, ystep, ctm); xps_paint_tiling_brush(ctx, doc, ctm, viewbox, tile_mode, &c); fz_end_tile(ctx, dev); } @@ -367,13 +367,13 @@ xps_parse_fixed_page(fz_context *ctx, xps_document *doc, fz_matrix ctm, xps_page } void -xps_run_page(fz_context *ctx, fz_page *page_, fz_device *dev, const fz_matrix *ctm, fz_cookie *cookie) +xps_run_page(fz_context *ctx, fz_page *page_, fz_device *dev, fz_matrix ctm, fz_cookie *cookie) { xps_page *page = (xps_page*)page_; xps_document *doc = page->doc; fz_matrix page_ctm; - page_ctm = fz_pre_scale(*ctm, 72.0f / 96.0f, 72.0f / 96.0f); + page_ctm = fz_pre_scale(ctm, 72.0f / 96.0f, 72.0f / 96.0f); doc->cookie = cookie; doc->dev = dev; |