Index: ChangeLog =================================================================== RCS file: /cvs/cairo/cairo/ChangeLog,v retrieving revision 1.1076 diff -u -r1.1076 ChangeLog --- ChangeLog 29 Sep 2005 21:31:08 -0000 1.1076 +++ ChangeLog 30 Sep 2005 00:14:59 -0000 @@ -1,3 +1,10 @@ +2005-09-30 Bertram Felgenhauer + + * src/cairo-hull.c (_cairo_hull_create), + (_cairo_hull_vertex_compare): Using a pointer comparison as the + fallback total order was wrong - these pointers are not stable. + So we introduce our own total order instead. + 2005-09-29 Keith Packard reviewed by: cworth Index: src/cairo-hull.c =================================================================== RCS file: /cvs/cairo/cairo/src/cairo-hull.c,v retrieving revision 1.9 diff -u -r1.9 cairo-hull.c --- src/cairo-hull.c 21 Aug 2005 18:41:44 -0000 1.9 +++ src/cairo-hull.c 30 Sep 2005 00:14:59 -0000 @@ -41,6 +41,7 @@ cairo_point_t point; cairo_slope_t slope; int discard; + int id; } cairo_hull_t; static cairo_hull_t * @@ -70,10 +71,13 @@ _cairo_slope_init (&hull[i].slope, &hull[0].point, &hull[i].point); /* Discard all points coincident with the extremal point */ - if (i != 0 && hull[i].slope.dx == 0 && hull[i].slope.dy == 0) + if (i != 0 && hull[i].slope.dx == 0 && hull[i].slope.dy == 0) { hull[i].discard = 1; - else + hull[i].id = -i; + } else { hull[i].discard = 0; + hull[i].id = i; + } } return hull; @@ -98,11 +102,11 @@ b_dist = ((cairo_fixed_48_16_t) b->slope.dx * b->slope.dx + (cairo_fixed_48_16_t) b->slope.dy * b->slope.dy); /* - * Use pointer comparison for coincident points to ensure + * Use the point's ids to ensure a total ordering. * a well-defined ordering, and avoid setting discard on - * both points. + * both points. */ - if (a_dist < b_dist || (a_dist == b_dist && a < b)) { + if (a_dist < b_dist || (a_dist == b_dist && a->id < b->id)) { a->discard = 1; ret = -1; } else {