[cairo-commit] 2 commits - src/cairo-bentley-ottmann.c src/cairo-gstate.c
Chris Wilson
ickle at kemper.freedesktop.org
Wed Sep 24 09:55:46 PDT 2008
src/cairo-bentley-ottmann.c | 11 +++++++++++
src/cairo-gstate.c | 14 ++++++++++++++
2 files changed, 25 insertions(+)
New commits:
commit b5b1134c2c84996bd8e019d5908b18db876137dc
Author: M Joonas Pihlaja <jpihlaja at cc.helsinki.fi>
Date: Wed Sep 24 17:39:33 2008 +0100
[tessellator] Skip edges that lie outside the region of interest.
We don't need to tessellate edges strictly above or below the
the limits of the traps.
diff --git a/src/cairo-bentley-ottmann.c b/src/cairo-bentley-ottmann.c
index b5c757e..6e46476 100644
--- a/src/cairo-bentley-ottmann.c
+++ b/src/cairo-bentley-ottmann.c
@@ -1430,12 +1430,16 @@ _cairo_bentley_ottmann_tessellate_polygon (cairo_traps_t *traps,
cairo_fixed_t ymin = 0x7FFFFFFF;
cairo_fixed_t xmax = -0x80000000;
cairo_fixed_t ymax = -0x80000000;
+ cairo_box_t limit;
+ cairo_bool_t has_limits;
int num_bo_edges;
int i;
if (0 == polygon->num_edges)
return CAIRO_STATUS_SUCCESS;
+ has_limits = _cairo_traps_get_limit (traps, &limit);
+
if (polygon->num_edges < ARRAY_LENGTH (stack_edges)) {
edges = stack_edges;
} else {
@@ -1474,6 +1478,13 @@ _cairo_bentley_ottmann_tessellate_polygon (cairo_traps_t *traps,
cairo_point_t top = polygon->edges[i].edge.p1;
cairo_point_t bot = polygon->edges[i].edge.p2;
+ /* Discard the edge if it lies outside the limits of traps. */
+ if (has_limits) {
+ /* Strictly above or below the limits? */
+ if (bot.y <= limit.p1.y || top.y >= limit.p2.y)
+ continue;
+ }
+
/* Offset coordinates into the non-negative range. */
top.x -= xmin;
top.y -= ymin;
commit 018a64bf7f3ccdf3982655c93701eafc99fd0b93
Author: M Joonas Pihlaja <jpihlaja at cc.helsinki.fi>
Date: Wed Sep 24 17:33:36 2008 +0100
[traps] Impose limits on traps for cairo_in_(fill|stroke)
We don't need to tessellate edges strictly above or below the
hit-test point.
(Patch split and modified by Chris Wilson to apply to cairo_in_stroke()
as well - all bugs are his alone.)
diff --git a/src/cairo-gstate.c b/src/cairo-gstate.c
index 7c80d09..b4fb5a4 100644
--- a/src/cairo-gstate.c
+++ b/src/cairo-gstate.c
@@ -945,6 +945,7 @@ _cairo_gstate_in_stroke (cairo_gstate_t *gstate,
cairo_bool_t *inside_ret)
{
cairo_status_t status;
+ cairo_box_t limit;
cairo_traps_t traps;
if (gstate->stroke_style.line_width <= 0.0) {
@@ -954,7 +955,13 @@ _cairo_gstate_in_stroke (cairo_gstate_t *gstate,
_cairo_gstate_user_to_backend (gstate, &x, &y);
+ limit.p1.x = _cairo_fixed_from_double (x) - 1;
+ limit.p1.y = _cairo_fixed_from_double (y) - 1;
+ limit.p2.x = limit.p1.x + 2;
+ limit.p2.y = limit.p1.y + 2;
+
_cairo_traps_init (&traps);
+ _cairo_traps_limit (&traps, &limit);
status = _cairo_path_fixed_stroke_to_traps (path,
&gstate->stroke_style,
@@ -1011,11 +1018,18 @@ _cairo_gstate_in_fill (cairo_gstate_t *gstate,
cairo_bool_t *inside_ret)
{
cairo_status_t status;
+ cairo_box_t limit;
cairo_traps_t traps;
_cairo_gstate_user_to_backend (gstate, &x, &y);
+ limit.p1.x = _cairo_fixed_from_double (x) - 1;
+ limit.p1.y = _cairo_fixed_from_double (y) - 1;
+ limit.p2.x = limit.p1.x + 2;
+ limit.p2.y = limit.p1.y + 2;
+
_cairo_traps_init (&traps);
+ _cairo_traps_limit (&traps, &limit);
status = _cairo_path_fixed_fill_to_traps (path,
gstate->fill_rule,
More information about the cairo-commit
mailing list