diff options
author | Tor Andersson <tor.andersson@artifex.com> | 2016-02-24 13:02:18 +0100 |
---|---|---|
committer | Tor Andersson <tor.andersson@artifex.com> | 2016-02-24 13:04:03 +0100 |
commit | a9043b470ba26fc5ec06e1d44ae8e9480d75724a (patch) | |
tree | ab0f875e720b3f9d74253d58eed5614ac5301756 /source/fitz/draw-device.c | |
parent | 35181e818efdc219a8fccf8479a73fa2b5db640f (diff) | |
download | mupdf-a9043b470ba26fc5ec06e1d44ae8e9480d75724a.tar.xz |
Add optional scissor hint argument to text clipping functions.
Diffstat (limited to 'source/fitz/draw-device.c')
-rw-r--r-- | source/fitz/draw-device.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/source/fitz/draw-device.c b/source/fitz/draw-device.c index 978e81cc..83195cd1 100644 --- a/source/fitz/draw-device.c +++ b/source/fitz/draw-device.c @@ -708,7 +708,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, const fz_matrix *ctm) +fz_draw_clip_text(fz_context *ctx, fz_device *devp, const fz_text *text, const fz_matrix *ctm, const fz_rect *scissor) { fz_draw_device *dev = (fz_draw_device*)devp; fz_irect bbox; @@ -728,6 +728,11 @@ fz_draw_clip_text(fz_context *ctx, fz_device *devp, const fz_text *text, const f /* make the mask the exact size needed */ fz_irect_from_rect(&bbox, fz_bound_text(ctx, text, NULL, ctm, &rect)); fz_intersect_irect(&bbox, &state->scissor); + if (scissor) + { + fz_irect bbox2; + fz_intersect_irect(&bbox, fz_irect_from_rect(&bbox2, scissor)); + } fz_try(ctx) { @@ -821,7 +826,7 @@ fz_draw_clip_text(fz_context *ctx, fz_device *devp, const fz_text *text, const f } static void -fz_draw_clip_stroke_text(fz_context *ctx, fz_device *devp, const fz_text *text, const fz_stroke_state *stroke, const fz_matrix *ctm) +fz_draw_clip_stroke_text(fz_context *ctx, fz_device *devp, const fz_text *text, const fz_stroke_state *stroke, const fz_matrix *ctm, const fz_rect *scissor) { fz_draw_device *dev = (fz_draw_device*)devp; fz_irect bbox; @@ -838,6 +843,11 @@ fz_draw_clip_stroke_text(fz_context *ctx, fz_device *devp, const fz_text *text, /* make the mask the exact size needed */ fz_irect_from_rect(&bbox, fz_bound_text(ctx, text, stroke, ctm, &rect)); fz_intersect_irect(&bbox, &state->scissor); + if (scissor) + { + fz_irect bbox2; + fz_intersect_irect(&bbox, fz_irect_from_rect(&bbox2, scissor)); + } fz_try(ctx) { |