Bug 626994. Fix the depth counting. r=ehsan a=joe (landing on the beta11 release branch) GECKO20b11_2011020209_RELBRANCH
authorJeff Muizelaar <jmuizelaar@mozilla.com>
Wed, 02 Feb 2011 13:47:12 -0500
branchGECKO20b11_2011020209_RELBRANCH
changeset 61802 36f4e8a8b953e9b8ce54b0e3c8ded5edba56753e
parent 61788 fe971e94722f3d8f14b70b572a4270be6d7f23b8
child 61806 49c3ca45a79ffdd33f0573dfa98c7d63643f907b
push idunknown
push userunknown
push dateunknown
reviewersehsan, joe
bugs626994
milestone2.0b11
Bug 626994. Fix the depth counting. r=ehsan a=joe (landing on the beta11 release branch) Previously we missed a decrement at the end of the recursion. This caused us to accumulate over time, causing us to misreport.
gfx/cairo/cairo/src/cairo-spline.c
--- a/gfx/cairo/cairo/src/cairo-spline.c
+++ b/gfx/cairo/cairo/src/cairo-spline.c
@@ -195,24 +195,28 @@ static cairo_status_t
 
     depth++;
 #ifdef MOZ_ENABLE_LIBXUL
     if (depth == 200) {
         CrashSpline();
     }
 #endif
 
-    if (_cairo_spline_error_squared (s1) < tolerance_squared)
+    if (_cairo_spline_error_squared (s1) < tolerance_squared) {
+        depth--;
 	return _cairo_spline_add_point (result, &s1->a);
+    }
 
     _de_casteljau (s1, &s2);
 
     status = _cairo_spline_decompose_into (s1, tolerance_squared, result);
-    if (unlikely (status))
+    if (unlikely (status)) {
+        depth--;
 	return status;
+    }
 
     status = _cairo_spline_decompose_into (&s2, tolerance_squared, result);
     depth--;
     return status;
 }
 
 cairo_status_t
 _cairo_spline_decompose (cairo_spline_t *spline, double tolerance)