summaryrefslogtreecommitdiff
path: root/draw/draw_edge.c
diff options
context:
space:
mode:
Diffstat (limited to 'draw/draw_edge.c')
-rw-r--r--draw/draw_edge.c50
1 files changed, 38 insertions, 12 deletions
diff --git a/draw/draw_edge.c b/draw/draw_edge.c
index 0ef81f5e..9d595cf4 100644
--- a/draw/draw_edge.c
+++ b/draw/draw_edge.c
@@ -904,25 +904,51 @@ fz_scan_convert_sharp(fz_gel *gel, int eofill, fz_bbox clip,
{
int e = 0;
int y = gel->edges[0].y;
+ int height;
+ gel->alen = 0;
+
+ /* Skip any lines before the clip region */
+ if (y < clip.y0)
+ {
+ while (gel->alen > 0 || e < gel->len)
+ {
+ height = insert_active(gel, y, &e);
+ y += height;
+ if (y >= clip.y0)
+ {
+ height -= y - clip.y0;
+ y = clip.y0;
+ break;
+ }
+ }
+ }
+
+ /* Now process as lines within the clip region */
while (gel->alen > 0 || e < gel->len)
{
- insert_active(gel, y, &e);
+ height = insert_active(gel, y, &e);
- if (y >= clip.y0 && y < clip.y1)
+ if (gel->alen == 0)
+ y += height;
+ else
{
- if (eofill)
- even_odd_sharp(gel, y, clip, dst, color);
- else
- non_zero_winding_sharp(gel, y, clip, dst, color);
- }
+ if (height >= clip.y1 - y)
+ height = clip.y1 - y;
- advance_active(gel, 1);
+ while (height--)
+ {
+ if (eofill)
+ even_odd_sharp(gel, y, clip, dst, color);
+ else
+ non_zero_winding_sharp(gel, y, clip, dst, color);
+ y++;
+ }
+ }
+ if (y >= clip.y1)
+ break;
- if (gel->alen > 0)
- y ++;
- else if (e < gel->len)
- y = gel->edges[e].y;
+ advance_active(gel, height);
}
}