diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2013-02-08 13:22:01 +0000 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2013-02-08 13:22:01 +0000 |
commit | ea16302e45ced56e6f12b8520e9f530e1ffc68c4 (patch) | |
tree | 755a7bd7237cd988d110b603708bd4f89fa63bbe | |
parent | 8cfbdf2f02ba01d5638a91c9f3f7fc228b402caa (diff) |
polygon: Avoid computing the unused intersection coordinates
If we only ignore the result of the computed boundary intersection,
because the edge is inside that boundary, then we can simply forgo the
calculation.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r-- | src/cairo-polygon.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/cairo-polygon.c b/src/cairo-polygon.c index 4c5861df..b0424f6e 100644 --- a/src/cairo-polygon.c +++ b/src/cairo-polygon.c @@ -390,11 +390,6 @@ _add_clipped_edge (cairo_polygon_t *polygon, cairo_fixed_t left_y, right_y; cairo_bool_t top_left_to_bottom_right; - left_y = _cairo_edge_compute_intersection_y_for_x (p1, p2, - limits->p1.x); - right_y = _cairo_edge_compute_intersection_y_for_x (p1, p2, - limits->p2.x); - /* * The edge intersects the lines corresponding to the left * and right sides of the limit box at left_y and right_y, @@ -425,6 +420,8 @@ _add_clipped_edge (cairo_polygon_t *polygon, if (pleft >= limits->p1.x) { left_y = top_y; } else { + left_y = _cairo_edge_compute_intersection_y_for_x (p1, p2, + limits->p1.x); if (_cairo_edge_compute_intersection_x_for_y (p1, p2, left_y) < limits->p1.x) left_y++; } @@ -440,6 +437,8 @@ _add_clipped_edge (cairo_polygon_t *polygon, if (pright <= limits->p2.x) { right_y = bot_y; } else { + right_y = _cairo_edge_compute_intersection_y_for_x (p1, p2, + limits->p2.x); if (_cairo_edge_compute_intersection_x_for_y (p1, p2, right_y) > limits->p2.x) right_y--; } @@ -455,6 +454,8 @@ _add_clipped_edge (cairo_polygon_t *polygon, if (pright <= limits->p2.x) { right_y = top_y; } else { + right_y = _cairo_edge_compute_intersection_y_for_x (p1, p2, + limits->p2.x); if (_cairo_edge_compute_intersection_x_for_y (p1, p2, right_y) > limits->p2.x) right_y++; } @@ -470,6 +471,8 @@ _add_clipped_edge (cairo_polygon_t *polygon, if (pleft >= limits->p1.x) { left_y = bot_y; } else { + left_y = _cairo_edge_compute_intersection_y_for_x (p1, p2, + limits->p1.x); if (_cairo_edge_compute_intersection_x_for_y (p1, p2, left_y) < limits->p1.x) left_y--; } |