From 87e828aea737b2e18b9941d5d7888cd4c673627e Mon Sep 17 00:00:00 2001 From: Robin Watts Date: Thu, 13 Apr 2017 09:53:51 +0100 Subject: Scan converter; simplify API. In all cases, we sort the gel before scan converting it. So just roll the sort call into the scan convert call. --- source/fitz/draw-device.c | 6 ------ source/fitz/draw-edge.c | 6 ++++-- source/fitz/draw-imp.h | 1 - 3 files changed, 4 insertions(+), 9 deletions(-) diff --git a/source/fitz/draw-device.c b/source/fitz/draw-device.c index 25323b15..dba64d3f 100644 --- a/source/fitz/draw-device.c +++ b/source/fitz/draw-device.c @@ -297,7 +297,6 @@ fz_draw_fill_path(fz_context *ctx, fz_device *devp, const fz_path *path, int eve fz_reset_gel(ctx, gel, &state->scissor); fz_flatten_fill_path(ctx, gel, path, &ctm, flatness); - fz_sort_gel(ctx, gel); fz_intersect_irect(fz_bound_gel(ctx, gel, &bbox), &state->scissor); @@ -323,7 +322,6 @@ fz_draw_fill_path(fz_context *ctx, fz_device *devp, const fz_path *path, int eve { fz_reset_gel(ctx, gel, &state->scissor); fz_flatten_fill_path(ctx, gel, path, &ctm, flatness); - fz_sort_gel(ctx, gel); colorbv[0] = alpha * 255; fz_scan_convert(ctx, gel, even_odd, &bbox, state->shape, colorbv); @@ -368,7 +366,6 @@ fz_draw_stroke_path(fz_context *ctx, fz_device *devp, const fz_path *path, const fz_flatten_dash_path(ctx, gel, path, stroke, &ctm, flatness, linewidth); else fz_flatten_stroke_path(ctx, gel, path, stroke, &ctm, flatness, linewidth); - fz_sort_gel(ctx, gel); fz_intersect_irect(fz_bound_gel(ctx, gel, &bbox), &state->scissor); @@ -404,7 +401,6 @@ fz_draw_stroke_path(fz_context *ctx, fz_device *devp, const fz_path *path, const fz_flatten_dash_path(ctx, gel, path, stroke, &ctm, flatness, linewidth); else fz_flatten_stroke_path(ctx, gel, path, stroke, &ctm, flatness, linewidth); - fz_sort_gel(ctx, gel); colorbv[0] = 255; fz_scan_convert(ctx, gel, 0, &bbox, state->shape, colorbv); @@ -439,7 +435,6 @@ fz_draw_clip_path(fz_context *ctx, fz_device *devp, const fz_path *path, int eve fz_reset_gel(ctx, gel, &state->scissor); fz_flatten_fill_path(ctx, gel, path, &ctm, flatness); - fz_sort_gel(ctx, gel); state = push_stack(ctx, dev); STACK_PUSHED("clip path"); @@ -518,7 +513,6 @@ fz_draw_clip_stroke_path(fz_context *ctx, fz_device *devp, const fz_path *path, fz_flatten_dash_path(ctx, gel, path, stroke, &ctm, flatness, linewidth); else fz_flatten_stroke_path(ctx, gel, path, stroke, &ctm, flatness, linewidth); - fz_sort_gel(ctx, gel); state = push_stack(ctx, dev); STACK_PUSHED("clip stroke"); diff --git a/source/fitz/draw-edge.c b/source/fitz/draw-edge.c index 4465d90a..43394fcb 100644 --- a/source/fitz/draw-edge.c +++ b/source/fitz/draw-edge.c @@ -587,8 +587,8 @@ cmpedge(const void *va, const void *vb) return a->y - b->y; } -void -fz_sort_gel(fz_context *ctx, fz_gel *gel) +static void +sort_gel(fz_context *ctx, fz_gel *gel) { fz_edge *a = gel->edges; int n = gel->len; @@ -1160,6 +1160,8 @@ fz_scan_convert(fz_context *ctx, fz_gel *gel, int eofill, const fz_irect *clip, if (fz_is_empty_irect(fz_intersect_irect(fz_pixmap_bbox_no_ctx(dst, &local_clip), clip))) return; + sort_gel(ctx, gel); + if (fz_aa_bits > 0) { void *fn; diff --git a/source/fitz/draw-imp.h b/source/fitz/draw-imp.h index 228324cc..a8746b4c 100644 --- a/source/fitz/draw-imp.h +++ b/source/fitz/draw-imp.h @@ -11,7 +11,6 @@ fz_gel *fz_new_gel(fz_context *ctx); void fz_insert_gel(fz_context *ctx, fz_gel *gel, float x0, float y0, float x1, float y1); void fz_insert_gel_rect(fz_context *ctx, fz_gel *gel, float x0, float y0, float x1, float y1); void fz_reset_gel(fz_context *ctx, fz_gel *gel, const fz_irect *clip); -void fz_sort_gel(fz_context *ctx, fz_gel *gel); fz_irect *fz_bound_gel(fz_context *ctx, const fz_gel *gel, fz_irect *bbox); void fz_drop_gel(fz_context *ctx, fz_gel *gel); int fz_is_rect_gel(fz_context *ctx, fz_gel *gel); -- cgit v1.2.3