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;
10 + cairo_bool_t has_limits = _cairo_traps_get_limit(traps, &limit);
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. */
20 + /* Strictly above or below the limits? */
21 + if (bot.y <= limit.p1.y || top.y >= limit.p2.y)
25 /* Offset coordinates into the non-negative range. */
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,
34 cairo_status_t status;
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,