summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Andersson <tor.andersson@artifex.com>2013-01-16 16:03:20 +0100
committerTor Andersson <tor.andersson@artifex.com>2013-01-30 14:07:21 +0100
commit29f09279714f4f9b81d9b5488072860142f86f24 (patch)
tree6a26bf5f77028bb5637b1ec3430660af801688e5
parentddb92b7c3fdfcf9bf3d7463dde4e662ca10f79ba (diff)
downloadmupdf-29f09279714f4f9b81d9b5488072860142f86f24.tar.xz
Pass content/clip bbox to device functions by value.
-rw-r--r--draw/draw_device.c15
-rw-r--r--fitz/dev_list.c21
-rw-r--r--fitz/dev_null.c6
-rw-r--r--fitz/dev_trace.c11
-rw-r--r--fitz/fitz-internal.h12
-rw-r--r--pdf/pdf_interpret.c16
-rw-r--r--xps/xps_path.c6
-rw-r--r--xps/xps_tile.c2
8 files changed, 41 insertions, 48 deletions
diff --git a/draw/draw_device.c b/draw/draw_device.c
index d65d4a90..196e9bdb 100644
--- a/draw/draw_device.c
+++ b/draw/draw_device.c
@@ -348,7 +348,7 @@ fz_draw_stroke_path(fz_device *devp, fz_path *path, fz_stroke_state *stroke, fz_
}
static void
-fz_draw_clip_path(fz_device *devp, fz_path *path, fz_rect *rect, int even_odd, fz_matrix ctm)
+fz_draw_clip_path(fz_device *devp, fz_path *path, fz_rect rect, int even_odd, fz_matrix ctm)
{
fz_draw_device *dev = devp->user;
float expansion = fz_matrix_expansion(ctm);
@@ -367,8 +367,7 @@ fz_draw_clip_path(fz_device *devp, fz_path *path, fz_rect *rect, int even_odd, f
bbox = fz_bound_gel(dev->gel);
bbox = fz_intersect_rect(bbox, state->scissor);
- if (rect)
- bbox = fz_intersect_rect(bbox, fz_rect_covering_rect(*rect));
+ bbox = fz_intersect_rect(bbox, fz_rect_covering_rect(rect));
if (fz_is_empty_rect(bbox) || fz_is_rect_gel(dev->gel))
{
@@ -407,7 +406,7 @@ fz_draw_clip_path(fz_device *devp, fz_path *path, fz_rect *rect, int even_odd, f
}
static void
-fz_draw_clip_stroke_path(fz_device *devp, fz_path *path, fz_rect *rect, fz_stroke_state *stroke, fz_matrix ctm)
+fz_draw_clip_stroke_path(fz_device *devp, fz_path *path, fz_rect rect, fz_stroke_state *stroke, fz_matrix ctm)
{
fz_draw_device *dev = devp->user;
float expansion = fz_matrix_expansion(ctm);
@@ -433,8 +432,7 @@ fz_draw_clip_stroke_path(fz_device *devp, fz_path *path, fz_rect *rect, fz_strok
bbox = fz_bound_gel(dev->gel);
bbox = fz_intersect_rect(bbox, state->scissor);
- if (rect)
- bbox = fz_intersect_rect(bbox, fz_rect_covering_rect(*rect));
+ bbox = fz_intersect_rect(bbox, fz_rect_covering_rect(rect));
fz_try(ctx)
{
@@ -1213,7 +1211,7 @@ fz_draw_fill_image_mask(fz_device *devp, fz_image *image, fz_matrix ctm,
}
static void
-fz_draw_clip_image_mask(fz_device *devp, fz_image *image, fz_rect *rect, fz_matrix ctm)
+fz_draw_clip_image_mask(fz_device *devp, fz_image *image, fz_rect rect, fz_matrix ctm)
{
fz_draw_device *dev = devp->user;
fz_context *ctx = dev->ctx;
@@ -1253,8 +1251,7 @@ fz_draw_clip_image_mask(fz_device *devp, fz_image *image, fz_rect *rect, fz_matr
bbox = fz_rect_covering_rect(fz_transform_rect(ctm, fz_unit_rect));
bbox = fz_intersect_rect(bbox, state->scissor);
- if (rect)
- bbox = fz_intersect_rect(bbox, fz_rect_covering_rect(*rect));
+ bbox = fz_intersect_rect(bbox, fz_rect_covering_rect(rect));
dx = sqrtf(ctm.a * ctm.a + ctm.b * ctm.b);
dy = sqrtf(ctm.c * ctm.c + ctm.d * ctm.d);
diff --git a/fitz/dev_list.c b/fitz/dev_list.c
index 26693e0f..55ef4e7d 100644
--- a/fitz/dev_list.c
+++ b/fitz/dev_list.c
@@ -262,7 +262,7 @@ fz_list_stroke_path(fz_device *dev, fz_path *path, fz_stroke_state *stroke, fz_m
}
static void
-fz_list_clip_path(fz_device *dev, fz_path *path, fz_rect *rect, int even_odd, fz_matrix ctm)
+fz_list_clip_path(fz_device *dev, fz_path *path, fz_rect rect, int even_odd, fz_matrix ctm)
{
fz_display_node *node;
fz_context *ctx = dev->ctx;
@@ -270,8 +270,7 @@ fz_list_clip_path(fz_device *dev, fz_path *path, fz_rect *rect, int even_odd, fz
fz_try(ctx)
{
node->rect = fz_bound_path(dev->ctx, path, NULL, ctm);
- if (rect)
- node->rect = fz_intersect_rect(node->rect, *rect);
+ node->rect = fz_intersect_rect(node->rect, rect);
node->item.path = fz_clone_path(dev->ctx, path);
node->flag = even_odd;
}
@@ -284,7 +283,7 @@ fz_list_clip_path(fz_device *dev, fz_path *path, fz_rect *rect, int even_odd, fz
}
static void
-fz_list_clip_stroke_path(fz_device *dev, fz_path *path, fz_rect *rect, fz_stroke_state *stroke, fz_matrix ctm)
+fz_list_clip_stroke_path(fz_device *dev, fz_path *path, fz_rect rect, fz_stroke_state *stroke, fz_matrix ctm)
{
fz_display_node *node;
fz_context *ctx = dev->ctx;
@@ -292,8 +291,7 @@ fz_list_clip_stroke_path(fz_device *dev, fz_path *path, fz_rect *rect, fz_stroke
fz_try(ctx)
{
node->rect = fz_bound_path(dev->ctx, path, stroke, ctm);
- if (rect)
- node->rect = fz_intersect_rect(node->rect, *rect);
+ node->rect = fz_intersect_rect(node->rect, rect);
node->item.path = fz_clone_path(dev->ctx, path);
node->stroke = fz_keep_stroke_state(dev->ctx, stroke);
}
@@ -452,13 +450,12 @@ fz_list_fill_image_mask(fz_device *dev, fz_image *image, fz_matrix ctm,
}
static void
-fz_list_clip_image_mask(fz_device *dev, fz_image *image, fz_rect *rect, fz_matrix ctm)
+fz_list_clip_image_mask(fz_device *dev, fz_image *image, fz_rect rect, fz_matrix ctm)
{
fz_display_node *node;
node = fz_new_display_node(dev->ctx, FZ_CMD_CLIP_IMAGE_MASK, ctm, NULL, NULL, 0);
node->rect = fz_transform_rect(ctm, fz_unit_rect);
- if (rect)
- node->rect = fz_intersect_rect(node->rect, *rect);
+ node->rect = fz_intersect_rect(node->rect, rect);
node->item.image = fz_keep_image(dev->ctx, image);
fz_append_display_node(dev->user, node);
}
@@ -675,13 +672,13 @@ visible:
case FZ_CMD_CLIP_PATH:
{
fz_rect trect = fz_transform_rect(top_ctm, node->rect);
- fz_clip_path(dev, node->item.path, &trect, node->flag, ctm);
+ fz_clip_path(dev, node->item.path, trect, node->flag, ctm);
break;
}
case FZ_CMD_CLIP_STROKE_PATH:
{
fz_rect trect = fz_transform_rect(top_ctm, node->rect);
- fz_clip_stroke_path(dev, node->item.path, &trect, node->stroke, ctm);
+ fz_clip_stroke_path(dev, node->item.path, trect, node->stroke, ctm);
break;
}
case FZ_CMD_FILL_TEXT:
@@ -714,7 +711,7 @@ visible:
case FZ_CMD_CLIP_IMAGE_MASK:
{
fz_rect trect = fz_transform_rect(top_ctm, node->rect);
- fz_clip_image_mask(dev, node->item.image, &trect, ctm);
+ fz_clip_image_mask(dev, node->item.image, trect, ctm);
break;
}
case FZ_CMD_POP_CLIP:
diff --git a/fitz/dev_null.c b/fitz/dev_null.c
index ac495cef..e3d28fe4 100644
--- a/fitz/dev_null.c
+++ b/fitz/dev_null.c
@@ -43,7 +43,7 @@ fz_stroke_path(fz_device *dev, fz_path *path, fz_stroke_state *stroke, fz_matrix
}
void
-fz_clip_path(fz_device *dev, fz_path *path, fz_rect *rect, int even_odd, fz_matrix ctm)
+fz_clip_path(fz_device *dev, fz_path *path, fz_rect rect, int even_odd, fz_matrix ctm)
{
fz_context *ctx = dev->ctx;
@@ -67,7 +67,7 @@ fz_clip_path(fz_device *dev, fz_path *path, fz_rect *rect, int even_odd, fz_matr
}
void
-fz_clip_stroke_path(fz_device *dev, fz_path *path, fz_rect *rect, fz_stroke_state *stroke, fz_matrix ctm)
+fz_clip_stroke_path(fz_device *dev, fz_path *path, fz_rect rect, fz_stroke_state *stroke, fz_matrix ctm)
{
fz_context *ctx = dev->ctx;
@@ -212,7 +212,7 @@ fz_fill_image_mask(fz_device *dev, fz_image *image, fz_matrix ctm,
}
void
-fz_clip_image_mask(fz_device *dev, fz_image *image, fz_rect *rect, fz_matrix ctm)
+fz_clip_image_mask(fz_device *dev, fz_image *image, fz_rect rect, fz_matrix ctm)
{
fz_context *ctx = dev->ctx;
diff --git a/fitz/dev_trace.c b/fitz/dev_trace.c
index a56cc67b..78533cf4 100644
--- a/fitz/dev_trace.c
+++ b/fitz/dev_trace.c
@@ -112,7 +112,7 @@ fz_trace_stroke_path(fz_device *dev, fz_path *path, fz_stroke_state *stroke, fz_
}
static void
-fz_trace_clip_path(fz_device *dev, fz_path *path, fz_rect *rect, int even_odd, fz_matrix ctm)
+fz_trace_clip_path(fz_device *dev, fz_path *path, fz_rect rect, int even_odd, fz_matrix ctm)
{
printf("<clip_path");
if (even_odd)
@@ -120,13 +120,13 @@ fz_trace_clip_path(fz_device *dev, fz_path *path, fz_rect *rect, int even_odd, f
else
printf(" winding=\"nonzero\"");
fz_trace_matrix(ctm);
- printf(" contentbbox=\"%g %g %g %g\">\n", rect->x0, rect->y0, rect->x1, rect->y1);
+ printf(" contentbbox=\"%g %g %g %g\">\n", rect.x0, rect.y0, rect.x1, rect.y1);
fz_trace_path(path, 0);
printf("</clip_path>\n");
}
static void
-fz_trace_clip_stroke_path(fz_device *dev, fz_path *path, fz_rect *rect, fz_stroke_state *stroke, fz_matrix ctm)
+fz_trace_clip_stroke_path(fz_device *dev, fz_path *path, fz_rect rect, fz_stroke_state *stroke, fz_matrix ctm)
{
printf("<clip_stroke_path");
fz_trace_matrix(ctm);
@@ -213,8 +213,7 @@ fz_trace_fill_shade(fz_device *dev, fz_shade *shade, fz_matrix ctm, float alpha)
}
static void
-fz_trace_fill_image_mask(fz_device *dev, fz_image *image, fz_matrix ctm,
-fz_colorspace *colorspace, float *color, float alpha)
+fz_trace_fill_image_mask(fz_device *dev, fz_image *image, fz_matrix ctm, fz_colorspace *colorspace, float *color, float alpha)
{
printf("<fill_image_mask");
fz_trace_matrix(ctm);
@@ -224,7 +223,7 @@ fz_colorspace *colorspace, float *color, float alpha)
}
static void
-fz_trace_clip_image_mask(fz_device *dev, fz_image *image, fz_rect *rect, fz_matrix ctm)
+fz_trace_clip_image_mask(fz_device *dev, fz_image *image, fz_rect rect, fz_matrix ctm)
{
printf("<clip_image_mask");
fz_trace_matrix(ctm);
diff --git a/fitz/fitz-internal.h b/fitz/fitz-internal.h
index 0ac4c93a..e7e7ca3b 100644
--- a/fitz/fitz-internal.h
+++ b/fitz/fitz-internal.h
@@ -1391,8 +1391,8 @@ struct fz_device_s
void (*fill_path)(fz_device *, fz_path *, int even_odd, fz_matrix, fz_colorspace *, float *color, float alpha);
void (*stroke_path)(fz_device *, fz_path *, fz_stroke_state *, fz_matrix, fz_colorspace *, float *color, float alpha);
- void (*clip_path)(fz_device *, fz_path *, fz_rect *rect, int even_odd, fz_matrix);
- void (*clip_stroke_path)(fz_device *, fz_path *, fz_rect *rect, fz_stroke_state *, fz_matrix);
+ void (*clip_path)(fz_device *, fz_path *, fz_rect rect, int even_odd, fz_matrix);
+ void (*clip_stroke_path)(fz_device *, fz_path *, fz_rect rect, fz_stroke_state *, fz_matrix);
void (*fill_text)(fz_device *, fz_text *, fz_matrix, fz_colorspace *, float *color, float alpha);
void (*stroke_text)(fz_device *, fz_text *, fz_stroke_state *, fz_matrix, fz_colorspace *, float *color, float alpha);
@@ -1403,7 +1403,7 @@ struct fz_device_s
void (*fill_shade)(fz_device *, fz_shade *shd, fz_matrix ctm, float alpha);
void (*fill_image)(fz_device *, fz_image *img, fz_matrix ctm, float alpha);
void (*fill_image_mask)(fz_device *, fz_image *img, fz_matrix ctm, fz_colorspace *, float *color, float alpha);
- void (*clip_image_mask)(fz_device *, fz_image *img, fz_rect *rect, fz_matrix ctm);
+ void (*clip_image_mask)(fz_device *, fz_image *img, fz_rect rect, fz_matrix ctm);
void (*pop_clip)(fz_device *);
@@ -1421,8 +1421,8 @@ struct fz_device_s
void fz_fill_path(fz_device *dev, fz_path *path, int even_odd, fz_matrix ctm, fz_colorspace *colorspace, float *color, float alpha);
void fz_stroke_path(fz_device *dev, fz_path *path, fz_stroke_state *stroke, fz_matrix ctm, fz_colorspace *colorspace, float *color, float alpha);
-void fz_clip_path(fz_device *dev, fz_path *path, fz_rect *rect, int even_odd, fz_matrix ctm);
-void fz_clip_stroke_path(fz_device *dev, fz_path *path, fz_rect *rect, fz_stroke_state *stroke, fz_matrix ctm);
+void fz_clip_path(fz_device *dev, fz_path *path, fz_rect rect, int even_odd, fz_matrix ctm);
+void fz_clip_stroke_path(fz_device *dev, fz_path *path, fz_rect rect, fz_stroke_state *stroke, fz_matrix ctm);
void fz_fill_text(fz_device *dev, fz_text *text, fz_matrix ctm, fz_colorspace *colorspace, float *color, float alpha);
void fz_stroke_text(fz_device *dev, fz_text *text, fz_stroke_state *stroke, fz_matrix ctm, fz_colorspace *colorspace, float *color, float alpha);
void fz_clip_text(fz_device *dev, fz_text *text, fz_matrix ctm, int accumulate);
@@ -1432,7 +1432,7 @@ void fz_pop_clip(fz_device *dev);
void fz_fill_shade(fz_device *dev, fz_shade *shade, fz_matrix ctm, float alpha);
void fz_fill_image(fz_device *dev, fz_image *image, fz_matrix ctm, float alpha);
void fz_fill_image_mask(fz_device *dev, fz_image *image, fz_matrix ctm, fz_colorspace *colorspace, float *color, float alpha);
-void fz_clip_image_mask(fz_device *dev, fz_image *image, fz_rect *rect, fz_matrix ctm);
+void fz_clip_image_mask(fz_device *dev, fz_image *image, fz_rect rect, fz_matrix ctm);
void fz_begin_mask(fz_device *dev, fz_rect area, int luminosity, fz_colorspace *colorspace, float *bc);
void fz_end_mask(fz_device *dev);
void fz_begin_group(fz_device *dev, fz_rect area, int isolated, int knockout, int blendmode, float alpha);
diff --git a/pdf/pdf_interpret.c b/pdf/pdf_interpret.c
index d181fdfa..5f4fffc1 100644
--- a/pdf/pdf_interpret.c
+++ b/pdf/pdf_interpret.c
@@ -415,7 +415,7 @@ pdf_show_image(pdf_csi *csi, fz_image *image)
/* apply blend group even though we skip the soft mask */
if (gstate->blendmode)
fz_begin_group(csi->dev, bbox, 0, 0, gstate->blendmode, 1);
- fz_clip_image_mask(csi->dev, image->mask, &bbox, image_ctm);
+ fz_clip_image_mask(csi->dev, image->mask, bbox, image_ctm);
}
else
pdf_begin_group(csi, bbox);
@@ -434,7 +434,7 @@ pdf_show_image(pdf_csi *csi, fz_image *image)
case PDF_MAT_PATTERN:
if (gstate->fill.pattern)
{
- fz_clip_image_mask(csi->dev, image, &bbox, image_ctm);
+ fz_clip_image_mask(csi->dev, image, bbox, image_ctm);
pdf_show_pattern(csi, gstate->fill.pattern, bbox, PDF_FILL);
fz_pop_clip(csi->dev);
}
@@ -442,7 +442,7 @@ pdf_show_image(pdf_csi *csi, fz_image *image)
case PDF_MAT_SHADE:
if (gstate->fill.shade)
{
- fz_clip_image_mask(csi->dev, image, &bbox, image_ctm);
+ fz_clip_image_mask(csi->dev, image, bbox, image_ctm);
fz_fill_shade(csi->dev, gstate->fill.shade, gstate->ctm, gstate->fill.alpha);
fz_pop_clip(csi->dev);
}
@@ -501,7 +501,7 @@ pdf_show_path(pdf_csi *csi, int doclose, int dofill, int dostroke, int even_odd)
if (csi->clip)
{
gstate->clip_depth++;
- fz_clip_path(csi->dev, path, NULL, csi->clip_even_odd, gstate->ctm);
+ fz_clip_path(csi->dev, path, fz_infinite_rect, csi->clip_even_odd, gstate->ctm);
csi->clip = 0;
}
@@ -524,7 +524,7 @@ pdf_show_path(pdf_csi *csi, int doclose, int dofill, int dostroke, int even_odd)
case PDF_MAT_PATTERN:
if (gstate->fill.pattern)
{
- fz_clip_path(csi->dev, path, NULL, even_odd, gstate->ctm);
+ fz_clip_path(csi->dev, path, fz_infinite_rect, even_odd, gstate->ctm);
pdf_show_pattern(csi, gstate->fill.pattern, bbox, PDF_FILL);
fz_pop_clip(csi->dev);
}
@@ -532,7 +532,7 @@ pdf_show_path(pdf_csi *csi, int doclose, int dofill, int dostroke, int even_odd)
case PDF_MAT_SHADE:
if (gstate->fill.shade)
{
- fz_clip_path(csi->dev, path, NULL, even_odd, gstate->ctm);
+ fz_clip_path(csi->dev, path, fz_infinite_rect, even_odd, gstate->ctm);
fz_fill_shade(csi->dev, gstate->fill.shade, csi->top_ctm, gstate->fill.alpha);
fz_pop_clip(csi->dev);
}
@@ -553,7 +553,7 @@ pdf_show_path(pdf_csi *csi, int doclose, int dofill, int dostroke, int even_odd)
case PDF_MAT_PATTERN:
if (gstate->stroke.pattern)
{
- fz_clip_stroke_path(csi->dev, path, &bbox, gstate->stroke_state, gstate->ctm);
+ fz_clip_stroke_path(csi->dev, path, bbox, gstate->stroke_state, gstate->ctm);
pdf_show_pattern(csi, gstate->stroke.pattern, bbox, PDF_STROKE);
fz_pop_clip(csi->dev);
}
@@ -561,7 +561,7 @@ pdf_show_path(pdf_csi *csi, int doclose, int dofill, int dostroke, int even_odd)
case PDF_MAT_SHADE:
if (gstate->stroke.shade)
{
- fz_clip_stroke_path(csi->dev, path, &bbox, gstate->stroke_state, gstate->ctm);
+ fz_clip_stroke_path(csi->dev, path, bbox, gstate->stroke_state, gstate->ctm);
fz_fill_shade(csi->dev, gstate->stroke.shade, csi->top_ctm, gstate->stroke.alpha);
fz_pop_clip(csi->dev);
}
diff --git a/xps/xps_path.c b/xps/xps_path.c
index 54acc114..838bb123 100644
--- a/xps/xps_path.c
+++ b/xps/xps_path.c
@@ -781,7 +781,7 @@ xps_clip(xps_document *doc, fz_matrix ctm, xps_resource *dict, char *clip_att, f
path = xps_parse_path_geometry(doc, dict, clip_tag, 0, &fill_rule);
else
path = fz_new_path(doc->ctx);
- fz_clip_path(doc->dev, path, NULL, fill_rule == 0, ctm);
+ fz_clip_path(doc->dev, path, fz_infinite_rect, fill_rule == 0, ctm);
fz_free_path(doc->ctx, path);
}
@@ -1016,7 +1016,7 @@ xps_parse_path(xps_document *doc, fz_matrix ctm, char *base_uri, xps_resource *d
if (fill_tag)
{
- fz_clip_path(doc->dev, path, NULL, fill_rule == 0, ctm);
+ fz_clip_path(doc->dev, path, fz_infinite_rect, fill_rule == 0, ctm);
xps_parse_brush(doc, ctm, area, fill_uri, dict, fill_tag);
fz_pop_clip(doc->dev);
}
@@ -1034,7 +1034,7 @@ xps_parse_path(xps_document *doc, fz_matrix ctm, char *base_uri, xps_resource *d
if (stroke_tag)
{
- fz_clip_stroke_path(doc->dev, stroke_path, NULL, stroke, ctm);
+ fz_clip_stroke_path(doc->dev, stroke_path, fz_infinite_rect, stroke, ctm);
xps_parse_brush(doc, ctm, area, stroke_uri, dict, stroke_tag);
fz_pop_clip(doc->dev);
}
diff --git a/xps/xps_tile.c b/xps/xps_tile.c
index 7c1ed933..e8c0b263 100644
--- a/xps/xps_tile.c
+++ b/xps/xps_tile.c
@@ -27,7 +27,7 @@ xps_paint_tiling_brush_clipped(xps_document *doc, fz_matrix ctm, fz_rect viewbox
fz_lineto(doc->ctx, path, viewbox.x1, viewbox.y1);
fz_lineto(doc->ctx, path, viewbox.x1, viewbox.y0);
fz_closepath(doc->ctx, path);
- fz_clip_path(doc->dev, path, NULL, 0, ctm);
+ fz_clip_path(doc->dev, path, fz_infinite_rect, 0, ctm);
fz_free_path(doc->ctx, path);
c->func(doc, ctm, viewbox, c->base_uri, c->dict, c->root, c->user);
fz_pop_clip(doc->dev);