Bug 626994. Fix the depth counting. r=ehsan a=joe
authorJeff Muizelaar <jmuizelaar@mozilla.com>
Wed, 02 Feb 2011 13:47:12 -0500
changeset 61798 db765563b6fdb027901a40ca54aa32397abddab0
parent 61797 e5ce46fd72037b04f98a0988e75886858fcf65c2
child 61800 8590bb1f1104d08fa573d9b3f2fea3d71eb27f69
push idunknown
push userunknown
push dateunknown
reviewersehsan, joe
bugs626994
milestone2.0b12pre
Bug 626994. Fix the depth counting. r=ehsan a=joe 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)