[cairo-commit] 2 commits - src/cairo-spans-compositor.c src/cairo-tor22-scan-converter.c src/cairo-tor-scan-converter.c

Chris Wilson ickle at kemper.freedesktop.org
Thu Sep 27 07:32:06 PDT 2012


 src/cairo-spans-compositor.c     |   10 +++++++---
 src/cairo-tor-scan-converter.c   |    2 +-
 src/cairo-tor22-scan-converter.c |    2 +-
 3 files changed, 9 insertions(+), 5 deletions(-)

New commits:
commit 797441093a8346003552e0cf89aef2a644ff53ab
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Thu Sep 27 15:21:42 2012 +0100

    tor: Fudge the edge if it is projected into a point
    
    If we generate an edge (through polygon-intersect) where its end-points
    lie outside the line definition then it is possible for that line to be
    degenerate under sample grid projection. Apply a fudge factor to prevent
    explosions as otherwise we reject an edge whose height is not strictly
    0.
    
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=54822
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/cairo-tor-scan-converter.c b/src/cairo-tor-scan-converter.c
index 8233260..89ef20f 100644
--- a/src/cairo-tor-scan-converter.c
+++ b/src/cairo-tor-scan-converter.c
@@ -1506,7 +1506,7 @@ glitter_scan_converter_add_edge (glitter_scan_converter_t *converter,
     INPUT_TO_GRID_Y (edge->line.p1.y, e.line.p1.y);
     INPUT_TO_GRID_Y (edge->line.p2.y, e.line.p2.y);
     if (e.line.p1.y == e.line.p2.y)
-	return;
+	e.line.p2.y++; /* little fudge to prevent a div-by-zero */
 
     INPUT_TO_GRID_X (edge->line.p1.x, e.line.p1.x);
     INPUT_TO_GRID_X (edge->line.p2.x, e.line.p2.x);
diff --git a/src/cairo-tor22-scan-converter.c b/src/cairo-tor22-scan-converter.c
index b4cdd6c..4cec5ee 100644
--- a/src/cairo-tor22-scan-converter.c
+++ b/src/cairo-tor22-scan-converter.c
@@ -1362,7 +1362,7 @@ glitter_scan_converter_add_edge (glitter_scan_converter_t *converter,
     INPUT_TO_GRID_Y (edge->line.p1.y, e.line.p1.y);
     INPUT_TO_GRID_Y (edge->line.p2.y, e.line.p2.y);
     if (e.line.p1.y == e.line.p2.y)
-	return;
+	e.line.p2.y++; /* Fudge to prevent div-by-zero */
 
     INPUT_TO_GRID_X (edge->line.p1.x, e.line.p1.x);
     INPUT_TO_GRID_X (edge->line.p2.x, e.line.p2.x);
commit cabb3c3bdf3153719b0ee538ea1b66137dc89085
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Thu Sep 27 12:21:00 2012 +0100

    spans-compositor: Remove polygon limits after construction
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/cairo-spans-compositor.c b/src/cairo-spans-compositor.c
index 031ccbb..ffbf56f 100644
--- a/src/cairo-spans-compositor.c
+++ b/src/cairo-spans-compositor.c
@@ -111,6 +111,8 @@ get_clip_surface (const cairo_spans_compositor_t *compositor,
     if (unlikely (status))
 	goto cleanup_polygon;
 
+    polygon.num_limits = 0;
+
     antialias = clip_path->antialias;
     fill_rule = clip_path->fill_rule;
 
@@ -918,9 +920,6 @@ clip_and_composite_polygon (const cairo_spans_compositor_t	*compositor,
 	    cairo_clip_t *old_clip;
 
 	    if (clip_antialias == antialias) {
-		/* refresh limits after trimming extents */
-		_cairo_polygon_limit_to_clip(polygon, extents->clip);
-
 		status = _cairo_polygon_intersect (polygon, fill_rule,
 						   &clipper, clip_fill_rule);
 		_cairo_polygon_fini (&clipper);
@@ -1040,6 +1039,8 @@ _cairo_spans_compositor_stroke (const cairo_compositor_t	*_compositor,
 						      tolerance,
 						      &polygon);
 	TRACE_ (_cairo_debug_print_polygon (stderr, &polygon));
+	polygon.num_limits = 0;
+
 	if (status == CAIRO_INT_STATUS_SUCCESS && extents->clip->num_boxes > 1) {
 	    status = _cairo_polygon_intersect_with_boxes (&polygon, &fill_rule,
 							  extents->clip->boxes,
@@ -1123,6 +1124,9 @@ _cairo_spans_compositor_fill (const cairo_compositor_t		*_compositor,
 	}
 
 	status = _cairo_path_fixed_fill_to_polygon (path, tolerance, &polygon);
+	TRACE_ (_cairo_debug_print_polygon (stderr, &polygon));
+	polygon.num_limits = 0;
+
 	if (status == CAIRO_INT_STATUS_SUCCESS && extents->clip->num_boxes > 1) {
 	    TRACE((stderr, "%s - polygon intersect with %d clip boxes\n",
 		   __FUNCTION__, extents->clip->num_boxes));


More information about the cairo-commit mailing list