summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source/fitz/draw-device.c33
-rw-r--r--source/fitz/draw-imp.h6
-rw-r--r--source/fitz/draw-path.c14
3 files changed, 25 insertions, 28 deletions
diff --git a/source/fitz/draw-device.c b/source/fitz/draw-device.c
index dba64d3f..88cb0a03 100644
--- a/source/fitz/draw-device.c
+++ b/source/fitz/draw-device.c
@@ -295,8 +295,7 @@ fz_draw_fill_path(fz_context *ctx, fz_device *devp, const fz_path *path, int eve
if (flatness < 0.001f)
flatness = 0.001f;
- fz_reset_gel(ctx, gel, &state->scissor);
- fz_flatten_fill_path(ctx, gel, path, &ctm, flatness);
+ fz_flatten_fill_path(ctx, gel, path, &ctm, flatness, &state->scissor);
fz_intersect_irect(fz_bound_gel(ctx, gel, &bbox), &state->scissor);
@@ -320,8 +319,7 @@ fz_draw_fill_path(fz_context *ctx, fz_device *devp, const fz_path *path, int eve
fz_scan_convert(ctx, gel, even_odd, &bbox, state->dest, colorbv);
if (state->shape)
{
- fz_reset_gel(ctx, gel, &state->scissor);
- fz_flatten_fill_path(ctx, gel, path, &ctm, flatness);
+ fz_flatten_fill_path(ctx, gel, path, &ctm, flatness, &state->scissor);
colorbv[0] = alpha * 255;
fz_scan_convert(ctx, gel, even_odd, &bbox, state->shape, colorbv);
@@ -361,11 +359,10 @@ fz_draw_stroke_path(fz_context *ctx, fz_device *devp, const fz_path *path, const
if (flatness < 0.001f)
flatness = 0.001f;
- fz_reset_gel(ctx, gel, &state->scissor);
if (stroke->dash_len > 0)
- fz_flatten_dash_path(ctx, gel, path, stroke, &ctm, flatness, linewidth);
+ fz_flatten_dash_path(ctx, gel, path, stroke, &ctm, flatness, linewidth, &state->scissor);
else
- fz_flatten_stroke_path(ctx, gel, path, stroke, &ctm, flatness, linewidth);
+ fz_flatten_stroke_path(ctx, gel, path, stroke, &ctm, flatness, linewidth, &state->scissor);
fz_intersect_irect(fz_bound_gel(ctx, gel, &bbox), &state->scissor);
@@ -396,11 +393,10 @@ fz_draw_stroke_path(fz_context *ctx, fz_device *devp, const fz_path *path, const
fz_scan_convert(ctx, gel, 0, &bbox, state->dest, colorbv);
if (state->shape)
{
- fz_reset_gel(ctx, gel, &state->scissor);
if (stroke->dash_len > 0)
- fz_flatten_dash_path(ctx, gel, path, stroke, &ctm, flatness, linewidth);
+ fz_flatten_dash_path(ctx, gel, path, stroke, &ctm, flatness, linewidth, &state->scissor);
else
- fz_flatten_stroke_path(ctx, gel, path, stroke, &ctm, flatness, linewidth);
+ fz_flatten_stroke_path(ctx, gel, path, stroke, &ctm, flatness, linewidth, &state->scissor);
colorbv[0] = 255;
fz_scan_convert(ctx, gel, 0, &bbox, state->shape, colorbv);
@@ -433,8 +429,7 @@ fz_draw_clip_path(fz_context *ctx, fz_device *devp, const fz_path *path, int eve
if (flatness < 0.001f)
flatness = 0.001f;
- fz_reset_gel(ctx, gel, &state->scissor);
- fz_flatten_fill_path(ctx, gel, path, &ctm, flatness);
+ fz_flatten_fill_path(ctx, gel, path, &ctm, flatness, &state->scissor);
state = push_stack(ctx, dev);
STACK_PUSHED("clip path");
@@ -508,11 +503,10 @@ fz_draw_clip_stroke_path(fz_context *ctx, fz_device *devp, const fz_path *path,
if (flatness < 0.001f)
flatness = 0.001f;
- fz_reset_gel(ctx, gel, &state->scissor);
if (stroke->dash_len > 0)
- fz_flatten_dash_path(ctx, gel, path, stroke, &ctm, flatness, linewidth);
+ fz_flatten_dash_path(ctx, gel, path, stroke, &ctm, flatness, linewidth, &state->scissor);
else
- fz_flatten_stroke_path(ctx, gel, path, stroke, &ctm, flatness, linewidth);
+ fz_flatten_stroke_path(ctx, gel, path, stroke, &ctm, flatness, linewidth, &state->scissor);
state = push_stack(ctx, dev);
STACK_PUSHED("clip stroke");
@@ -2379,16 +2373,13 @@ fz_bound_path_accurate(fz_context *ctx, fz_irect *bbox, const fz_irect *scissor,
{
fz_gel *gel = fz_new_gel(ctx);
- fz_reset_gel(ctx, gel, scissor);
if (stroke)
- {
if (stroke->dash_len > 0)
- fz_flatten_dash_path(ctx, gel, path, stroke, ctm, flatness, linewidth);
+ fz_flatten_dash_path(ctx, gel, path, stroke, ctm, flatness, linewidth, scissor);
else
- fz_flatten_stroke_path(ctx, gel, path, stroke, ctm, flatness, linewidth);
- }
+ fz_flatten_stroke_path(ctx, gel, path, stroke, ctm, flatness, linewidth, scissor);
else
- fz_flatten_fill_path(ctx, gel, path, ctm, flatness);
+ fz_flatten_fill_path(ctx, gel, path, ctm, flatness, scissor);
fz_bound_gel(ctx, gel, bbox);
fz_drop_gel(ctx, gel);
diff --git a/source/fitz/draw-imp.h b/source/fitz/draw-imp.h
index a8746b4c..52c10257 100644
--- a/source/fitz/draw-imp.h
+++ b/source/fitz/draw-imp.h
@@ -18,9 +18,9 @@ fz_rect *fz_gel_scissor(fz_context *ctx, const fz_gel *gel, fz_rect *rect);
void fz_scan_convert(fz_context *ctx, fz_gel *gel, int eofill, const fz_irect *clip, fz_pixmap *pix, unsigned char *colorbv);
-void fz_flatten_fill_path(fz_context *ctx, fz_gel *gel, const fz_path *path, const fz_matrix *ctm, float flatness);
-void fz_flatten_stroke_path(fz_context *ctx, fz_gel *gel, const fz_path *path, const fz_stroke_state *stroke, const fz_matrix *ctm, float flatness, float linewidth);
-void fz_flatten_dash_path(fz_context *ctx, fz_gel *gel, const fz_path *path, const fz_stroke_state *stroke, const fz_matrix *ctm, float flatness, float linewidth);
+void fz_flatten_fill_path(fz_context *ctx, fz_gel *gel, const fz_path *path, const fz_matrix *ctm, float flatness, const fz_irect *irect);
+void fz_flatten_stroke_path(fz_context *ctx, fz_gel *gel, const fz_path *path, const fz_stroke_state *stroke, const fz_matrix *ctm, float flatness, float linewidth, const fz_irect *irect);
+void fz_flatten_dash_path(fz_context *ctx, fz_gel *gel, const fz_path *path, const fz_stroke_state *stroke, const fz_matrix *ctm, float flatness, float linewidth, const fz_irect *irect);
fz_irect *fz_bound_path_accurate(fz_context *ctx, fz_irect *bbox, const fz_irect *scissor, const fz_path *path, const fz_stroke_state *stroke, const fz_matrix *ctm, float flatness, float linewidth);
diff --git a/source/fitz/draw-path.c b/source/fitz/draw-path.c
index b82fad4f..5945766b 100644
--- a/source/fitz/draw-path.c
+++ b/source/fitz/draw-path.c
@@ -215,10 +215,12 @@ static const fz_path_walker flatten_proc =
};
void
-fz_flatten_fill_path(fz_context *ctx, fz_gel *gel, const fz_path *path, const fz_matrix *ctm, float flatness)
+fz_flatten_fill_path(fz_context *ctx, fz_gel *gel, const fz_path *path, const fz_matrix *ctm, float flatness, const fz_irect *scissor)
{
flatten_arg arg;
+ fz_reset_gel(ctx, gel, scissor);
+
arg.gel = gel;
arg.ctm = ctm;
arg.flatness = flatness;
@@ -842,10 +844,12 @@ static const fz_path_walker stroke_proc =
};
void
-fz_flatten_stroke_path(fz_context *ctx, fz_gel *gel, const fz_path *path, const fz_stroke_state *stroke, const fz_matrix *ctm, float flatness, float linewidth)
+fz_flatten_stroke_path(fz_context *ctx, fz_gel *gel, const fz_path *path, const fz_stroke_state *stroke, const fz_matrix *ctm, float flatness, float linewidth, const fz_irect *scissor)
{
struct sctx s;
+ fz_reset_gel(ctx, gel, scissor);
+
s.stroke = stroke;
s.gel = gel;
s.ctm = ctm;
@@ -1301,13 +1305,15 @@ static const fz_path_walker dash_proc =
};
void
-fz_flatten_dash_path(fz_context *ctx, fz_gel *gel, const fz_path *path, const fz_stroke_state *stroke, const fz_matrix *ctm, float flatness, float linewidth)
+fz_flatten_dash_path(fz_context *ctx, fz_gel *gel, const fz_path *path, const fz_stroke_state *stroke, const fz_matrix *ctm, float flatness, float linewidth, const fz_irect *scissor)
{
struct sctx s;
float max_expand;
int i;
fz_matrix inv;
+ fz_reset_gel(ctx, gel, scissor);
+
s.stroke = stroke;
s.gel = gel;
s.ctm = ctm;
@@ -1346,7 +1352,7 @@ fz_flatten_dash_path(fz_context *ctx, fz_gel *gel, const fz_path *path, const fz
max_expand = fz_matrix_max_expansion(ctm);
if (s.dash_total < 0.01f || s.dash_total * max_expand < 0.5f)
{
- fz_flatten_stroke_path(ctx, gel, path, stroke, ctm, flatness, linewidth);
+ fz_flatten_stroke_path(ctx, gel, path, stroke, ctm, flatness, linewidth, scissor);
return;
}