summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/mupdf/fitz/device.h16
-rw-r--r--source/fitz/bbox-device.c6
-rw-r--r--source/fitz/device.c31
-rw-r--r--source/fitz/draw-device.c18
-rw-r--r--source/fitz/list-device.c24
-rw-r--r--source/fitz/svg-device.c6
-rw-r--r--source/fitz/trace-device.c11
-rw-r--r--source/pdf/pdf-device.c6
-rw-r--r--source/pdf/pdf-op-run.c16
-rw-r--r--source/xps/xps-path.c6
-rw-r--r--source/xps/xps-tile.c2
11 files changed, 74 insertions, 68 deletions
diff --git a/include/mupdf/fitz/device.h b/include/mupdf/fitz/device.h
index e062f7f0..d1f655ae 100644
--- a/include/mupdf/fitz/device.h
+++ b/include/mupdf/fitz/device.h
@@ -103,13 +103,13 @@ struct fz_device_s
void (*drop_imp)(fz_context *, fz_device *);
- void (*begin_page)(fz_context *, fz_device *, const fz_rect *rect, const fz_matrix *ctm);
+ void (*begin_page)(fz_context *, fz_device *, const fz_rect *area, const fz_matrix *ctm);
void (*end_page)(fz_context *, fz_device *);
void (*fill_path)(fz_context *, fz_device *, const fz_path *, int even_odd, const fz_matrix *, fz_colorspace *, const float *color, float alpha);
void (*stroke_path)(fz_context *, fz_device *, const fz_path *, const fz_stroke_state *, const fz_matrix *, fz_colorspace *, const float *color, float alpha);
- void (*clip_path)(fz_context *, fz_device *, const fz_path *, const fz_rect *rect, int even_odd, const fz_matrix *);
- void (*clip_stroke_path)(fz_context *, fz_device *, const fz_path *, const fz_rect *rect, const fz_stroke_state *, const fz_matrix *);
+ void (*clip_path)(fz_context *, fz_device *, const fz_path *, int even_odd, const fz_matrix *, const fz_rect *scissor);
+ void (*clip_stroke_path)(fz_context *, fz_device *, const fz_path *, const fz_stroke_state *, const fz_matrix *, const fz_rect *scissor);
void (*fill_text)(fz_context *, fz_device *, const fz_text *, const fz_matrix *, fz_colorspace *, const float *color, float alpha);
void (*stroke_text)(fz_context *, fz_device *, const fz_text *, const fz_stroke_state *, const fz_matrix *, fz_colorspace *, const float *color, float alpha);
@@ -120,7 +120,7 @@ struct fz_device_s
void (*fill_shade)(fz_context *, fz_device *, fz_shade *shd, const fz_matrix *ctm, float alpha);
void (*fill_image)(fz_context *, fz_device *, fz_image *img, const fz_matrix *ctm, float alpha);
void (*fill_image_mask)(fz_context *, fz_device *, fz_image *img, const fz_matrix *ctm, fz_colorspace *, const float *color, float alpha);
- void (*clip_image_mask)(fz_context *, fz_device *, fz_image *img, const fz_rect *rect, const fz_matrix *ctm);
+ void (*clip_image_mask)(fz_context *, fz_device *, fz_image *img, const fz_matrix *ctm, const fz_rect *scissor);
void (*pop_clip)(fz_context *, fz_device *);
@@ -144,12 +144,12 @@ struct fz_device_s
fz_device_container_stack *container;
};
-void fz_begin_page(fz_context *ctx, fz_device *dev, const fz_rect *rect, const fz_matrix *ctm);
+void fz_begin_page(fz_context *ctx, fz_device *dev, const fz_rect *area, const fz_matrix *ctm);
void fz_end_page(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_colorspace *colorspace, const float *color, float alpha);
void fz_stroke_path(fz_context *ctx, fz_device *dev, const fz_path *path, const fz_stroke_state *stroke, const fz_matrix *ctm, fz_colorspace *colorspace, const float *color, float alpha);
-void fz_clip_path(fz_context *ctx, fz_device *dev, const fz_path *path, const fz_rect *rect, int even_odd, const fz_matrix *ctm);
-void fz_clip_stroke_path(fz_context *ctx, fz_device *dev, const fz_path *path, const fz_rect *rect, const fz_stroke_state *stroke, const fz_matrix *ctm);
+void fz_clip_path(fz_context *ctx, fz_device *dev, const fz_path *path, int even_odd, const fz_matrix *ctm, const fz_rect *scissor);
+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);
void fz_fill_text(fz_context *ctx, fz_device *dev, const fz_text *text, const fz_matrix *ctm, fz_colorspace *colorspace, const float *color, float alpha);
void fz_stroke_text(fz_context *ctx, fz_device *dev, const fz_text *text, const fz_stroke_state *stroke, const fz_matrix *ctm, fz_colorspace *colorspace, const float *color, float alpha);
void fz_clip_text(fz_context *ctx, fz_device *dev, const fz_text *text, const fz_matrix *ctm);
@@ -159,7 +159,7 @@ void fz_pop_clip(fz_context *ctx, fz_device *dev);
void fz_fill_shade(fz_context *ctx, fz_device *dev, fz_shade *shade, const fz_matrix *ctm, float alpha);
void fz_fill_image(fz_context *ctx, fz_device *dev, fz_image *image, const fz_matrix *ctm, float alpha);
void fz_fill_image_mask(fz_context *ctx, fz_device *dev, fz_image *image, const fz_matrix *ctm, fz_colorspace *colorspace, const float *color, float alpha);
-void fz_clip_image_mask(fz_context *ctx, fz_device *dev, fz_image *image, const fz_rect *rect, const fz_matrix *ctm);
+void fz_clip_image_mask(fz_context *ctx, fz_device *dev, fz_image *image, const fz_matrix *ctm, const fz_rect *scissor);
void fz_begin_mask(fz_context *ctx, fz_device *dev, const fz_rect *area, int luminosity, fz_colorspace *colorspace, const float *bc);
void fz_end_mask(fz_context *ctx, fz_device *dev);
void fz_begin_group(fz_context *ctx, fz_device *dev, const fz_rect *area, int isolated, int knockout, int blendmode, float alpha);
diff --git a/source/fitz/bbox-device.c b/source/fitz/bbox-device.c
index e7ef249c..4fd8e7f9 100644
--- a/source/fitz/bbox-device.c
+++ b/source/fitz/bbox-device.c
@@ -88,14 +88,14 @@ fz_bbox_fill_image_mask(fz_context *ctx, fz_device *dev, fz_image *image, const
}
static void
-fz_bbox_clip_path(fz_context *ctx, fz_device *dev, const fz_path *path, const fz_rect *rect, int even_odd, const fz_matrix *ctm)
+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_rect r;
fz_bbox_add_rect(ctx, dev, fz_bound_path(ctx, path, NULL, ctm, &r), 1);
}
static void
-fz_bbox_clip_stroke_path(fz_context *ctx, fz_device *dev, const fz_path *path, const fz_rect *rect, const fz_stroke_state *stroke, const fz_matrix *ctm)
+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_rect r;
fz_bbox_add_rect(ctx, dev, fz_bound_path(ctx, path, stroke, ctm, &r), 1);
@@ -116,7 +116,7 @@ fz_bbox_clip_stroke_text(fz_context *ctx, fz_device *dev, const fz_text *text, c
}
static void
-fz_bbox_clip_image_mask(fz_context *ctx, fz_device *dev, fz_image *image, const fz_rect *rect, const fz_matrix *ctm)
+fz_bbox_clip_image_mask(fz_context *ctx, fz_device *dev, fz_image *image, const fz_matrix *ctm, const fz_rect *scissor)
{
fz_rect r = fz_unit_rect;
fz_bbox_add_rect(ctx, dev, fz_transform_rect(&r, ctm), 1);
diff --git a/source/fitz/device.c b/source/fitz/device.c
index 1926cc16..d9dffc5d 100644
--- a/source/fitz/device.c
+++ b/source/fitz/device.c
@@ -94,7 +94,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, const fz_rect *rect, int even_odd, const fz_matrix *ctm)
+fz_clip_path(fz_context *ctx, fz_device *dev, const fz_path *path, int even_odd, const fz_matrix *ctm, const fz_rect *scissor)
{
if (dev->error_depth)
{
@@ -106,17 +106,17 @@ fz_clip_path(fz_context *ctx, fz_device *dev, const fz_path *path, const fz_rect
{
if (dev->hints & FZ_MAINTAIN_CONTAINER_STACK)
{
- if (rect == NULL)
+ if (scissor == NULL)
{
fz_rect bbox;
fz_bound_path(ctx, path, NULL, ctm, &bbox);
push_clip_stack(ctx, dev, &bbox, fz_device_container_stack_is_clip_path);
}
else
- push_clip_stack(ctx, dev, rect, fz_device_container_stack_is_clip_path);
+ push_clip_stack(ctx, dev, scissor, fz_device_container_stack_is_clip_path);
}
if (dev->clip_path)
- dev->clip_path(ctx, dev, path, rect, even_odd, ctm);
+ dev->clip_path(ctx, dev, path, even_odd, ctm, scissor);
}
fz_catch(ctx)
{
@@ -127,7 +127,7 @@ fz_clip_path(fz_context *ctx, fz_device *dev, const fz_path *path, const fz_rect
}
void
-fz_clip_stroke_path(fz_context *ctx, fz_device *dev, const fz_path *path, const fz_rect *rect, const fz_stroke_state *stroke, const fz_matrix *ctm)
+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)
{
if (dev->error_depth)
{
@@ -139,17 +139,17 @@ fz_clip_stroke_path(fz_context *ctx, fz_device *dev, const fz_path *path, const
{
if (dev->hints & FZ_MAINTAIN_CONTAINER_STACK)
{
- if (rect == NULL)
+ if (scissor == NULL)
{
fz_rect bbox;
fz_bound_path(ctx, path, stroke, ctm, &bbox);
push_clip_stack(ctx, dev, &bbox, fz_device_container_stack_is_clip_stroke_path);
}
else
- push_clip_stack(ctx, dev, rect, fz_device_container_stack_is_clip_stroke_path);
+ push_clip_stack(ctx, dev, scissor, fz_device_container_stack_is_clip_stroke_path);
}
if (dev->clip_stroke_path)
- dev->clip_stroke_path(ctx, dev, path, rect, stroke, ctm);
+ dev->clip_stroke_path(ctx, dev, path, stroke, ctm, scissor);
}
fz_catch(ctx)
{
@@ -289,7 +289,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_rect *rect, const fz_matrix *ctm)
+fz_clip_image_mask(fz_context *ctx, fz_device *dev, fz_image *image, const fz_matrix *ctm, const fz_rect *scissor)
{
if (dev->error_depth)
{
@@ -300,9 +300,18 @@ fz_clip_image_mask(fz_context *ctx, fz_device *dev, fz_image *image, const fz_re
fz_try(ctx)
{
if (dev->hints & FZ_MAINTAIN_CONTAINER_STACK)
- push_clip_stack(ctx, dev, rect, fz_device_container_stack_is_clip_image_mask);
+ {
+ if (scissor == NULL)
+ {
+ fz_rect bbox = fz_unit_rect;
+ fz_transform_rect(&bbox, 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);
+ }
if (dev->clip_image_mask)
- dev->clip_image_mask(ctx, dev, image, rect, ctm);
+ dev->clip_image_mask(ctx, dev, image, ctm, scissor);
}
fz_catch(ctx)
{
diff --git a/source/fitz/draw-device.c b/source/fitz/draw-device.c
index fead1b0a..978e81cc 100644
--- a/source/fitz/draw-device.c
+++ b/source/fitz/draw-device.c
@@ -382,7 +382,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, const fz_rect *rect, int even_odd, const fz_matrix *ctm)
+fz_draw_clip_path(fz_context *ctx, fz_device *devp, const fz_path *path, int even_odd, const fz_matrix *ctm, const fz_rect *scissor)
{
fz_draw_device *dev = (fz_draw_device*)devp;
fz_gel *gel = dev->gel;
@@ -405,10 +405,10 @@ fz_draw_clip_path(fz_context *ctx, fz_device *devp, const fz_path *path, const f
model = state->dest->colorspace;
fz_intersect_irect(fz_bound_gel(ctx, gel, &bbox), &state->scissor);
- if (rect)
+ if (scissor)
{
fz_irect bbox2;
- fz_intersect_irect(&bbox, fz_irect_from_rect(&bbox2, rect));
+ fz_intersect_irect(&bbox, fz_irect_from_rect(&bbox2, scissor));
}
if (fz_is_empty_irect(&bbox) || fz_is_rect_gel(ctx, gel))
@@ -448,7 +448,7 @@ fz_draw_clip_path(fz_context *ctx, fz_device *devp, const fz_path *path, const f
}
static void
-fz_draw_clip_stroke_path(fz_context *ctx, fz_device *devp, const fz_path *path, const fz_rect *rect, const fz_stroke_state *stroke, const fz_matrix *ctm)
+fz_draw_clip_stroke_path(fz_context *ctx, fz_device *devp, const fz_path *path, const fz_stroke_state *stroke, const fz_matrix *ctm, const fz_rect *scissor)
{
fz_draw_device *dev = (fz_draw_device*)devp;
fz_gel *gel = dev->gel;
@@ -477,10 +477,10 @@ fz_draw_clip_stroke_path(fz_context *ctx, fz_device *devp, const fz_path *path,
model = state->dest->colorspace;
fz_intersect_irect(fz_bound_gel(ctx, gel, &bbox), &state->scissor);
- if (rect)
+ if (scissor)
{
fz_irect bbox2;
- fz_intersect_irect(&bbox, fz_irect_from_rect(&bbox2, rect));
+ fz_intersect_irect(&bbox, fz_irect_from_rect(&bbox2, scissor));
}
fz_try(ctx)
@@ -1261,7 +1261,7 @@ 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_rect *rect, const fz_matrix *ctm)
+fz_draw_clip_image_mask(fz_context *ctx, fz_device *devp, fz_image *image, const fz_matrix *ctm, const fz_rect *scissor)
{
fz_draw_device *dev = (fz_draw_device*)devp;
fz_irect bbox;
@@ -1305,10 +1305,10 @@ fz_draw_clip_image_mask(fz_context *ctx, fz_device *devp, fz_image *image, const
urect = fz_unit_rect;
fz_irect_from_rect(&bbox, fz_transform_rect(&urect, &local_ctm));
fz_intersect_irect(&bbox, &state->scissor);
- if (rect)
+ if (scissor)
{
fz_irect bbox2;
- fz_intersect_irect(&bbox, fz_irect_from_rect(&bbox2, rect));
+ fz_intersect_irect(&bbox, fz_irect_from_rect(&bbox2, scissor));
}
dx = sqrtf(local_ctm.a * local_ctm.a + local_ctm.b * local_ctm.b);
diff --git a/source/fitz/list-device.c b/source/fitz/list-device.c
index c003c2a5..42485766 100644
--- a/source/fitz/list-device.c
+++ b/source/fitz/list-device.c
@@ -724,13 +724,13 @@ 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, const fz_rect *rect, int even_odd, const fz_matrix *ctm)
+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_rect rect2;
fz_bound_path(ctx, path, NULL, ctm, &rect2);
- if (rect)
- fz_intersect_rect(&rect2, rect);
+ if (scissor)
+ fz_intersect_rect(&rect2, scissor);
fz_append_display_node(
ctx,
dev,
@@ -748,13 +748,13 @@ fz_list_clip_path(fz_context *ctx, fz_device *dev, const fz_path *path, const fz
}
static void
-fz_list_clip_stroke_path(fz_context *ctx, fz_device *dev, const fz_path *path, const fz_rect *rect, const fz_stroke_state *stroke, const fz_matrix *ctm)
+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_rect rect2;
fz_bound_path(ctx, path, stroke, ctm, &rect2);
- if (rect)
- fz_intersect_rect(&rect2, rect);
+ if (scissor)
+ fz_intersect_rect(&rect2, scissor);
fz_append_display_node(
ctx,
dev,
@@ -1042,14 +1042,14 @@ 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_rect *rect, const fz_matrix *ctm)
+fz_list_clip_image_mask(fz_context *ctx, fz_device *dev, fz_image *image, const fz_matrix *ctm, const fz_rect *scissor)
{
fz_image *image2 = fz_keep_image(ctx, image);
fz_rect rect2 = fz_unit_rect;
fz_transform_rect(&rect2, ctm);
- if (rect)
- fz_intersect_rect(&rect2, rect);
+ if (scissor)
+ fz_intersect_rect(&rect2, scissor);
fz_try(ctx)
{
fz_append_display_node(
@@ -1671,10 +1671,10 @@ visible:
fz_stroke_path(ctx, dev, path, stroke, &trans_ctm, colorspace, color, alpha);
break;
case FZ_CMD_CLIP_PATH:
- fz_clip_path(ctx, dev, path, &trans_rect, n.flags, &trans_ctm);
+ 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, &trans_rect, stroke, &trans_ctm);
+ fz_clip_stroke_path(ctx, dev, path, stroke, &trans_ctm, &trans_rect);
break;
case FZ_CMD_FILL_TEXT:
fz_fill_text(ctx, dev, *(fz_text **)node, &trans_ctm, colorspace, color, alpha);
@@ -1705,7 +1705,7 @@ visible:
break;
case FZ_CMD_CLIP_IMAGE_MASK:
if ((dev->hints & FZ_IGNORE_IMAGE) == 0)
- fz_clip_image_mask(ctx, dev, *(fz_image **)node, &trans_rect, &trans_ctm);
+ fz_clip_image_mask(ctx, dev, *(fz_image **)node, &trans_ctm, &trans_rect);
break;
case FZ_CMD_POP_CLIP:
fz_pop_clip(ctx, dev);
diff --git a/source/fitz/svg-device.c b/source/fitz/svg-device.c
index e98532f1..3295bf7e 100644
--- a/source/fitz/svg-device.c
+++ b/source/fitz/svg-device.c
@@ -517,7 +517,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, const fz_rect *rect, int even_odd, const fz_matrix *ctm)
+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_device *sdev = (svg_device*)dev;
fz_output *out;
@@ -537,7 +537,7 @@ svg_dev_clip_path(fz_context *ctx, fz_device *dev, const fz_path *path, const fz
}
static void
-svg_dev_clip_stroke_path(fz_context *ctx, fz_device *dev, const fz_path *path, const fz_rect *rect, const fz_stroke_state *stroke, const fz_matrix *ctm)
+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_device *sdev = (svg_device*)dev;
@@ -846,7 +846,7 @@ svg_dev_fill_image_mask(fz_context *ctx, fz_device *dev, fz_image *image, const
}
static void
-svg_dev_clip_image_mask(fz_context *ctx, fz_device *dev, fz_image *image, const fz_rect *rect, const fz_matrix *ctm)
+svg_dev_clip_image_mask(fz_context *ctx, fz_device *dev, fz_image *image, const fz_matrix *ctm, const fz_rect *scissor)
{
svg_device *sdev = (svg_device*)dev;
fz_output *out;
diff --git a/source/fitz/trace-device.c b/source/fitz/trace-device.c
index d93906e0..4d1e5b9b 100644
--- a/source/fitz/trace-device.c
+++ b/source/fitz/trace-device.c
@@ -163,7 +163,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, const fz_rect *rect, int even_odd, const fz_matrix *ctm)
+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_output *out = ((fz_trace_device*)dev)->out;
fz_printf(ctx, out, "<clip_path");
@@ -172,16 +172,13 @@ fz_trace_clip_path(fz_context *ctx, fz_device *dev, const fz_path *path, const f
else
fz_printf(ctx, out, " winding=\"nonzero\"");
fz_trace_matrix(ctx, out, ctm);
- if (rect)
- fz_printf(ctx, out, " contentbbox=\"%g %g %g %g\">\n", rect->x0, rect->y0, rect->x1, rect->y1);
- else
- fz_printf(ctx, out, ">\n");
+ fz_printf(ctx, out, ">\n");
fz_trace_path(ctx, out, path);
fz_printf(ctx, out, "</clip_path>\n");
}
static void
-fz_trace_clip_stroke_path(fz_context *ctx, fz_device *dev, const fz_path *path, const fz_rect *rect, const fz_stroke_state *stroke, const fz_matrix *ctm)
+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_output *out = ((fz_trace_device*)dev)->out;
fz_printf(ctx, out, "<clip_stroke_path");
@@ -282,7 +279,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_rect *rect, const fz_matrix *ctm)
+fz_trace_clip_image_mask(fz_context *ctx, fz_device *dev, fz_image *image, const fz_matrix *ctm, const fz_rect *scissor)
{
fz_output *out = ((fz_trace_device*)dev)->out;
fz_printf(ctx, out, "<clip_image_mask");
diff --git a/source/pdf/pdf-device.c b/source/pdf/pdf-device.c
index 2908b9fd..d141c476 100644
--- a/source/pdf/pdf-device.c
+++ b/source/pdf/pdf-device.c
@@ -905,7 +905,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, const fz_rect *rect, int even_odd, const fz_matrix *ctm)
+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_device *pdev = (pdf_device*)dev;
gstate *gs;
@@ -919,7 +919,7 @@ pdf_dev_clip_path(fz_context *ctx, fz_device *dev, const fz_path *path, const fz
}
static void
-pdf_dev_clip_stroke_path(fz_context *ctx, fz_device *dev, const fz_path *path, const fz_rect *rect, const fz_stroke_state *stroke, const fz_matrix *ctm)
+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_device *pdev = (pdf_device*)dev;
gstate *gs;
@@ -1088,7 +1088,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_rect *rect, const fz_matrix *ctm)
+pdf_dev_clip_image_mask(fz_context *ctx, fz_device *dev, fz_image *image, const fz_matrix *ctm, const fz_rect *scissor)
{
pdf_device *pdev = (pdf_device*)dev;
diff --git a/source/pdf/pdf-op-run.c b/source/pdf/pdf-op-run.c
index 7a039980..8d974dcf 100644
--- a/source/pdf/pdf-op-run.c
+++ b/source/pdf/pdf-op-run.c
@@ -520,7 +520,7 @@ pdf_show_image(fz_context *ctx, pdf_run_processor *pr, fz_image *image)
/* apply blend group even though we skip the soft mask */
if (gstate->blendmode)
fz_begin_group(ctx, pr->dev, &bbox, 0, 0, gstate->blendmode, 1);
- fz_clip_image_mask(ctx, pr->dev, image->mask, &bbox, &image_ctm);
+ fz_clip_image_mask(ctx, pr->dev, image->mask, &image_ctm, &bbox);
}
else
gstate = pdf_begin_group(ctx, pr, &bbox, &softmask);
@@ -539,7 +539,7 @@ pdf_show_image(fz_context *ctx, pdf_run_processor *pr, fz_image *image)
case PDF_MAT_PATTERN:
if (gstate->fill.pattern)
{
- fz_clip_image_mask(ctx, pr->dev, image, &bbox, &image_ctm);
+ fz_clip_image_mask(ctx, pr->dev, image, &image_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);
}
@@ -547,7 +547,7 @@ pdf_show_image(fz_context *ctx, pdf_run_processor *pr, fz_image *image)
case PDF_MAT_SHADE:
if (gstate->fill.shade)
{
- fz_clip_image_mask(ctx, pr->dev, image, &bbox, &image_ctm);
+ fz_clip_image_mask(ctx, pr->dev, image, &image_ctm, &bbox);
fz_fill_shade(ctx, pr->dev, gstate->fill.shade, &pr->gstate[gstate->fill.gstate_num].ctm, gstate->fill.alpha);
fz_pop_clip(ctx, pr->dev);
}
@@ -604,7 +604,7 @@ pdf_show_path(fz_context *ctx, pdf_run_processor *pr, int doclose, int dofill, i
if (pr->clip)
{
gstate->clip_depth++;
- fz_clip_path(ctx, pr->dev, path, &bbox, pr->clip_even_odd, &gstate->ctm);
+ fz_clip_path(ctx, pr->dev, path, pr->clip_even_odd, &gstate->ctm, &bbox);
pr->clip = 0;
}
@@ -645,7 +645,7 @@ pdf_show_path(fz_context *ctx, pdf_run_processor *pr, int doclose, int dofill, i
case PDF_MAT_PATTERN:
if (gstate->fill.pattern)
{
- fz_clip_path(ctx, pr->dev, path, &bbox, even_odd, &gstate->ctm);
+ 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);
}
@@ -653,7 +653,7 @@ 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, &bbox, even_odd, &gstate->ctm);
+ 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);
fz_pop_clip(ctx, pr->dev);
@@ -675,7 +675,7 @@ pdf_show_path(fz_context *ctx, pdf_run_processor *pr, int doclose, int dofill, i
case PDF_MAT_PATTERN:
if (gstate->stroke.pattern)
{
- fz_clip_stroke_path(ctx, pr->dev, path, &bbox, gstate->stroke_state, &gstate->ctm);
+ 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);
}
@@ -683,7 +683,7 @@ 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, &bbox, gstate->stroke_state, &gstate->ctm);
+ 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);
fz_pop_clip(ctx, pr->dev);
}
diff --git a/source/xps/xps-path.c b/source/xps/xps-path.c
index de078251..81545720 100644
--- a/source/xps/xps-path.c
+++ b/source/xps/xps-path.c
@@ -762,7 +762,7 @@ xps_clip(fz_context *ctx, xps_document *doc, const fz_matrix *ctm, xps_resource
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, NULL, fill_rule == 0, ctm);
+ fz_clip_path(ctx, dev, path, fill_rule == 0, ctm, NULL);
fz_drop_path(ctx, path);
}
@@ -1002,7 +1002,7 @@ xps_parse_path(fz_context *ctx, xps_document *doc, const fz_matrix *ctm, char *b
if (fill_tag)
{
- fz_clip_path(ctx, dev, path, &area, fill_rule == 0, &local_ctm);
+ fz_clip_path(ctx, dev, path, fill_rule == 0, &local_ctm, &area);
xps_parse_brush(ctx, doc, &local_ctm, &area, fill_uri, dict, fill_tag);
fz_pop_clip(ctx, dev);
}
@@ -1020,7 +1020,7 @@ xps_parse_path(fz_context *ctx, xps_document *doc, const fz_matrix *ctm, char *b
if (stroke_tag)
{
- fz_clip_stroke_path(ctx, dev, stroke_path, &area, stroke, &local_ctm);
+ fz_clip_stroke_path(ctx, dev, stroke_path, stroke, &local_ctm, &area);
xps_parse_brush(ctx, doc, &local_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 6cecd9c0..31373ba3 100644
--- a/source/xps/xps-tile.c
+++ b/source/xps/xps-tile.c
@@ -29,7 +29,7 @@ xps_paint_tiling_brush_clipped(fz_context *ctx, xps_document *doc, const fz_matr
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, NULL, 0, ctm);
+ 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);