summaryrefslogtreecommitdiff
path: root/draw
diff options
context:
space:
mode:
authorRobin Watts <robin.watts@artifex.com>2012-12-04 15:26:11 +0000
committerRobin Watts <robin.watts@artifex.com>2012-12-08 19:14:21 -0800
commit720859de828cb23d1c3f80a411f7f3e4ff4fd510 (patch)
tree6f0ec606060bee6642da2ae58eed3b3fb2b73a3e /draw
parentba320fc3c2be0344f096dbf2a95d61f83ffba1f3 (diff)
downloadmupdf-720859de828cb23d1c3f80a411f7f3e4ff4fd510.tar.xz
Optimise sharp scan conversion as we did with aa scan conversion.
In doing this work, it strikes me that there is an unoptimised case left in the aa scan conversion; when we are plotting whole scanlines with gel->alen = 0, we can skip the entire blit. This happens relatively rarely so the extra cost of the test may be more than is worthwhile.
Diffstat (limited to 'draw')
-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);
}
}