[cairo] Fix for get-path-extents test cases

Bryce W. Harrington b.harrington at samsung.com
Wed Jun 19 15:51:34 PDT 2013


Chris,

I ran across bug 62375 about the get-path-extents test case breakage.  You posted a patch there a few months back, to switch from _cairo_path_fixed_stroke_polygon_to_traps() to just _cairo_path_fixed_stroke_to_polygon(), which makes a couple dozen tests pass (below) and none fail.  The former appears to be running _cairo_bentley_ottmann_tessellate_polygon over the polygon and I gather this was what breaks the test.  Unfortunately the output files for this test seem to be empty when it passes, so I'm not sure what's happening here.

Could you elaborate on your thoughts regarding that patch?  Is it just a workaround, or would it be suitable as a fix?

Bryce

https://bugs.freedesktop.org/show_bug.cgi?id=62375#c4

FAIL -> PASS # TEST: device-offset TARGET: xlib-render-0_0 FORMAT: rgb24 OFFSET: 0 SIMILAR: 0
FAIL -> PASS # TEST: get-path-extents TARGET: svg11 FORMAT: argb32 OFFSET: 0 SIMILAR: 0
FAIL -> PASS # TEST: get-path-extents TARGET: svg11 FORMAT: rgb24 OFFSET: 0 SIMILAR: 0
FAIL -> PASS # TEST: get-path-extents TARGET: svg12 FORMAT: argb32 OFFSET: 0 SIMILAR: 0
FAIL -> PASS # TEST: get-path-extents TARGET: svg12 FORMAT: rgb24 OFFSET: 0 SIMILAR: 0
FAIL -> PASS # TEST: get-path-extents TARGET: pdf FORMAT: argb32 OFFSET: 0 SIMILAR: 0
FAIL -> PASS # TEST: get-path-extents TARGET: pdf FORMAT: rgb24 OFFSET: 0 SIMILAR: 0
FAIL -> PASS # TEST: get-path-extents TARGET: gl FORMAT: argb32 OFFSET: 0 SIMILAR: 0
FAIL -> PASS # TEST: get-path-extents TARGET: gl FORMAT: rgb24 OFFSET: 0 SIMILAR: 0
FAIL -> PASS # TEST: get-path-extents TARGET: gl-window FORMAT: argb32 OFFSET: 0 SIMILAR: 0
FAIL -> PASS # TEST: get-path-extents TARGET: egl FORMAT: argb32 OFFSET: 0 SIMILAR: 0
FAIL -> PASS # TEST: get-path-extents TARGET: xcb FORMAT: argb32 OFFSET: 0 SIMILAR: 0
FAIL -> PASS # TEST: get-path-extents TARGET: xcb FORMAT: rgb24 OFFSET: 0 SIMILAR: 0
FAIL -> PASS # TEST: get-path-extents TARGET: xcb-window FORMAT: rgb24 OFFSET: 0 SIMILAR: 0
FAIL -> PASS # TEST: get-path-extents TARGET: xcb-window& FORMAT: rgb24 OFFSET: 0 SIMILAR: 0
FAIL -> PASS # TEST: get-path-extents TARGET: xcb-render-0_0 FORMAT: argb32 OFFSET: 0 SIMILAR: 0
FAIL -> PASS # TEST: get-path-extents TARGET: xcb-render-0_0 FORMAT: rgb24 OFFSET: 0 SIMILAR: 0
FAIL -> PASS # TEST: get-path-extents TARGET: xcb-fallback FORMAT: rgb24 OFFSET: 0 SIMILAR: 0
FAIL -> PASS # TEST: get-path-extents TARGET: xlib FORMAT: argb32 OFFSET: 0 SIMILAR: 0
FAIL -> PASS # TEST: get-path-extents TARGET: xlib FORMAT: rgb24 OFFSET: 0 SIMILAR: 0
FAIL -> PASS # TEST: get-path-extents TARGET: xlib-window FORMAT: rgb24 OFFSET: 0 SIMILAR: 0
FAIL -> PASS # TEST: get-path-extents TARGET: xlib-render-0_0 FORMAT: rgb24 OFFSET: 0 SIMILAR: 0
FAIL -> PASS # TEST: get-path-extents TARGET: xlib-fallback FORMAT: rgb24 OFFSET: 0 SIMILAR: 0
FAIL -> PASS # TEST: get-path-extents TARGET: image FORMAT: argb32 OFFSET: 0 SIMILAR: 0
FAIL -> PASS # TEST: get-path-extents TARGET: image FORMAT: rgb24 OFFSET: 0 SIMILAR: 0
FAIL -> PASS # TEST: get-path-extents TARGET: image16 FORMAT: rgb24 OFFSET: 0 SIMILAR: 0
FAIL -> PASS # TEST: get-path-extents TARGET: recording FORMAT: argb32 OFFSET: 0 SIMILAR: 0
FAIL -> PASS # TEST: get-path-extents TARGET: recording FORMAT: rgb24 OFFSET: 0 SIMILAR: 0
FAIL -> CRASHED # TEST: pthread-same-source TARGET: svg11 FORMAT: argb32 OFFSET: 0 SIMILAR: 0
CRASHED -> FAIL # TEST: pthread-same-source TARGET: svg11 FORMAT: rgb24 OFFSET: 0 SIMILAR: 0
CRASHED -> FAIL # TEST: pthread-same-source TARGET: recording FORMAT: rgb24 OFFSET: 0 SIMILAR: 0
FAIL -> PASS # TEST: surface-pattern-scale-down-extend-reflect TARGET: xlib-render-0_0 FORMAT: rgb24 OFFSET: 0 SIMILAR: 0
FAIL -> PASS # TEST: surface-pattern-scale-down-extend-repeat TARGET: xlib-render-0_0 FORMAT: rgb24 OFFSET: 0 SIMILAR: 0

Here's the patch in question, for reference:

diff --git a/src/cairo-gstate.c b/src/cairo-gstate.c
index 6319471..b8caa63 100644
--- a/src/cairo-gstate.c
+++ b/src/cairo-gstate.c
@@ -1462,19 +1462,19 @@ _cairo_gstate_stroke_extents (cairo_gstate_t	 *gstate,
     }
 
     if (status == CAIRO_INT_STATUS_UNSUPPORTED) {
-	cairo_traps_t traps;
-
-	_cairo_traps_init (&traps);
-	status = _cairo_path_fixed_stroke_polygon_to_traps (path,
-							    &gstate->stroke_style,
-							    &gstate->ctm,
-							    &gstate->ctm_inverse,
-							    gstate->tolerance,
-							    &traps);
-	empty = traps.num_traps == 0;
+	cairo_polygon_t polygon;
+
+	_cairo_polygon_init (&polygon, NULL, 0);
+	status = _cairo_path_fixed_stroke_to_polygon (path,
+						      &gstate->stroke_style,
+						      &gstate->ctm,
+						      &gstate->ctm_inverse,
+						      gstate->tolerance,
+						      &polygon);
+	empty = polygon.num_edges == 0;
 	if (! empty)
-	    _cairo_traps_extents (&traps, &extents);
-	_cairo_traps_fini (&traps);
+	    extents = polygon.extents;
+	_cairo_polygon_fini (&polygon);
     }
     if (! empty) {
 	_cairo_gstate_extents_to_user_rectangle (gstate, &extents,

--
Bryce Harrington
Senior Open Source Developer  -  b.harrington at samsung.com
Open Source Group             -  Samsung Research America



More information about the cairo mailing list