gfx/cairo/on-edge.patch

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/gfx/cairo/on-edge.patch	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,70 @@
     1.4 +commit a26655b3144ed273940486fc15ccdac12b0562ec
     1.5 +Author: Jeff Muizelaar <jmuizelaar@mozilla.com>
     1.6 +Date:   Tue Mar 17 15:08:50 2009 -0400
     1.7 +
     1.8 +    Jeff Muizelaar noted that the treatment of edges differed with firefox's
     1.9 +    canvas definition, which considers a point on any edge as inside. The
    1.10 +    current implementation has a similar definition to that of flash, for
    1.11 +    which the top and right edges are outside. Arguably, firefox has the more
    1.12 +    intuitive definition here...
    1.13 +
    1.14 +diff --git a/src/cairo-path-in-fill.c b/src/cairo-path-in-fill.c
    1.15 +index 21cd0bd..e641654 100644
    1.16 +--- a/src/cairo-path-in-fill.c
    1.17 ++++ b/src/cairo-path-in-fill.c
    1.18 +@@ -41,6 +41,7 @@ typedef struct cairo_in_fill {
    1.19 +     int winding;
    1.20 + 
    1.21 +     cairo_fixed_t x, y;
    1.22 ++    cairo_bool_t on_edge;
    1.23 + 
    1.24 +     cairo_bool_t has_current_point;
    1.25 +     cairo_point_t current_point;
    1.26 +@@ -58,6 +59,7 @@ _cairo_in_fill_init (cairo_in_fill_t	*in_fill,
    1.27 + 
    1.28 +     in_fill->x = _cairo_fixed_from_double (x);
    1.29 +     in_fill->y = _cairo_fixed_from_double (y);
    1.30 ++    in_fill->on_edge = FALSE;
    1.31 + 
    1.32 +     in_fill->has_current_point = FALSE;
    1.33 +     in_fill->current_point.x = 0;
    1.34 +@@ -103,6 +105,9 @@ _cairo_in_fill_add_edge (cairo_in_fill_t *in_fill,
    1.35 + {
    1.36 +     int dir;
    1.37 + 
    1.38 ++    if (in_fill->on_edge)
    1.39 ++	return;
    1.40 ++
    1.41 +     /* count the number of edge crossing to -∞ */
    1.42 + 
    1.43 +     dir = 1;
    1.44 +@@ -116,6 +121,18 @@ _cairo_in_fill_add_edge (cairo_in_fill_t *in_fill,
    1.45 + 	dir = -1;
    1.46 +     }
    1.47 + 
    1.48 ++    /* First check whether the query is on an edge */
    1.49 ++    if ((p1->x == in_fill->x && p1->x == in_fill->y) ||
    1.50 ++	(p2->x == in_fill->x && p2->x == in_fill->y) ||
    1.51 ++	(! (p2->y < in_fill->y || p1->y > in_fill->y) &&
    1.52 ++	 ! (p1->x > in_fill->x && p2->x > in_fill->x) &&
    1.53 ++	 ! (p1->x < in_fill->x && p2->x < in_fill->x) &&
    1.54 ++	 edge_compare_for_y_against_x (p1, p2, in_fill->y, in_fill->x) == 0))
    1.55 ++    {
    1.56 ++	in_fill->on_edge = TRUE;
    1.57 ++	return;
    1.58 ++    }
    1.59 ++
    1.60 +     /* edge is entirely above or below, note the shortening rule */
    1.61 +     if (p2->y <= in_fill->y || p1->y > in_fill->y)
    1.62 + 	return;
    1.63 +@@ -246,7 +263,9 @@ _cairo_path_fixed_in_fill (cairo_path_fixed_t	*path,
    1.64 + 
    1.65 +     _cairo_in_fill_close_path (&in_fill);
    1.66 + 
    1.67 +-    switch (fill_rule) {
    1.68 ++    if (in_fill.on_edge) {
    1.69 ++	*is_inside = TRUE;
    1.70 ++    } else switch (fill_rule) {
    1.71 +     case CAIRO_FILL_RULE_EVEN_ODD:
    1.72 + 	*is_inside = in_fill.winding & 1;
    1.73 + 	break;

mercurial