summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2012-09-27 15:21:42 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2012-09-27 15:29:36 +0100
commit797441093a8346003552e0cf89aef2a644ff53ab (patch)
treee80f529603ec322a2c08a9c65ff78c7b32a8c3da
parentcabb3c3bdf3153719b0ee538ea1b66137dc89085 (diff)
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@chris-wilson.co.uk>
-rw-r--r--src/cairo-tor-scan-converter.c2
-rw-r--r--src/cairo-tor22-scan-converter.c2
2 files changed, 2 insertions, 2 deletions
diff --git a/src/cairo-tor-scan-converter.c b/src/cairo-tor-scan-converter.c
index 823326064..89ef20f09 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 b4cdd6ce5..4cec5ee4f 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);