summaryrefslogtreecommitdiff
path: root/source/fitz/device.c
diff options
context:
space:
mode:
authorTor Andersson <tor.andersson@artifex.com>2016-02-24 13:02:18 +0100
committerTor Andersson <tor.andersson@artifex.com>2016-02-24 13:04:03 +0100
commita9043b470ba26fc5ec06e1d44ae8e9480d75724a (patch)
treeab0f875e720b3f9d74253d58eed5614ac5301756 /source/fitz/device.c
parent35181e818efdc219a8fccf8479a73fa2b5db640f (diff)
downloadmupdf-a9043b470ba26fc5ec06e1d44ae8e9480d75724a.tar.xz
Add optional scissor hint argument to text clipping functions.
Diffstat (limited to 'source/fitz/device.c')
-rw-r--r--source/fitz/device.c30
1 files changed, 20 insertions, 10 deletions
diff --git a/source/fitz/device.c b/source/fitz/device.c
index d9dffc5d..fdee2042 100644
--- a/source/fitz/device.c
+++ b/source/fitz/device.c
@@ -180,7 +180,7 @@ fz_stroke_text(fz_context *ctx, fz_device *dev, const fz_text *text, const fz_st
}
void
-fz_clip_text(fz_context *ctx, fz_device *dev, const fz_text *text, const fz_matrix *ctm)
+fz_clip_text(fz_context *ctx, fz_device *dev, const fz_text *text, const fz_matrix *ctm, const fz_rect *scissor)
{
if (dev->error_depth)
{
@@ -192,12 +192,17 @@ fz_clip_text(fz_context *ctx, fz_device *dev, const fz_text *text, const fz_matr
{
if (dev->hints & FZ_MAINTAIN_CONTAINER_STACK)
{
- fz_rect bbox;
- fz_bound_text(ctx, text, NULL, ctm, &bbox);
- push_clip_stack(ctx, dev, &bbox, fz_device_container_stack_is_clip_text);
+ if (scissor == NULL)
+ {
+ fz_rect bbox;
+ fz_bound_text(ctx, text, NULL, ctm, &bbox);
+ 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);
}
if (dev->clip_text)
- dev->clip_text(ctx, dev, text, ctm);
+ dev->clip_text(ctx, dev, text, ctm, scissor);
}
fz_catch(ctx)
{
@@ -208,7 +213,7 @@ fz_clip_text(fz_context *ctx, fz_device *dev, const fz_text *text, const fz_matr
}
void
-fz_clip_stroke_text(fz_context *ctx, fz_device *dev, const fz_text *text, const fz_stroke_state *stroke, const fz_matrix *ctm)
+fz_clip_stroke_text(fz_context *ctx, fz_device *dev, const fz_text *text, const fz_stroke_state *stroke, const fz_matrix *ctm, const fz_rect *scissor)
{
if (dev->error_depth)
{
@@ -220,12 +225,17 @@ fz_clip_stroke_text(fz_context *ctx, fz_device *dev, const fz_text *text, const
{
if (dev->hints & FZ_MAINTAIN_CONTAINER_STACK)
{
- fz_rect bbox;
- fz_bound_text(ctx, text, stroke, ctm, &bbox);
- push_clip_stack(ctx, dev, &bbox, fz_device_container_stack_is_clip_stroke_text);
+ if (scissor == NULL)
+ {
+ fz_rect bbox;
+ fz_bound_text(ctx, text, stroke, ctm, &bbox);
+ 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);
}
if (dev->clip_stroke_text)
- dev->clip_stroke_text(ctx, dev, text, stroke, ctm);
+ dev->clip_stroke_text(ctx, dev, text, stroke, ctm, scissor);
}
fz_catch(ctx)
{