2009-11-18 Chris Toshok <toshok@ximian.com>
[moon.git] / cairo-patches / 01-tesselate-edges
blob5cf0d70e5ba1e4e3c0f5ce650650fbf33c864d37
1 diff --git a/cairo/src/cairo-bentley-ottmann.c b/cairo/src/cairo-bentley-ottmann.c
2 index 1da9743..d4f9256 100644
3 --- a/cairo/src/cairo-bentley-ottmann.c
4 +++ b/cairo/src/cairo-bentley-ottmann.c
5 @@ -1427,6 +1427,8 @@ _cairo_bentley_ottmann_tessellate_polygon (cairo_traps_t  *traps,
6      cairo_fixed_t ymin = 0x7FFFFFFF;
7      cairo_fixed_t xmax = -0x80000000;
8      cairo_fixed_t ymax = -0x80000000;
9 +    cairo_box_t limit;
10 +    cairo_bool_t has_limits = _cairo_traps_get_limit(traps, &limit);
11      int num_bo_edges;
12      int i;
14 @@ -1471,6 +1473,13 @@ _cairo_bentley_ottmann_tessellate_polygon (cairo_traps_t *traps,
15         cairo_point_t top = polygon->edges[i].edge.p1;
16         cairo_point_t bot = polygon->edges[i].edge.p2;
18 +        /* Discard the edge if traps doesn't care. */
19 +        if (has_limits) {
20 +                /* Strictly above or below the limits? */
21 +                if (bot.y <= limit.p1.y || top.y >= limit.p2.y)
22 +                        continue;
23 +        }
25         /* Offset coordinates into the non-negative range. */
26         top.x -= xmin;
27         top.y -= ymin;
28 diff --git a/cairo/src/cairo-gstate.c b/cairo/src/cairo-gstate.c
29 index 0f35b7f..e0b4cc6 100644
30 --- a/cairo/src/cairo-gstate.c
31 +++ b/cairo/src/cairo-gstate.c
32 @@ -1028,10 +1028,17 @@ _cairo_gstate_in_fill (cairo_gstate_t     *gstate,
33  {
34      cairo_status_t status;
35      cairo_traps_t traps;
36 +    cairo_box_t limit;
38      _cairo_gstate_user_to_backend (gstate, &x, &y);
40 +    limit.p1.x = _cairo_fixed_from_double (x) - 1;
41 +    limit.p1.y = _cairo_fixed_from_double (y) - 1;
42 +    limit.p2.x = limit.p1.x + 2;
43 +    limit.p2.y = limit.p1.y + 2;
45      _cairo_traps_init (&traps);
46 +    _cairo_traps_limit (&traps, &limit);
48      status = _cairo_path_fixed_fill_to_traps (path,
49                                               gstate->fill_rule,