summaryrefslogtreecommitdiff
path: root/src/cairo-pen.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2008-12-09 20:15:34 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2008-12-12 11:11:48 +0000
commit68b29cafa597128e7cae86608e04ecae6070dad9 (patch)
tree853187df50aa7d02492914ba6a574b2d854fe9ab /src/cairo-pen.c
parent2f3905dec38a710234aba30e1983b80ea3066a50 (diff)
[spline] Propagate errors during add point.
Yikes! The callback could fail so we need to propagate the error status.
Diffstat (limited to 'src/cairo-pen.c')
-rw-r--r--src/cairo-pen.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/src/cairo-pen.c b/src/cairo-pen.c
index 4158f175..a7576e1a 100644
--- a/src/cairo-pen.c
+++ b/src/cairo-pen.c
@@ -465,7 +465,9 @@ _cairo_pen_stroke_spline (cairo_pen_stroke_spline_t *stroker,
&stroker->forward_hull_point,
1);
- _cairo_spline_decompose (&stroker->spline, tolerance);
+ status = _cairo_spline_decompose (&stroker->spline, tolerance);
+ if (unlikely (status))
+ return status;
/* close the polygon */
slope = stroker->spline.final_slope;
@@ -492,20 +494,20 @@ _cairo_pen_stroke_spline (cairo_pen_stroke_spline_t *stroker,
status = _cairo_polygon_status (&stroker->polygon);
if (unlikely (status))
- goto BAIL;
+ return status;
status = _cairo_bentley_ottmann_tessellate_polygon (traps,
&stroker->polygon,
CAIRO_FILL_RULE_WINDING);
-BAIL:
return status;
}
-static void
-_cairo_pen_stroke_spline_add_point (cairo_pen_stroke_spline_t *stroker,
- const cairo_point_t *point)
+static cairo_status_t
+_cairo_pen_stroke_spline_add_point (void *closure,
+ cairo_point_t *point)
{
+ cairo_pen_stroke_spline_t *stroker = closure;
cairo_slope_t slope;
_cairo_slope_init (&slope, &stroker->last_point, point);
@@ -527,6 +529,8 @@ _cairo_pen_stroke_spline_add_point (cairo_pen_stroke_spline_t *stroker,
stroker->backward_vertex,
-1);
stroker->last_point = *point;
+
+ return CAIRO_STATUS_SUCCESS;
}
cairo_int_status_t
@@ -540,7 +544,7 @@ _cairo_pen_stroke_spline_init (cairo_pen_stroke_spline_t *stroker,
cairo_int_status_t status;
if (! _cairo_spline_init (&stroker->spline,
- (cairo_add_point_func_t) _cairo_pen_stroke_spline_add_point,
+ _cairo_pen_stroke_spline_add_point,
stroker,
a, b, c, d))
{
@@ -548,10 +552,8 @@ _cairo_pen_stroke_spline_init (cairo_pen_stroke_spline_t *stroker,
}
status = _cairo_pen_init_copy (&stroker->pen, pen);
- if (unlikely (status)) {
- _cairo_spline_fini (&stroker->spline);
+ if (unlikely (status))
return status;
- }
_cairo_polygon_init (&stroker->polygon);
@@ -564,6 +566,5 @@ void
_cairo_pen_stroke_spline_fini (cairo_pen_stroke_spline_t *stroker)
{
_cairo_polygon_fini (&stroker->polygon);
- _cairo_spline_fini (&stroker->spline);
_cairo_pen_fini (&stroker->pen);
}