diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2011-07-27 17:02:53 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2011-07-27 17:32:42 +0100 |
commit | cac96c8083214f8e5aa65e9a527f9fa3e813b149 (patch) | |
tree | de3fe588f855a4f7af4cfe136e37e2872a253eb1 /src/cairo-polygon.c | |
parent | 030de5144d6c84b2b690e178ecc03a9bddb52181 (diff) | |
download | cairo-cac96c8083214f8e5aa65e9a527f9fa3e813b149.tar.gz |
polygon: Fix clipping of edges outside of their range
Uli Schlachter analysed the error behind the polygon reduction and
discovered that it was due to the clipping of a line which intersects
the clip box (p1, p2) but is range limited by (top, bottom) to be inside
the clip box.
Fixes hatching
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src/cairo-polygon.c')
-rw-r--r-- | src/cairo-polygon.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/cairo-polygon.c b/src/cairo-polygon.c index 5f2cc31e2..82a5819da 100644 --- a/src/cairo-polygon.c +++ b/src/cairo-polygon.c @@ -359,7 +359,7 @@ _add_clipped_edge (cairo_polygon_t *polygon, p2_y = bottom; if (left_y < right_y) { - if (p1->x < limits->p1.x && left_y > limits->p1.y) { + if (p1->x < limits->p1.x && left_y > top) { p[0].x = limits->p1.x; p[0].y = limits->p1.y; top_y = p1_y; @@ -377,7 +377,7 @@ _add_clipped_edge (cairo_polygon_t *polygon, p1_y = bot_y; } - if (p2->x > limits->p2.x && right_y < limits->p2.y) { + if (p2->x > limits->p2.x && right_y < bottom) { p[0].x = limits->p2.x; p[0].y = limits->p1.y; top_y = right_y; @@ -395,7 +395,7 @@ _add_clipped_edge (cairo_polygon_t *polygon, p2_y = top_y; } } else { - if (p1->x > limits->p2.x && right_y > limits->p1.y) { + if (p1->x > limits->p2.x && right_y > top) { p[0].x = limits->p2.x; p[0].y = limits->p1.y; top_y = p1_y; @@ -413,7 +413,7 @@ _add_clipped_edge (cairo_polygon_t *polygon, p1_y = bot_y; } - if (p2->x < limits->p1.x && left_y < limits->p2.y) { + if (p2->x < limits->p1.x && left_y < bottom) { p[0].x = limits->p1.x; p[0].y = limits->p1.y; top_y = left_y; |