Bug 62375 - Test case 'get-path-extents' fails in current git
Summary: Test case 'get-path-extents' fails in current git
Status: RESOLVED FIXED
Alias: None
Product: cairo
Classification: Unclassified
Component: general (show other bugs)
Version: 1.12.4
Hardware: Other All
: medium normal
Assignee: Chris Wilson
QA Contact: cairo-bugs mailing list
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-03-15 15:50 UTC by Uli Schlachter
Modified: 2013-06-20 17:56 UTC (History)
2 users (show)

See Also:
i915 platform:
i915 features:


Attachments
No idea why this patch fixes the issue (470 bytes, text/plain)
2013-03-15 15:50 UTC, Uli Schlachter
Details
Simplify get-path-extents.c so that only this specific bug is tested (might make it easier to figure out what is going wrong) (1.39 KB, patch)
2013-03-15 15:52 UTC, Uli Schlachter
Details | Splinter Review
Another patch which makes the test case succeed and I still don't know what I am doing (971 bytes, patch)
2013-03-17 20:48 UTC, Uli Schlachter
Details | Splinter Review

Description Uli Schlachter 2013-03-15 15:50:51 UTC
Created attachment 76566 [details]
No idea why this patch fixes the issue

Hey,

today I looked into why get-path-extents fails in current git. I was told be git bisect that this was broken in 3cf6551ac71bac4d0ae1d0938bc0205dfc03f65c:

commit 3cf6551ac71bac4d0ae1d0938bc0205dfc03f65c
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Sat Aug 25 23:42:45 2012 +0100

    stroke: Use new pen vertex range finders

After staring at this for a while and asking printf for some values, I came up with the attached patch. No idea why this fixes anything, but the patch is likely wrong. Anyone with some more clue wants to figure this out?
Comment 1 Uli Schlachter 2013-03-15 15:52:16 UTC
Created attachment 76567 [details] [review]
Simplify get-path-extents.c so that only this specific bug is tested (might make it easier to figure out what is going wrong)
Comment 2 Uli Schlachter 2013-03-17 20:48:13 UTC
Created attachment 76662 [details] [review]
Another patch which makes the test case succeed and I still don't know what I am doing

Also please notice that there are still differences between the old code and the current one, they generate different values for "stop".
Comment 3 Darxus 2013-03-21 16:20:36 UTC
This bug appears to be the only thing keeping me from setting up automated regular runs of make test.  Which I would really like to be doing.
Comment 4 Chris Wilson 2013-03-21 16:26:23 UTC
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,
Comment 5 Darxus 2013-03-22 18:31:32 UTC
That last patch does cause get-path-extents tests to pass for me.  Can you commit it so I can start running this from cron?

490 Passed, 2 Failed [0 crashed, 2 expected], 32 Skipped
PASS: cairo-test-suite

With --enable-gl --enable-xcb --disable-ps --disable-script, CAIRO_REF_DIR, and using xvfb.
Comment 6 Quentin "Sardem FF7" Glidic 2013-06-12 07:29:57 UTC
We (packagers) would love to run tests for cairo too, should we backport that patch (for an undefined amount of time) or will someone push it “soon”?
Comment 7 Chris Wilson 2013-06-20 13:27:24 UTC
commit 9ea5993b036f5930179263baaf3162eeebb7c153
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Thu Jun 20 14:11:38 2013 +0100

    test/get-path-extents: Check exact matches within tolerance
    
    When we refine geometry, we do so to a tolerance as specified by the
    user. This means that we can not expect tessellated results to have
    exact results, but always they should match within the specified
    tolerance.
    
    Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>

commit b7331f0c52cc64f2c224eac502afa6c50a1a8d8b
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Thu Jun 20 14:23:15 2013 +0100

    gstate: Speed up stroked path extents
    
    We can skip the intermediate evaluation of the trapezoids for
    determining the extents of a stroked path by using the relatively new
    functions for computing the contours of the stroke. Then we can simply
    use the bbox of the points within the contours to retrieve the path
    extents - which is already provided by the polygon holding the contours
    of the stroke. This provides a faster result with less numerical
    inaccuracy due to fewer stages required in the computation
    
    References: https://bugs.freedesktop.org/show_bug.cgi?id=62375
    Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Comment 8 Darxus 2013-06-20 17:56:45 UTC
Verified, thanks:  http://lists.cairographics.org/archives/cairo/2013-June/024411.html


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.