From f40106ac6b7367292432ee7af61608548d490e8c Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Fri, 29 Jun 2018 17:26:27 +0200 Subject: Pass rects by value: device and document interface. --- source/fitz/bbox-device.c | 22 ++++++------- source/fitz/device.c | 80 +++++++++++++++++----------------------------- source/fitz/draw-device.c | 54 +++++++++++++++---------------- source/fitz/draw-mesh.c | 29 ++++++++--------- source/fitz/font.c | 8 ++--- source/fitz/image.c | 2 +- source/fitz/list-device.c | 62 ++++++++++++++++------------------- source/fitz/output-cbz.c | 4 +-- source/fitz/output-pcl.c | 2 +- source/fitz/output-pclm.c | 2 +- source/fitz/output-ps.c | 2 +- source/fitz/output-pwg.c | 2 +- source/fitz/output-svg.c | 6 ++-- source/fitz/stext-device.c | 18 +++++------ source/fitz/stext-output.c | 4 +-- source/fitz/svg-device.c | 22 ++++++------- source/fitz/test-device.c | 16 +++++----- source/fitz/trace-device.c | 24 +++++++------- source/fitz/util.c | 4 +-- source/fitz/writer.c | 2 +- 20 files changed, 168 insertions(+), 197 deletions(-) (limited to 'source/fitz') diff --git a/source/fitz/bbox-device.c b/source/fitz/bbox-device.c index 9492a2da..6760ced5 100644 --- a/source/fitz/bbox-device.c +++ b/source/fitz/bbox-device.c @@ -82,31 +82,31 @@ fz_bbox_fill_image_mask(fz_context *ctx, fz_device *dev, fz_image *image, fz_mat } static void -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_clip_path(fz_context *ctx, fz_device *dev, const fz_path *path, int even_odd, fz_matrix ctm, fz_rect scissor) { 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, 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, fz_rect scissor) { 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, fz_matrix ctm, const fz_rect *scissor) +fz_bbox_clip_text(fz_context *ctx, fz_device *dev, const fz_text *text, fz_matrix ctm, fz_rect scissor) { 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, 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, fz_rect scissor) { 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, fz_matrix ctm, const fz_rect *scissor) +fz_bbox_clip_image_mask(fz_context *ctx, fz_device *dev, fz_image *image, fz_matrix ctm, fz_rect scissor) { fz_bbox_add_rect(ctx, dev, fz_transform_rect(fz_unit_rect, ctm), 1); } @@ -122,10 +122,10 @@ fz_bbox_pop_clip(fz_context *ctx, fz_device *dev) } static void -fz_bbox_begin_mask(fz_context *ctx, fz_device *dev, const fz_rect *rect, int luminosity, fz_colorspace *colorspace, const float *color, const fz_color_params *color_params) +fz_bbox_begin_mask(fz_context *ctx, fz_device *dev, fz_rect rect, int luminosity, fz_colorspace *colorspace, const float *color, const fz_color_params *color_params) { fz_bbox_device *bdev = (fz_bbox_device*)dev; - fz_bbox_add_rect(ctx, dev, *rect, 1); + fz_bbox_add_rect(ctx, dev, rect, 1); bdev->ignore++; } @@ -138,9 +138,9 @@ fz_bbox_end_mask(fz_context *ctx, fz_device *dev) } static void -fz_bbox_begin_group(fz_context *ctx, fz_device *dev, const fz_rect *rect, fz_colorspace *cs, int isolated, int knockout, int blendmode, float alpha) +fz_bbox_begin_group(fz_context *ctx, fz_device *dev, fz_rect rect, fz_colorspace *cs, int isolated, int knockout, int blendmode, float alpha) { - fz_bbox_add_rect(ctx, dev, *rect, 1); + fz_bbox_add_rect(ctx, dev, rect, 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, fz_matrix ctm, int id) +fz_bbox_begin_tile(fz_context *ctx, fz_device *dev, fz_rect area, 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/device.c b/source/fitz/device.c index cad71a6a..d024b4f5 100644 --- a/source/fitz/device.c +++ b/source/fitz/device.c @@ -85,7 +85,7 @@ fz_disable_device_hints(fz_context *ctx, fz_device *dev, int hints) } static void -push_clip_stack(fz_context *ctx, fz_device *dev, const fz_rect *rect, int flags) +push_clip_stack(fz_context *ctx, fz_device *dev, fz_rect rect, int flags) { if (dev->container_len == dev->container_cap) { @@ -96,10 +96,10 @@ push_clip_stack(fz_context *ctx, fz_device *dev, const fz_rect *rect, int flags) dev->container_cap = newmax; } if (dev->container_len == 0) - dev->container[0].scissor = *rect; + dev->container[0].scissor = rect; else { - dev->container[dev->container_len].scissor = fz_intersect_rect(dev->container[dev->container_len-1].scissor, *rect); + dev->container[dev->container_len].scissor = fz_intersect_rect(dev->container[dev->container_len-1].scissor, rect); } dev->container[dev->container_len].flags = flags; dev->container[dev->container_len].user = 0; @@ -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, 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, fz_rect scissor) { if (dev->error_depth) { @@ -146,13 +146,9 @@ fz_clip_path(fz_context *ctx, fz_device *dev, const fz_path *path, int even_odd, { if (dev->hints & FZ_MAINTAIN_CONTAINER_STACK) { - if (scissor == NULL) - { - fz_rect bbox = fz_bound_path(ctx, path, NULL, ctm); - push_clip_stack(ctx, dev, &bbox, fz_device_container_stack_is_clip_path); - } - else - push_clip_stack(ctx, dev, scissor, fz_device_container_stack_is_clip_path); + fz_rect bbox = fz_bound_path(ctx, path, NULL, ctm); + bbox = fz_intersect_rect(bbox, scissor); + push_clip_stack(ctx, dev, bbox, fz_device_container_stack_is_clip_path); } if (dev->clip_path) dev->clip_path(ctx, dev, path, even_odd, ctm, scissor); @@ -166,7 +162,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, 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, fz_rect scissor) { if (dev->error_depth) { @@ -178,13 +174,9 @@ fz_clip_stroke_path(fz_context *ctx, fz_device *dev, const fz_path *path, const { if (dev->hints & FZ_MAINTAIN_CONTAINER_STACK) { - if (scissor == NULL) - { - 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 - push_clip_stack(ctx, dev, scissor, fz_device_container_stack_is_clip_stroke_path); + fz_rect bbox = fz_bound_path(ctx, path, stroke, ctm); + bbox = fz_intersect_rect(bbox, scissor); + push_clip_stack(ctx, dev, bbox, fz_device_container_stack_is_clip_stroke_path); } if (dev->clip_stroke_path) dev->clip_stroke_path(ctx, dev, path, stroke, ctm, scissor); @@ -218,7 +210,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, fz_matrix ctm, const fz_rect *scissor) +fz_clip_text(fz_context *ctx, fz_device *dev, const fz_text *text, fz_matrix ctm, fz_rect scissor) { if (dev->error_depth) { @@ -230,13 +222,9 @@ fz_clip_text(fz_context *ctx, fz_device *dev, const fz_text *text, fz_matrix ctm { if (dev->hints & FZ_MAINTAIN_CONTAINER_STACK) { - if (scissor == NULL) - { - fz_rect bbox = fz_bound_text(ctx, text, NULL, ctm); - push_clip_stack(ctx, dev, &bbox, fz_device_container_stack_is_clip_text); - } - else - push_clip_stack(ctx, dev, scissor, fz_device_container_stack_is_clip_text); + fz_rect bbox = fz_bound_text(ctx, text, NULL, ctm); + bbox = fz_intersect_rect(bbox, scissor); + push_clip_stack(ctx, dev, bbox, fz_device_container_stack_is_clip_text); } if (dev->clip_text) dev->clip_text(ctx, dev, text, ctm, scissor); @@ -250,7 +238,7 @@ fz_clip_text(fz_context *ctx, fz_device *dev, const fz_text *text, fz_matrix ctm } void -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) +fz_clip_stroke_text(fz_context *ctx, fz_device *dev, const fz_text *text, const fz_stroke_state *stroke, fz_matrix ctm, fz_rect scissor) { if (dev->error_depth) { @@ -262,13 +250,9 @@ fz_clip_stroke_text(fz_context *ctx, fz_device *dev, const fz_text *text, const { if (dev->hints & FZ_MAINTAIN_CONTAINER_STACK) { - if (scissor == NULL) - { - 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 - push_clip_stack(ctx, dev, scissor, fz_device_container_stack_is_clip_stroke_text); + fz_rect bbox = fz_bound_text(ctx, text, stroke, ctm); + bbox = fz_intersect_rect(bbox, scissor); + push_clip_stack(ctx, dev, bbox, fz_device_container_stack_is_clip_stroke_text); } if (dev->clip_stroke_text) dev->clip_stroke_text(ctx, dev, text, stroke, ctm, scissor); @@ -335,7 +319,7 @@ fz_fill_image_mask(fz_context *ctx, fz_device *dev, fz_image *image, fz_matrix c } void -fz_clip_image_mask(fz_context *ctx, fz_device *dev, fz_image *image, fz_matrix ctm, const fz_rect *scissor) +fz_clip_image_mask(fz_context *ctx, fz_device *dev, fz_image *image, fz_matrix ctm, fz_rect scissor) { if (dev->error_depth) { @@ -347,13 +331,9 @@ fz_clip_image_mask(fz_context *ctx, fz_device *dev, fz_image *image, fz_matrix c { if (dev->hints & FZ_MAINTAIN_CONTAINER_STACK) { - if (scissor == NULL) - { - 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 - push_clip_stack(ctx, dev, scissor, fz_device_container_stack_is_clip_image_mask); + fz_rect bbox = fz_transform_rect(fz_unit_rect, ctm); + bbox = fz_intersect_rect(bbox, scissor); + push_clip_stack(ctx, dev, bbox, fz_device_container_stack_is_clip_image_mask); } if (dev->clip_image_mask) dev->clip_image_mask(ctx, dev, image, ctm, scissor); @@ -367,7 +347,7 @@ fz_clip_image_mask(fz_context *ctx, fz_device *dev, fz_image *image, fz_matrix c } void -fz_begin_mask(fz_context *ctx, fz_device *dev, const fz_rect *area, int luminosity, fz_colorspace *colorspace, const float *bc, const fz_color_params *color_params) +fz_begin_mask(fz_context *ctx, fz_device *dev, fz_rect area, int luminosity, fz_colorspace *colorspace, const float *bc, const fz_color_params *color_params) { if (dev->error_depth) { @@ -417,7 +397,7 @@ fz_end_mask(fz_context *ctx, fz_device *dev) } void -fz_begin_group(fz_context *ctx, fz_device *dev, const fz_rect *area, fz_colorspace *cs, int isolated, int knockout, int blendmode, float alpha) +fz_begin_group(fz_context *ctx, fz_device *dev, fz_rect area, fz_colorspace *cs, int isolated, int knockout, int blendmode, float alpha) { if (dev->error_depth) { @@ -457,13 +437,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, fz_matrix ctm) +fz_begin_tile(fz_context *ctx, fz_device *dev, fz_rect area, 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, fz_matrix ctm, int id) +fz_begin_tile_id(fz_context *ctx, fz_device *dev, fz_rect area, fz_rect view, float xstep, float ystep, fz_matrix ctm, int id) { int ret = 0; @@ -534,10 +514,10 @@ void fz_end_layer(fz_context *ctx, fz_device *dev) dev->end_layer(ctx, dev); } -const fz_rect * +fz_rect fz_device_current_scissor(fz_context *ctx, fz_device *dev) { if (dev->container_len > 0) - return &dev->container[dev->container_len-1].scissor; - return &fz_infinite_rect; + return dev->container[dev->container_len-1].scissor; + return fz_infinite_rect; } diff --git a/source/fitz/draw-device.c b/source/fitz/draw-device.c index d31fa9d8..21e898c0 100644 --- a/source/fitz/draw-device.c +++ b/source/fitz/draw-device.c @@ -732,7 +732,7 @@ 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, 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, fz_rect scissor) { fz_draw_device *dev = (fz_draw_device*)devp; fz_matrix ctm = fz_concat(in_ctm, dev->transform); @@ -754,9 +754,9 @@ fz_draw_clip_path(fz_context *ctx, fz_device *devp, const fz_path *path, int eve STACK_PUSHED("clip path"); model = state->dest->colorspace; - if (scissor) + if (!fz_is_infinite_rect(scissor)) { - bbox = fz_irect_from_rect(fz_transform_rect(*scissor, dev->transform)); + bbox = fz_irect_from_rect(fz_transform_rect(scissor, dev->transform)); bbox = fz_intersect_irect(bbox, fz_pixmap_bbox(ctx, state->dest)); bbox = fz_intersect_irect(bbox, state->scissor); } @@ -806,7 +806,7 @@ 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, 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, fz_rect scissor) { fz_draw_device *dev = (fz_draw_device*)devp; fz_matrix ctm = fz_concat(in_ctm, dev->transform); @@ -835,9 +835,9 @@ fz_draw_clip_stroke_path(fz_context *ctx, fz_device *devp, const fz_path *path, STACK_PUSHED("clip stroke"); model = state->dest->colorspace; - if (scissor) + if (!fz_is_infinite_rect(scissor)) { - bbox = fz_irect_from_rect(fz_transform_rect(*scissor, dev->transform)); + bbox = fz_irect_from_rect(fz_transform_rect(scissor, dev->transform)); bbox = fz_intersect_irect(bbox, fz_pixmap_bbox(ctx, state->dest)); bbox = fz_intersect_irect(bbox, state->scissor); } @@ -1140,7 +1140,7 @@ 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, 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, fz_rect scissor) { fz_draw_device *dev = (fz_draw_device*)devp; fz_matrix ctm = fz_concat(in_ctm, dev->transform); @@ -1164,9 +1164,9 @@ fz_draw_clip_text(fz_context *ctx, fz_device *devp, const fz_text *text, fz_matr /* make the mask the exact size needed */ bbox = fz_irect_from_rect(fz_bound_text(ctx, text, NULL, ctm)); bbox = fz_intersect_irect(bbox, state->scissor); - if (scissor) + if (!fz_is_infinite_rect(scissor)) { - fz_rect tscissor = fz_transform_rect(*scissor, dev->transform); + fz_rect tscissor = fz_transform_rect(scissor, dev->transform); bbox = fz_intersect_irect(bbox, fz_irect_from_rect(tscissor)); } @@ -1278,7 +1278,7 @@ fz_draw_clip_text(fz_context *ctx, fz_device *devp, const fz_text *text, fz_matr } static void -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_clip_stroke_text(fz_context *ctx, fz_device *devp, const fz_text *text, const fz_stroke_state *stroke, fz_matrix in_ctm, fz_rect scissor) { fz_draw_device *dev = (fz_draw_device*)devp; fz_matrix ctm = fz_concat(in_ctm, dev->transform); @@ -1300,9 +1300,9 @@ fz_draw_clip_stroke_text(fz_context *ctx, fz_device *devp, const fz_text *text, /* make the mask the exact size needed */ bbox = fz_irect_from_rect(fz_bound_text(ctx, text, stroke, ctm)); bbox = fz_intersect_irect(bbox, state->scissor); - if (scissor) + if (!fz_is_infinite_rect(scissor)) { - fz_rect tscissor = fz_transform_rect(*scissor, dev->transform); + fz_rect tscissor = fz_transform_rect(scissor, dev->transform); bbox = fz_intersect_irect(bbox, fz_irect_from_rect(tscissor)); } @@ -1542,7 +1542,7 @@ fz_draw_fill_shade(fz_context *ctx, fz_device *devp, fz_shade *shade, fz_matrix 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) @@ -1938,7 +1938,7 @@ fz_draw_fill_image_mask(fz_context *ctx, fz_device *devp, fz_image *image, fz_ma } static void -fz_draw_clip_image_mask(fz_context *ctx, fz_device *devp, fz_image *image, 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, fz_rect scissor) { fz_draw_device *dev = (fz_draw_device*)devp; fz_matrix local_ctm = fz_concat(in_ctm, dev->transform); @@ -1973,9 +1973,9 @@ fz_draw_clip_image_mask(fz_context *ctx, fz_device *devp, fz_image *image, fz_ma bbox = fz_irect_from_rect(fz_transform_rect(fz_unit_rect, local_ctm)); bbox = fz_intersect_irect(bbox, state->scissor); - if (scissor) + if (!fz_is_infinite_rect(scissor)) { - fz_rect tscissor = fz_transform_rect(*scissor, dev->transform); + fz_rect tscissor = fz_transform_rect(scissor, dev->transform); bbox = fz_intersect_irect(bbox, fz_irect_from_rect(tscissor)); } @@ -2114,7 +2114,7 @@ fz_draw_pop_clip(fz_context *ctx, fz_device *devp) } static void -fz_draw_begin_mask(fz_context *ctx, fz_device *devp, const fz_rect *rect, int luminosity, fz_colorspace *colorspace_in, const float *colorfv, const fz_color_params *color_params) +fz_draw_begin_mask(fz_context *ctx, fz_device *devp, fz_rect area, int luminosity, fz_colorspace *colorspace_in, const float *colorfv, const fz_color_params *color_params) { fz_draw_device *dev = (fz_draw_device*)devp; fz_pixmap *dest; @@ -2135,7 +2135,7 @@ fz_draw_begin_mask(fz_context *ctx, fz_device *devp, const fz_rect *rect, int lu color_params = fz_default_color_params(ctx); STACK_PUSHED("mask"); - trect = fz_transform_rect(*rect, dev->transform); + trect = fz_transform_rect(area, dev->transform); bbox = fz_intersect_irect(fz_irect_from_rect(trect), state->scissor); /* Reset the blendmode for the mask rendering. In particular, @@ -2273,7 +2273,7 @@ fz_draw_end_mask(fz_context *ctx, fz_device *devp) } static void -fz_draw_begin_group(fz_context *ctx, fz_device *devp, const fz_rect *rect, fz_colorspace *cs, int isolated, int knockout, int blendmode, float alpha) +fz_draw_begin_group(fz_context *ctx, fz_device *devp, fz_rect area, fz_colorspace *cs, int isolated, int knockout, int blendmode, float alpha) { fz_draw_device *dev = (fz_draw_device*)devp; fz_irect bbox; @@ -2293,7 +2293,7 @@ fz_draw_begin_group(fz_context *ctx, fz_device *devp, const fz_rect *rect, fz_co state = push_stack(ctx, dev); STACK_PUSHED("group"); - trect = fz_transform_rect(*rect, dev->transform); + trect = fz_transform_rect(area, dev->transform); bbox = fz_intersect_irect(fz_irect_from_rect(trect), state->scissor); fz_try(ctx) @@ -2581,7 +2581,7 @@ 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, fz_matrix in_ctm, int id) +fz_draw_begin_tile(fz_context *ctx, fz_device *devp, fz_rect area, 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); @@ -2603,7 +2603,7 @@ fz_draw_begin_tile(fz_context *ctx, fz_device *devp, const fz_rect *area, const state = push_stack(ctx, dev); STACK_PUSHED("tile"); - local_view = fz_transform_rect(*view, ctm); + local_view = fz_transform_rect(view, ctm); bbox = fz_irect_from_rect(local_view); /* We should never have a bbox that entirely covers our destination. * If we do, then the check for only 1 tile being visible above has @@ -2636,7 +2636,7 @@ fz_draw_begin_tile(fz_context *ctx, fz_device *devp, const fz_rect *area, const state[1].ystep = ystep; state[1].id = id; state[1].encache = 0; - state[1].area = fz_irect_from_rect(*area); + state[1].area = fz_irect_from_rect(area); state[1].ctm = ctm; #ifdef DUMP_GROUP_BLENDS dump_spaces(dev->top-1, "Tile begin (cached)\n"); @@ -2670,7 +2670,7 @@ fz_draw_begin_tile(fz_context *ctx, fz_device *devp, const fz_rect *area, const state[1].ystep = ystep; state[1].id = id; state[1].encache = 1; - state[1].area = fz_irect_from_rect(*area); + state[1].area = fz_irect_from_rect(area); state[1].ctm = ctm; #ifdef DUMP_GROUP_BLENDS dump_spaces(dev->top-1, "Tile begin\n"); @@ -3215,7 +3215,7 @@ fz_parse_draw_options(fz_context *ctx, fz_draw_options *opts, const char *args) } fz_device * -fz_new_draw_device_with_options(fz_context *ctx, const fz_draw_options *opts, const fz_rect *mediabox, fz_pixmap **pixmap) +fz_new_draw_device_with_options(fz_context *ctx, const fz_draw_options *opts, fz_rect mediabox, fz_pixmap **pixmap) { float x_zoom = opts->x_resolution / 72.0f; float y_zoom = opts->y_resolution / 72.0f; @@ -3231,7 +3231,7 @@ fz_new_draw_device_with_options(fz_context *ctx, const fz_draw_options *opts, co fz_set_rasterizer_text_aa_level(ctx, &aa, opts->text); transform = fz_pre_rotate(fz_scale(x_zoom, y_zoom), opts->rotate); - bounds = *mediabox; + bounds = mediabox; ibounds = fz_round_rect(fz_transform_rect(bounds, transform)); /* If width or height are set, we may need to adjust the transform */ @@ -3257,7 +3257,7 @@ fz_new_draw_device_with_options(fz_context *ctx, const fz_draw_options *opts, co if (scalex != 1 || scaley != 1) { transform = fz_pre_scale(transform, scalex, scaley); - bounds = *mediabox; + bounds = mediabox; ibounds = fz_round_rect(fz_transform_rect(bounds, transform)); } } diff --git a/source/fitz/draw-mesh.c b/source/fitz/draw-mesh.c index 3b08c1e1..adc9aa1f 100644 --- a/source/fitz/draw-mesh.c +++ b/source/fitz/draw-mesh.c @@ -99,7 +99,7 @@ static inline void step_edge(edge_data *edge, int n) } static void -fz_paint_triangle(fz_pixmap *pix, float *v[3], int n, const fz_irect *bbox) +fz_paint_triangle(fz_pixmap *pix, float *v[3], int n, fz_irect bbox) { edge_data e0, e1; int top, mid, bot; @@ -113,19 +113,19 @@ fz_paint_triangle(fz_pixmap *pix, float *v[3], int n, const fz_irect *bbox) if (v[top][1] == v[bot][1]) return; /* Test if the triangle is completely outside the scissor rect */ - if (v[bot][1] < bbox->y0) return; - if (v[top][1] > bbox->y1) return; + if (v[bot][1] < bbox.y0) return; + if (v[top][1] > bbox.y1) return; /* Magic! Ensure that mid/top/bot are all different */ mid = 3^top^bot; assert(top != bot && top != mid && mid != bot); - minx = fz_maxi(bbox->x0, pix->x); - maxx = fz_mini(bbox->x1, pix->x + pix->w); + minx = fz_maxi(bbox.x0, pix->x); + maxx = fz_mini(bbox.x1, pix->x + pix->w); - y = ceilf(fz_max(bbox->y0, v[top][1])); - y1 = ceilf(fz_min(bbox->y1, v[mid][1])); + y = ceilf(fz_max(bbox.y0, v[top][1])); + y1 = ceilf(fz_min(bbox.y1, v[mid][1])); n -= 2; prepare_edge(v[top], v[bot], &e0, y, n); @@ -143,7 +143,7 @@ fz_paint_triangle(fz_pixmap *pix, float *v[3], int n, const fz_irect *bbox) while (y < y1); } - y1 = ceilf(fz_min(bbox->y1, v[bot][1])); + y1 = ceilf(fz_min(bbox.y1, v[bot][1])); if (y < y1) { prepare_edge(v[mid], v[bot], &e1, y, n); @@ -165,7 +165,7 @@ struct paint_tri_data { const fz_shade *shade; fz_pixmap *dest; - const fz_irect *bbox; + fz_irect bbox; fz_color_converter cc; }; @@ -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, 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, fz_irect bbox, const fz_overprint *op) { unsigned char clut[256][FZ_MAX_COLORS]; fz_pixmap *temp = NULL; @@ -234,9 +234,8 @@ fz_paint_shade(fz_context *ctx, fz_shade *shade, fz_colorspace *colorspace, fz_m if (shade->use_function) { - /* We need to use alpha = 1 here, because the shade might not fill - * the bbox. */ - temp = fz_new_pixmap_with_bbox(ctx, fz_device_gray(ctx), *bbox, NULL, 1); + /* We need to use alpha = 1 here, because the shade might not fill the bbox. */ + temp = fz_new_pixmap_with_bbox(ctx, fz_device_gray(ctx), bbox, NULL, 1); fz_clear_pixmap(ctx, temp); } else @@ -275,7 +274,7 @@ fz_paint_shade(fz_context *ctx, fz_shade *shade, fz_colorspace *colorspace, fz_m int n = fz_colorspace_n(ctx, colorspace); /* alpha = 1 here for the same reason as earlier */ - conv = fz_new_pixmap_with_bbox(ctx, colorspace, *bbox, NULL, 1); + conv = fz_new_pixmap_with_bbox(ctx, colorspace, bbox, NULL, 1); d = conv->samples; while (hh--) { @@ -322,7 +321,7 @@ fz_paint_shade(fz_context *ctx, fz_shade *shade, fz_colorspace *colorspace, fz_m } fz_drop_color_converter(ctx, &cc); - conv = fz_new_pixmap_with_bbox(ctx, dest->colorspace, *bbox, dest->seps, 1); + conv = fz_new_pixmap_with_bbox(ctx, dest->colorspace, bbox, dest->seps, 1); d = conv->samples; da = conv->alpha; while (hh--) diff --git a/source/fitz/font.c b/source/fitz/font.c index f24d639b..97c5347e 100644 --- a/source/fitz/font.c +++ b/source/fitz/font.c @@ -1307,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) @@ -1401,7 +1401,7 @@ fz_run_t3_glyph(fz_context *ctx, fz_font *font, int gid, fz_matrix trm, fz_devic return; ctm = fz_concat(font->t3matrix, trm); - fz_run_display_list(ctx, list, dev, ctm, &fz_infinite_rect, NULL); + fz_run_display_list(ctx, list, dev, ctm, fz_infinite_rect, NULL); } fz_pixmap * @@ -1791,9 +1791,9 @@ fz_buffer **fz_font_t3_procs(fz_context *ctx, fz_font *font) return font ? font->t3procs : NULL; } -fz_rect *fz_font_bbox(fz_context *ctx, fz_font *font) +fz_rect fz_font_bbox(fz_context *ctx, fz_font *font) { - return font ? &font->bbox : NULL; + return font->bbox; } void *fz_font_ft_face(fz_context *ctx, fz_font *font) diff --git a/source/fitz/image.c b/source/fitz/image.c index 7936adf8..79f7bfee 100644 --- a/source/fitz/image.c +++ b/source/fitz/image.c @@ -1145,7 +1145,7 @@ display_list_image_get_pixmap(fz_context *ctx, fz_image *image_, fz_irect *subar 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, fz_infinite_rect, NULL); fz_close_device(ctx, dev); } fz_always(ctx) diff --git a/source/fitz/list-device.c b/source/fitz/list-device.c index 88ad2110..072ce1d5 100644 --- a/source/fitz/list-device.c +++ b/source/fitz/list-device.c @@ -703,11 +703,10 @@ fz_list_stroke_path(fz_context *ctx, fz_device *dev, const fz_path *path, const } static void -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_list_clip_path(fz_context *ctx, fz_device *dev, const fz_path *path, int even_odd, fz_matrix ctm, fz_rect scissor) { fz_rect rect = fz_bound_path(ctx, path, NULL, ctm); - if (scissor) - rect = fz_intersect_rect(rect, *scissor); + rect = fz_intersect_rect(rect, scissor); fz_append_display_node( ctx, dev, @@ -725,11 +724,10 @@ fz_list_clip_path(fz_context *ctx, fz_device *dev, const fz_path *path, int even } static void -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_list_clip_stroke_path(fz_context *ctx, fz_device *dev, const fz_path *path, const fz_stroke_state *stroke, fz_matrix ctm, fz_rect scissor) { fz_rect rect = fz_bound_path(ctx, path, stroke, ctm); - if (scissor) - rect = fz_intersect_rect(rect, *scissor); + rect = fz_intersect_rect(rect, scissor); fz_append_display_node( ctx, dev, @@ -807,14 +805,13 @@ 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, fz_matrix ctm, const fz_rect *scissor) +fz_list_clip_text(fz_context *ctx, fz_device *dev, const fz_text *text, fz_matrix ctm, 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); - if (scissor) - rect = fz_intersect_rect(rect, *scissor); + rect = fz_intersect_rect(rect, scissor); fz_append_display_node( ctx, dev, @@ -838,14 +835,13 @@ fz_list_clip_text(fz_context *ctx, fz_device *dev, const fz_text *text, fz_matri } static void -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_list_clip_stroke_text(fz_context *ctx, fz_device *dev, const fz_text *text, const fz_stroke_state *stroke, fz_matrix ctm, 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); - if (scissor) - rect = fz_intersect_rect(rect, *scissor); + rect = fz_intersect_rect(rect, scissor); fz_append_display_node( ctx, dev, @@ -1006,14 +1002,13 @@ fz_list_fill_image_mask(fz_context *ctx, fz_device *dev, fz_image *image, fz_mat } static void -fz_list_clip_image_mask(fz_context *ctx, fz_device *dev, fz_image *image, fz_matrix ctm, const fz_rect *scissor) +fz_list_clip_image_mask(fz_context *ctx, fz_device *dev, fz_image *image, fz_matrix ctm, fz_rect scissor) { fz_image *image2 = fz_keep_image(ctx, image); fz_try(ctx) { fz_rect rect = fz_transform_rect(fz_unit_rect, ctm); - if (scissor) - rect = fz_intersect_rect(rect, *scissor); + rect = fz_intersect_rect(rect, scissor); fz_append_display_node( ctx, dev, @@ -1037,14 +1032,14 @@ fz_list_clip_image_mask(fz_context *ctx, fz_device *dev, fz_image *image, fz_mat } static void -fz_list_begin_mask(fz_context *ctx, fz_device *dev, const fz_rect *rect, int luminosity, fz_colorspace *colorspace, const float *color, const fz_color_params *color_params) +fz_list_begin_mask(fz_context *ctx, fz_device *dev, fz_rect rect, int luminosity, fz_colorspace *colorspace, const float *color, const fz_color_params *color_params) { fz_append_display_node( ctx, dev, FZ_CMD_BEGIN_MASK, (!!luminosity) | fz_pack_color_params(color_params), /* flags */ - rect, + &rect, NULL, /* path */ color, colorspace, @@ -1075,7 +1070,7 @@ fz_list_end_mask(fz_context *ctx, fz_device *dev) } static void -fz_list_begin_group(fz_context *ctx, fz_device *dev, const fz_rect *rect, fz_colorspace *colorspace, int isolated, int knockout, int blendmode, float alpha) +fz_list_begin_group(fz_context *ctx, fz_device *dev, fz_rect rect, fz_colorspace *colorspace, int isolated, int knockout, int blendmode, float alpha) { int flags; @@ -1094,7 +1089,7 @@ fz_list_begin_group(fz_context *ctx, fz_device *dev, const fz_rect *rect, fz_col dev, FZ_CMD_BEGIN_GROUP, flags, - rect, + &rect, NULL, /* path */ NULL, /* color */ NULL, /* colorspace */ @@ -1141,20 +1136,20 @@ 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, fz_matrix ctm, int id) +fz_list_begin_tile(fz_context *ctx, fz_device *dev, fz_rect area, fz_rect view, float xstep, float ystep, fz_matrix ctm, int id) { fz_list_tile_data tile; tile.xstep = xstep; tile.ystep = ystep; - tile.view = *view; + tile.view = view; tile.id = id; fz_append_display_node( ctx, dev, FZ_CMD_BEGIN_TILE, 0, /* flags */ - area, + &area, NULL, /* path */ NULL, /* color */ NULL, /* colorspace */ @@ -1476,7 +1471,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, 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, fz_rect scissor, fz_cookie *cookie) { fz_display_node *node; fz_display_node *node_end; @@ -1502,9 +1497,6 @@ fz_run_display_list(fz_context *ctx, fz_display_list *list, fz_device *dev, fz_m fz_var(colorspace); - if (!scissor) - scissor = &fz_infinite_rect; - if (cookie) { cookie->progress_max = list->len; @@ -1669,7 +1661,7 @@ fz_run_display_list(fz_context *ctx, fz_display_list *list, fz_device *dev, fz_m } else { - empty = fz_is_empty_rect(fz_intersect_rect(trans_rect, *scissor)); + empty = fz_is_empty_rect(fz_intersect_rect(trans_rect, scissor)); } if (clipped || empty) @@ -1716,10 +1708,10 @@ visible: 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); @@ -1730,10 +1722,10 @@ visible: 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); @@ -1751,20 +1743,20 @@ visible: 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); break; case FZ_CMD_BEGIN_MASK: fz_unpack_color_params(&color_params, n.flags); - fz_begin_mask(ctx, dev, &trans_rect, n.flags, colorspace, color, &color_params); + fz_begin_mask(ctx, dev, trans_rect, n.flags, colorspace, color, &color_params); break; case FZ_CMD_END_MASK: fz_end_mask(ctx, dev); break; case FZ_CMD_BEGIN_GROUP: - fz_begin_group(ctx, dev, &trans_rect, *(fz_colorspace **)node, (n.flags & ISOLATED) != 0, (n.flags & KNOCKOUT) != 0, (n.flags>>2), alpha); + fz_begin_group(ctx, dev, trans_rect, *(fz_colorspace **)node, (n.flags & ISOLATED) != 0, (n.flags & KNOCKOUT) != 0, (n.flags>>2), alpha); break; case FZ_CMD_END_GROUP: fz_end_group(ctx, dev); @@ -1776,7 +1768,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/output-cbz.c b/source/fitz/output-cbz.c index 1eb0e473..7acf3157 100644 --- a/source/fitz/output-cbz.c +++ b/source/fitz/output-cbz.c @@ -20,7 +20,7 @@ struct fz_cbz_writer_s }; static fz_device * -cbz_begin_page(fz_context *ctx, fz_document_writer *wri_, const fz_rect *mediabox) +cbz_begin_page(fz_context *ctx, fz_document_writer *wri_, fz_rect mediabox) { fz_cbz_writer *wri = (fz_cbz_writer*)wri_; return fz_new_draw_device_with_options(ctx, &wri->options, mediabox, &wri->pixmap); @@ -105,7 +105,7 @@ struct fz_pixmap_writer_s }; static fz_device * -pixmap_begin_page(fz_context *ctx, fz_document_writer *wri_, const fz_rect *mediabox) +pixmap_begin_page(fz_context *ctx, fz_document_writer *wri_, fz_rect mediabox) { fz_pixmap_writer *wri = (fz_pixmap_writer*)wri_; return fz_new_draw_device_with_options(ctx, &wri->options, mediabox, &wri->pixmap); diff --git a/source/fitz/output-pcl.c b/source/fitz/output-pcl.c index 4b885fe3..c25c59ff 100644 --- a/source/fitz/output-pcl.c +++ b/source/fitz/output-pcl.c @@ -1419,7 +1419,7 @@ struct fz_pcl_writer_s }; static fz_device * -pcl_begin_page(fz_context *ctx, fz_document_writer *wri_, const fz_rect *mediabox) +pcl_begin_page(fz_context *ctx, fz_document_writer *wri_, fz_rect mediabox) { fz_pcl_writer *wri = (fz_pcl_writer*)wri_; return fz_new_draw_device_with_options(ctx, &wri->draw, mediabox, &wri->pixmap); diff --git a/source/fitz/output-pclm.c b/source/fitz/output-pclm.c index f3aa2ec2..8d1e11c6 100644 --- a/source/fitz/output-pclm.c +++ b/source/fitz/output-pclm.c @@ -324,7 +324,7 @@ struct fz_pclm_writer_s }; static fz_device * -pclm_begin_page(fz_context *ctx, fz_document_writer *wri_, const fz_rect *mediabox) +pclm_begin_page(fz_context *ctx, fz_document_writer *wri_, fz_rect mediabox) { fz_pclm_writer *wri = (fz_pclm_writer*)wri_; return fz_new_draw_device_with_options(ctx, &wri->draw, mediabox, &wri->pixmap); diff --git a/source/fitz/output-ps.c b/source/fitz/output-ps.c index b270fcd4..a06c0006 100644 --- a/source/fitz/output-ps.c +++ b/source/fitz/output-ps.c @@ -290,7 +290,7 @@ struct fz_ps_writer_s }; static fz_device * -ps_begin_page(fz_context *ctx, fz_document_writer *wri_, const fz_rect *mediabox) +ps_begin_page(fz_context *ctx, fz_document_writer *wri_, fz_rect mediabox) { fz_ps_writer *wri = (fz_ps_writer*)wri_; wri->count++; diff --git a/source/fitz/output-pwg.c b/source/fitz/output-pwg.c index 42ad4a1f..fbbf9e79 100644 --- a/source/fitz/output-pwg.c +++ b/source/fitz/output-pwg.c @@ -410,7 +410,7 @@ struct fz_pwg_writer_s }; static fz_device * -pwg_begin_page(fz_context *ctx, fz_document_writer *wri_, const fz_rect *mediabox) +pwg_begin_page(fz_context *ctx, fz_document_writer *wri_, fz_rect mediabox) { fz_pwg_writer *wri = (fz_pwg_writer*)wri_; return fz_new_draw_device_with_options(ctx, &wri->draw, mediabox, &wri->pixmap); diff --git a/source/fitz/output-svg.c b/source/fitz/output-svg.c index 2bafda75..92d158e9 100644 --- a/source/fitz/output-svg.c +++ b/source/fitz/output-svg.c @@ -27,13 +27,13 @@ const char *fz_svg_write_options_usage = ; static fz_device * -svg_begin_page(fz_context *ctx, fz_document_writer *wri_, const fz_rect *mediabox) +svg_begin_page(fz_context *ctx, fz_document_writer *wri_, fz_rect mediabox) { fz_svg_writer *wri = (fz_svg_writer*)wri_; char path[PATH_MAX]; - float w = mediabox->x1 - mediabox->x0; - float h = mediabox->y1 - mediabox->y0; + float w = mediabox.x1 - mediabox.x0; + float h = mediabox.y1 - mediabox.y0; wri->count += 1; diff --git a/source/fitz/stext-device.c b/source/fitz/stext-device.c index 346d9bc2..0ba944d4 100644 --- a/source/fitz/stext-device.c +++ b/source/fitz/stext-device.c @@ -148,9 +148,9 @@ add_char_to_line(fz_context *ctx, fz_stext_page *page, fz_stext_line *line, fz_m } else { - fz_rect *bbox = fz_font_bbox(ctx, font); - a.x = bbox->x1; - d.x = bbox->x0; + fz_rect bbox = fz_font_bbox(ctx, font); + a.x = bbox.x1; + d.x = bbox.x0; a.y = 0; d.y = 0; } @@ -516,7 +516,7 @@ fz_stext_stroke_text(fz_context *ctx, fz_device *dev, const fz_text *text, const } static void -fz_stext_clip_text(fz_context *ctx, fz_device *dev, const fz_text *text, fz_matrix ctm, const fz_rect *scissor) +fz_stext_clip_text(fz_context *ctx, fz_device *dev, const fz_text *text, fz_matrix ctm, fz_rect scissor) { fz_stext_device *tdev = (fz_stext_device*)dev; fz_text_span *span; @@ -526,7 +526,7 @@ fz_stext_clip_text(fz_context *ctx, fz_device *dev, const fz_text *text, fz_matr } static void -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_clip_stroke_text(fz_context *ctx, fz_device *dev, const fz_text *text, const fz_stroke_state *stroke, fz_matrix ctm, fz_rect scissor) { fz_stext_device *tdev = (fz_stext_device*)dev; fz_text_span *span; @@ -567,7 +567,7 @@ fz_stext_fill_image_mask(fz_context *ctx, fz_device *dev, fz_image *img, fz_matr } static fz_image * -fz_new_image_from_shade(fz_context *ctx, fz_shade *shade, fz_matrix *in_out_ctm, const fz_color_params *color_params, const fz_rect *scissor) +fz_new_image_from_shade(fz_context *ctx, fz_shade *shade, fz_matrix *in_out_ctm, const fz_color_params *color_params, fz_rect scissor) { fz_matrix ctm = *in_out_ctm; fz_pixmap *pix; @@ -576,7 +576,7 @@ fz_new_image_from_shade(fz_context *ctx, fz_shade *shade, fz_matrix *in_out_ctm, fz_irect bbox; bounds = fz_bound_shade(ctx, shade, ctm); - bounds = fz_intersect_rect(bounds, *scissor); + bounds = fz_intersect_rect(bounds, scissor); bbox = fz_irect_from_rect(bounds); pix = fz_new_pixmap_with_bbox(ctx, fz_device_rgb(ctx), bbox, NULL, !shade->use_background); @@ -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) @@ -607,7 +607,7 @@ static void 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; - const fz_rect *scissor = fz_device_current_scissor(ctx, dev); + 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); diff --git a/source/fitz/stext-output.c b/source/fitz/stext-output.c index d949f2d8..154dfedb 100644 --- a/source/fitz/stext-output.c +++ b/source/fitz/stext-output.c @@ -455,7 +455,7 @@ struct fz_text_writer_s }; static fz_device * -text_begin_page(fz_context *ctx, fz_document_writer *wri_, const fz_rect *mediabox) +text_begin_page(fz_context *ctx, fz_document_writer *wri_, fz_rect mediabox) { fz_text_writer *wri = (fz_text_writer*)wri_; @@ -465,7 +465,7 @@ text_begin_page(fz_context *ctx, fz_document_writer *wri_, const fz_rect *mediab wri->page = NULL; } - wri->page = fz_new_stext_page(ctx, *mediabox); + wri->page = fz_new_stext_page(ctx, mediabox); return fz_new_stext_device(ctx, wri->page, &wri->opts); } diff --git a/source/fitz/svg-device.c b/source/fitz/svg-device.c index ec3441a3..17a35f7c 100644 --- a/source/fitz/svg-device.c +++ b/source/fitz/svg-device.c @@ -617,7 +617,7 @@ svg_dev_stroke_path(fz_context *ctx, fz_device *dev, const fz_path *path, const } static void -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_dev_clip_path(fz_context *ctx, fz_device *dev, const fz_path *path, int even_odd, fz_matrix ctm, fz_rect scissor) { svg_device *sdev = (svg_device*)dev; fz_output *out; @@ -637,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, 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, fz_rect scissor) { svg_device *sdev = (svg_device*)dev; @@ -718,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, fz_matrix ctm, const fz_rect *scissor) +svg_dev_clip_text(fz_context *ctx, fz_device *dev, const fz_text *text, fz_matrix ctm, fz_rect scissor) { svg_device *sdev = (svg_device*)dev; fz_output *out = sdev->out; @@ -758,7 +758,7 @@ svg_dev_clip_text(fz_context *ctx, fz_device *dev, const fz_text *text, fz_matri } static void -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_dev_clip_stroke_text(fz_context *ctx, fz_device *dev, const fz_text *text, const fz_stroke_state *stroke, fz_matrix ctm, fz_rect scissor) { svg_device *sdev = (svg_device*)dev; @@ -919,7 +919,7 @@ svg_dev_fill_shade(fz_context *ctx, fz_device *dev, fz_shade *shade, fz_matrix c fz_try(ctx) { - fz_paint_shade(ctx, shade, NULL, ctm, pix, color_params, &bbox, NULL); + fz_paint_shade(ctx, shade, NULL, ctm, pix, color_params, bbox, NULL); buf = fz_new_buffer_from_pixmap_as_png(ctx, pix, color_params); if (alpha != 1.0f) fz_write_printf(ctx, out, "\n", alpha); @@ -966,7 +966,7 @@ svg_dev_fill_image_mask(fz_context *ctx, fz_device *dev, fz_image *image, fz_mat } static void -svg_dev_clip_image_mask(fz_context *ctx, fz_device *dev, fz_image *image, fz_matrix ctm, const fz_rect *scissor) +svg_dev_clip_image_mask(fz_context *ctx, fz_device *dev, fz_image *image, fz_matrix ctm, fz_rect scissor) { svg_device *sdev = (svg_device*)dev; fz_output *out; @@ -999,7 +999,7 @@ svg_dev_pop_clip(fz_context *ctx, fz_device *dev) } static void -svg_dev_begin_mask(fz_context *ctx, fz_device *dev, const fz_rect *bbox, int luminosity, fz_colorspace *colorspace, const float *color, const fz_color_params *color_params) +svg_dev_begin_mask(fz_context *ctx, fz_device *dev, fz_rect bbox, int luminosity, fz_colorspace *colorspace, const float *color, const fz_color_params *color_params) { svg_device *sdev = (svg_device*)dev; fz_output *out; @@ -1028,7 +1028,7 @@ svg_dev_end_mask(fz_context *ctx, fz_device *dev) } static void -svg_dev_begin_group(fz_context *ctx, fz_device *dev, const fz_rect *bbox, fz_colorspace *cs, int isolated, int knockout, int blendmode, float alpha) +svg_dev_begin_group(fz_context *ctx, fz_device *dev, fz_rect bbox, fz_colorspace *cs, int isolated, int knockout, int blendmode, float alpha) { svg_device *sdev = (svg_device*)dev; fz_output *out = sdev->out; @@ -1050,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, fz_matrix ctm, int id) +svg_dev_begin_tile(fz_context *ctx, fz_device *dev, fz_rect area, fz_rect view, float xstep, float ystep, fz_matrix ctm, int id) { svg_device *sdev = (svg_device*)dev; fz_output *out; @@ -1066,8 +1066,8 @@ svg_dev_begin_tile(fz_context *ctx, fz_device *dev, const fz_rect *area, const f } num = sdev->num_tiles++; t = &sdev->tiles[num]; - t->area = *area; - t->view = *view; + t->area = area; + t->view = view; t->ctm = ctm; t->pattern = sdev->id++; t->step.x = xstep; diff --git a/source/fitz/test-device.c b/source/fitz/test-device.c index ce8923a4..8d069f69 100644 --- a/source/fitz/test-device.c +++ b/source/fitz/test-device.c @@ -381,7 +381,7 @@ fz_test_fill_image_mask(fz_context *ctx, fz_device *dev_, fz_image *image, fz_ma } static void -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_clip_path(fz_context *ctx, fz_device *dev_, const fz_path *path, int even_odd, fz_matrix ctm, 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, 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, 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, fz_matrix ctm, const fz_rect *scissor) +fz_test_clip_text(fz_context *ctx, fz_device *dev_, const fz_text *text, fz_matrix ctm, 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, fz_matr } static void -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_clip_stroke_text(fz_context *ctx, fz_device *dev_, const fz_text *text, const fz_stroke_state *stroke, fz_matrix ctm, fz_rect scissor) { 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, fz_ma } static void -fz_test_clip_image_mask(fz_context *ctx, fz_device *dev_, fz_image *img, fz_matrix ctm, const fz_rect *scissor) +fz_test_clip_image_mask(fz_context *ctx, fz_device *dev_, fz_image *img, fz_matrix ctm, fz_rect scissor) { fz_test_device *dev = (fz_test_device*)dev_; @@ -437,7 +437,7 @@ fz_test_pop_clip(fz_context *ctx, fz_device *dev_) } static void -fz_test_begin_mask(fz_context *ctx, fz_device *dev_, const fz_rect *rect, int luminosity, fz_colorspace *cs, const float *bc, const fz_color_params *color_params) +fz_test_begin_mask(fz_context *ctx, fz_device *dev_, fz_rect rect, int luminosity, fz_colorspace *cs, const float *bc, const fz_color_params *color_params) { fz_test_device *dev = (fz_test_device*)dev_; @@ -453,7 +453,7 @@ fz_test_end_mask(fz_context *ctx, fz_device *dev_) } static void -fz_test_begin_group(fz_context *ctx, fz_device *dev_, const fz_rect *rect, fz_colorspace *cs, int isolated, int knockout, int blendmode, float alpha) +fz_test_begin_group(fz_context *ctx, fz_device *dev_, fz_rect rect, fz_colorspace *cs, int isolated, int knockout, int blendmode, float alpha) { 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, fz_matrix ctm, int id) +fz_test_begin_tile(fz_context *ctx, fz_device *dev_, fz_rect area, 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/trace-device.c b/source/fitz/trace-device.c index b89661ad..1d94412b 100644 --- a/source/fitz/trace-device.c +++ b/source/fitz/trace-device.c @@ -162,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, 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, fz_rect scissor) { fz_output *out = ((fz_trace_device*)dev)->out; fz_write_printf(ctx, out, "out; fz_write_printf(ctx, out, "out; fz_write_printf(ctx, out, "out; fz_write_printf(ctx, out, "out; fz_write_printf(ctx, out, "out; fz_write_printf(ctx, out, "x0, bbox->y0, bbox->x1, bbox->y1, + bbox.x0, bbox.y0, bbox.x1, bbox.y1, luminosity ? "luminosity" : "alpha"); fz_write_printf(ctx, out, ">\n"); } @@ -312,11 +312,11 @@ fz_trace_end_mask(fz_context *ctx, fz_device *dev) } static void -fz_trace_begin_group(fz_context *ctx, fz_device *dev, const fz_rect *bbox, fz_colorspace *cs, int isolated, int knockout, int blendmode, float alpha) +fz_trace_begin_group(fz_context *ctx, fz_device *dev, fz_rect bbox, fz_colorspace *cs, int isolated, int knockout, int blendmode, float alpha) { fz_output *out = ((fz_trace_device*)dev)->out; fz_write_printf(ctx, out, "\n", - bbox->x0, bbox->y0, bbox->x1, bbox->y1, + bbox.x0, bbox.y0, bbox.x1, bbox.y1, isolated, knockout, fz_blendmode_name(blendmode), alpha); } @@ -328,12 +328,12 @@ 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, fz_matrix ctm, int id) +fz_trace_begin_tile(fz_context *ctx, fz_device *dev, fz_rect area, 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, "x0, area->y0, area->x1, area->y1); - fz_write_printf(ctx, out, " view=\"%g %g %g %g\"", view->x0, view->y0, view->x1, view->y1); + fz_write_printf(ctx, out, " area=\"%g %g %g %g\"", area.x0, area.y0, area.x1, area.y1); + fz_write_printf(ctx, out, " view=\"%g %g %g %g\"", view.x0, view.y0, view.x1, view.y1); fz_write_printf(ctx, out, " xstep=\"%g\" ystep=\"%g\"", xstep, ystep); fz_trace_matrix(ctx, out, ctm); fz_write_printf(ctx, out, ">\n"); diff --git a/source/fitz/util.c b/source/fitz/util.c index 4e1f4e1e..aea89144 100644 --- a/source/fitz/util.c +++ b/source/fitz/util.c @@ -119,7 +119,7 @@ fz_new_pixmap_from_display_list(fz_context *ctx, fz_display_list *list, fz_matri 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, fz_infinite_rect, NULL); fz_close_device(ctx, dev); } fz_always(ctx) @@ -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, fz_infinite_rect, NULL); fz_close_device(ctx, dev); } fz_always(ctx) diff --git a/source/fitz/writer.c b/source/fitz/writer.c index 1e9652da..ada07089 100644 --- a/source/fitz/writer.c +++ b/source/fitz/writer.c @@ -185,7 +185,7 @@ fz_drop_document_writer(fz_context *ctx, fz_document_writer *wri) } fz_device * -fz_begin_page(fz_context *ctx, fz_document_writer *wri, const fz_rect *mediabox) +fz_begin_page(fz_context *ctx, fz_document_writer *wri, fz_rect mediabox) { if (!wri) return NULL; -- cgit v1.2.3