[cairo-commit] cairo/src cairo-font.c, 1.70, 1.71 cairo-pattern.c, 1.58, 1.59 cairo-surface.c, 1.93, 1.94 cairo-win32-font.c, 1.38, 1.39 cairo.c, 1.127, 1.128

Carl Worth commit at pdx.freedesktop.org
Sat Aug 20 05:08:44 EST 2005


Committed by: cworth

Update of /cvs/cairo/cairo/src
In directory gabe:/tmp/cvs-serv16035/src

Modified Files:
	cairo-font.c cairo-pattern.c cairo-surface.c 
	cairo-win32-font.c cairo.c 
Log Message:

2005-08-19  Carl Worth  <cworth at cworth.org>

        Fixes for a general problem of which bug #4094 was a specific
        instance:

        * src/cairo.c: (_cairo_set_error):
        * src/cairo-font.c: (_cairo_scaled_font_set_error):
        * src/cairo-pattern.c: (_cairo_pattern_set_error):
        * src/cairo-surface.c: (_cairo_surface_set_error):
        Don't change the status value if it already holds an error. This
        avoids destroying "first error" information and also avoids
        attempting to write read-only data, (eg. from nil objects).

        * src/cairo-font.c:
        (cairo_scaled_font_extents), (cairo_scaled_font_glyph_extents):
        * src/cairo-pattern.c::
        (cairo_pattern_create_rgb), (cairo_pattern_create_rgba):
        * src/cairo-surface.c:
        (cairo_surface_flush), (cairo_surface_mark_dirty_rectangle),
        (cairo_surface_set_device_offset):
        * src/cairo-win32-font.c: (cairo_win32_scaled_font_select_font):
        * src/cairo.c: (cairo_save), (cairo_restore),
        (cairo_set_operator), (cairo_set_source_rgb),
        (cairo_set_source_rgba), (cairo_set_source_surface),
        (cairo_set_source), (cairo_set_tolerance), (cairo_set_antialias),
        (cairo_set_fill_rule), (cairo_set_line_width),
        (cairo_set_line_cap), (cairo_set_line_join), (cairo_set_dash),
        (cairo_set_miter_limit), (cairo_translate), (cairo_scale),
        (cairo_rotate), (cairo_transform), (cairo_set_matrix),
        (cairo_identity_matrix), (cairo_user_to_device),
        (cairo_user_to_device_distance), (cairo_device_to_user),
        (cairo_device_to_user_distance), (cairo_new_path), (cairo_move_to),
        (cairo_line_to), (cairo_curve_to), (cairo_arc),
        (cairo_arc_negative), (cairo_rel_move_to), (cairo_rel_line_to),
        (cairo_rel_curve_to), (cairo_rectangle), (cairo_close_path),
        (cairo_paint), (cairo_paint_with_alpha), (cairo_mask),
        (cairo_mask_surface), (cairo_stroke_preserve),
        (cairo_fill_preserve), (cairo_copy_page), (cairo_show_page),
        (cairo_in_stroke), (cairo_in_fill), (cairo_stroke_extents),
        (cairo_fill_extents), (cairo_clip_preserve), (cairo_reset_clip),
        (cairo_select_font_face), (cairo_get_font_face),
        (cairo_font_extents), (cairo_set_font_face), (cairo_set_font_size),
        (cairo_set_font_matrix), (cairo_set_font_options),
        (cairo_text_extents), (cairo_glyph_extents), (cairo_show_text),
        (cairo_show_glyphs), (cairo_text_path), (cairo_glyph_path),
        (cairo_append_path):
        Don't set an error on the same object if it is in an error state
        to begin with, just return immediately. This is intended to reduce
        (eventual) error prints to the first cause of an error for any
        given object, instead of a continual spew.


Index: cairo-font.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo-font.c,v
retrieving revision 1.70
retrieving revision 1.71
diff -u -d -r1.70 -r1.71
--- cairo-font.c	18 Aug 2005 22:50:36 -0000	1.70
+++ cairo-font.c	19 Aug 2005 19:08:42 -0000	1.71
@@ -444,6 +444,9 @@
 _cairo_scaled_font_set_error (cairo_scaled_font_t *scaled_font,
 			      cairo_status_t status)
 {
+    /* Don't overwrite an existing error. This preserves the first
+     * error, which is the most significant. It also avoids attempting
+     * to write to read-only data (eg. from a nil scaled_font). */
     scaled_font->status = status;
 
     _cairo_error (status);
@@ -999,10 +1002,8 @@
     cairo_int_status_t status;
     double  font_scale_x, font_scale_y;
     
-    if (scaled_font->status) {
-	_cairo_scaled_font_set_error (scaled_font, scaled_font->status);
+    if (scaled_font->status)
 	return;
-    }
 
     status = _cairo_scaled_font_font_extents (scaled_font, extents);
     if (status) {
@@ -1050,10 +1051,8 @@
     double x_pos = 0.0, y_pos = 0.0;
     int set = 0;
 
-    if (scaled_font->status) {
-	_cairo_scaled_font_set_error (scaled_font, scaled_font->status);
+    if (scaled_font->status)
 	return;
-    }
 
     if (!num_glyphs)
     {

Index: cairo-pattern.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo-pattern.c,v
retrieving revision 1.58
retrieving revision 1.59
diff -u -d -r1.58 -r1.59
--- cairo-pattern.c	19 Aug 2005 14:39:48 -0000	1.58
+++ cairo-pattern.c	19 Aug 2005 19:08:42 -0000	1.59
@@ -122,7 +122,11 @@
 _cairo_pattern_set_error (cairo_pattern_t *pattern,
 			  cairo_status_t status)
 {
-    pattern->status = status;
+    /* Don't overwrite an existing error. This preserves the first
+     * error, which is the most significant. It also avoids attempting
+     * to write to read-only data (eg. from a nil pattern). */
+    if (pattern->status == CAIRO_STATUS_SUCCESS)
+	pattern->status = status;
 
     _cairo_error (status);
 }
@@ -338,7 +342,7 @@
 
     pattern = _cairo_pattern_create_solid (&color);
     if (pattern->status)
-	_cairo_pattern_set_error (pattern, pattern->status);
+	_cairo_error (pattern->status);
 
     return pattern;
 }
@@ -380,7 +384,7 @@
 
     pattern = _cairo_pattern_create_solid (&color);
     if (pattern->status)
-	_cairo_pattern_set_error (pattern, pattern->status);
+	_cairo_error (pattern->status);
 
     return pattern;
 }

Index: cairo-surface.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo-surface.c,v
retrieving revision 1.93
retrieving revision 1.94
diff -u -d -r1.93 -r1.94
--- cairo-surface.c	18 Aug 2005 22:50:36 -0000	1.93
+++ cairo-surface.c	19 Aug 2005 19:08:42 -0000	1.94
@@ -108,7 +108,11 @@
 _cairo_surface_set_error (cairo_surface_t *surface,
 			  cairo_status_t status)
 {
-    surface->status = status;
+    /* Don't overwrite an existing error. This preserves the first
+     * error, which is the most significant. It also avoids attempting
+     * to write to read-only data (eg. from a nil surface). */
+    if (surface->status == CAIRO_STATUS_SUCCESS)
+	surface->status = status;
 
     _cairo_error (status);
 }
@@ -434,10 +438,8 @@
 void
 cairo_surface_flush (cairo_surface_t *surface)
 {
-    if (surface->status) {
-	_cairo_surface_set_error (surface, surface->status);
+    if (surface->status)
 	return;
-    }
 
     if (surface->finished) {
 	_cairo_surface_set_error (surface, CAIRO_STATUS_SURFACE_FINISHED);
@@ -487,10 +489,8 @@
 				    int              width,
 				    int              height)
 {
-    if (surface->status) {
-	_cairo_surface_set_error (surface, surface->status);
+    if (surface->status)
 	return;
-    }
 
     if (surface->finished) {
 	_cairo_surface_set_error (surface, CAIRO_STATUS_SURFACE_FINISHED);
@@ -530,10 +530,8 @@
 				 double           x_offset,
 				 double           y_offset)
 {
-    if (surface->status) {
-	_cairo_surface_set_error (surface, surface->status);
+    if (surface->status)
 	return;
-    }
 
     if (surface->finished) {
 	_cairo_surface_set_error (surface, CAIRO_STATUS_SURFACE_FINISHED);

Index: cairo-win32-font.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo-win32-font.c,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -d -r1.38 -r1.39
--- cairo-win32-font.c	11 Aug 2005 13:35:21 -0000	1.38
+++ cairo-win32-font.c	19 Aug 2005 19:08:42 -0000	1.39
@@ -1390,10 +1390,8 @@
     HFONT old_hfont = NULL;
     int old_mode;
 
-    if (scaled_font->status) {
-	_cairo_scaled_font_set_error (scaled_font, scaled_font->status);
+    if (scaled_font->status)
 	return scaled_font->status;
-    }
 
     hfont = _win32_scaled_font_get_scaled_hfont ((cairo_win32_scaled_font_t *)scaled_font);
     if (!hfont)

Index: cairo.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo.c,v
retrieving revision 1.127
retrieving revision 1.128
diff -u -d -r1.127 -r1.128
--- cairo.c	19 Aug 2005 19:02:14 -0000	1.127
+++ cairo.c	19 Aug 2005 19:08:42 -0000	1.128
@@ -105,7 +105,11 @@
 static void
 _cairo_set_error (cairo_t *cr, cairo_status_t status)
 {
-    cr->status = status;
+    /* Don't overwrite an existing error. This preserves the first
+     * error, which is the most significant. It also avoids attempting
+     * to write to read-only data (eg. from a nil cairo_t). */
+    if (cr->status == CAIRO_STATUS_SUCCESS)
+	cr->status = status;
 
     _cairo_error (status);
 }
@@ -285,10 +289,8 @@
 {
     cairo_gstate_t *top;
 
-    if (cr->status) {
-	_cairo_set_error (cr, cr->status);
+    if (cr->status)
 	return;
-    }
 
     top = _cairo_gstate_clone (cr->gstate);
 
@@ -315,10 +317,8 @@
 {
     cairo_gstate_t *top;
 
-    if (cr->status) {
-	_cairo_set_error (cr, cr->status);
+    if (cr->status)
 	return;
-    }
 
     top = cr->gstate;
     cr->gstate = top->next;
@@ -374,10 +374,8 @@
 void
 cairo_set_operator (cairo_t *cr, cairo_operator_t op)
 {
-    if (cr->status) {
-	_cairo_set_error (cr, cr->status);
+    if (cr->status)
 	return;
-    }
 
     cr->status = _cairo_gstate_set_operator (cr->gstate, op);
     if (cr->status)
@@ -404,10 +402,8 @@
 {
     cairo_pattern_t *pattern;
 
-    if (cr->status) {
-	_cairo_set_error (cr, cr->status);
+    if (cr->status)
 	return;
-    }
 
     pattern = cairo_pattern_create_rgb (red, green, blue);
     cairo_set_source (cr, pattern);
@@ -437,10 +433,8 @@
 {
     cairo_pattern_t *pattern;
 
-    if (cr->status) {
-	_cairo_set_error (cr, cr->status);
+    if (cr->status)
 	return;
-    }
 
     pattern = cairo_pattern_create_rgba (red, green, blue, alpha);
     cairo_set_source (cr, pattern);
@@ -479,10 +473,8 @@
     cairo_pattern_t *pattern;
     cairo_matrix_t matrix;
 
-    if (cr->status) {
-	_cairo_set_error (cr, cr->status);
+    if (cr->status)
 	return;
-    }
 
     pattern = cairo_pattern_create_for_surface (surface);
 
@@ -515,10 +507,8 @@
 void
 cairo_set_source (cairo_t *cr, cairo_pattern_t *source)
 {
-    if (cr->status) {
-	_cairo_set_error (cr, cr->status);
+    if (cr->status)
 	return;
-    }
 
     if (source == NULL) {
 	_cairo_set_error (cr, CAIRO_STATUS_NULL_POINTER);
@@ -570,10 +560,8 @@
 void
 cairo_set_tolerance (cairo_t *cr, double tolerance)
 {
-    if (cr->status) {
-	_cairo_set_error (cr, cr->status);
+    if (cr->status)
 	return;
-    }
 
     _cairo_restrict_value (&tolerance, CAIRO_TOLERANCE_MINIMUM, tolerance);
 
@@ -598,10 +586,8 @@
 void
 cairo_set_antialias (cairo_t *cr, cairo_antialias_t antialias)
 {
-    if (cr->status) {
-	_cairo_set_error (cr, cr->status);
+    if (cr->status) 
 	return;
-    }
 
     cr->status = _cairo_gstate_set_antialias (cr->gstate, antialias);
     if (cr->status)
@@ -622,10 +608,8 @@
 void
 cairo_set_fill_rule (cairo_t *cr, cairo_fill_rule_t fill_rule)
 {
-    if (cr->status) {
-	_cairo_set_error (cr, cr->status);
+    if (cr->status)
 	return;
-    }
 
     cr->status = _cairo_gstate_set_fill_rule (cr->gstate, fill_rule);
     if (cr->status)
@@ -649,10 +633,8 @@
 void
 cairo_set_line_width (cairo_t *cr, double width)
 {
-    if (cr->status) {
-	_cairo_set_error (cr, cr->status);
+    if (cr->status)
 	return;
-    }
 
     _cairo_restrict_value (&width, 0.0, width);
 
@@ -678,10 +660,8 @@
 void
 cairo_set_line_cap (cairo_t *cr, cairo_line_cap_t line_cap)
 {
-    if (cr->status) {
-	_cairo_set_error (cr, cr->status);
+    if (cr->status)
 	return;
-    }
 
     cr->status = _cairo_gstate_set_line_cap (cr->gstate, line_cap);
     if (cr->status)
@@ -705,10 +685,8 @@
 void
 cairo_set_line_join (cairo_t *cr, cairo_line_join_t line_join)
 {
-    if (cr->status) {
-	_cairo_set_error (cr, cr->status);
+    if (cr->status)
 	return;
-    }
 
     cr->status = _cairo_gstate_set_line_join (cr->gstate, line_join);
     if (cr->status)
@@ -744,10 +722,8 @@
 		int	 num_dashes,
 		double	 offset)
 {
-    if (cr->status) {
-	_cairo_set_error (cr, cr->status);
+    if (cr->status)
 	return;
-    }
 
     cr->status = _cairo_gstate_set_dash (cr->gstate,
 					 dashes, num_dashes, offset);
@@ -758,10 +734,8 @@
 void
 cairo_set_miter_limit (cairo_t *cr, double limit)
 {
-    if (cr->status) {
-	_cairo_set_error (cr, cr->status);
+    if (cr->status)
 	return;
-    }
 
     cr->status = _cairo_gstate_set_miter_limit (cr->gstate, limit);
     if (cr->status)
@@ -784,10 +758,8 @@
 void
 cairo_translate (cairo_t *cr, double tx, double ty)
 {
-    if (cr->status) {
-	_cairo_set_error (cr, cr->status);
+    if (cr->status)
 	return;
-    }
 
     cr->status = _cairo_gstate_translate (cr->gstate, tx, ty);
     if (cr->status)
@@ -808,10 +780,8 @@
 void
 cairo_scale (cairo_t *cr, double sx, double sy)
 {
-    if (cr->status) {
-	_cairo_set_error (cr, cr->status);
+    if (cr->status)
 	return;
-    }
 
     cr->status = _cairo_gstate_scale (cr->gstate, sx, sy);
     if (cr->status)
@@ -834,10 +804,8 @@
 void
 cairo_rotate (cairo_t *cr, double angle)
 {
-    if (cr->status) {
-	_cairo_set_error (cr, cr->status);
+    if (cr->status)
 	return;
-    }
 
     cr->status = _cairo_gstate_rotate (cr->gstate, angle);
     if (cr->status)
@@ -857,10 +825,8 @@
 cairo_transform (cairo_t	      *cr,
 		 const cairo_matrix_t *matrix)
 {
-    if (cr->status) {
-	_cairo_set_error (cr, cr->status);
+    if (cr->status)
 	return;
-    }
 
     cr->status = _cairo_gstate_transform (cr->gstate, matrix);
     if (cr->status)
@@ -879,10 +845,8 @@
 cairo_set_matrix (cairo_t	       *cr,
 		  const cairo_matrix_t *matrix)
 {
-    if (cr->status) {
-	_cairo_set_error (cr, cr->status);
+    if (cr->status)
 	return;
-    }
 
     cr->status = _cairo_gstate_set_matrix (cr->gstate, matrix);
     if (cr->status)
@@ -901,10 +865,8 @@
 void
 cairo_identity_matrix (cairo_t *cr)
 {
-    if (cr->status) {
-	_cairo_set_error (cr, cr->status);
+    if (cr->status)
 	return;
-    }
 
     cr->status = _cairo_gstate_identity_matrix (cr->gstate);
     if (cr->status)
@@ -924,10 +886,8 @@
 void
 cairo_user_to_device (cairo_t *cr, double *x, double *y)
 {
-    if (cr->status) {
-	_cairo_set_error (cr, cr->status);
+    if (cr->status)
 	return;
-    }
 
     cr->status = _cairo_gstate_user_to_device (cr->gstate, x, y);
     if (cr->status)
@@ -948,10 +908,8 @@
 void
 cairo_user_to_device_distance (cairo_t *cr, double *dx, double *dy)
 {
-    if (cr->status) {
-	_cairo_set_error (cr, cr->status);
+    if (cr->status)
 	return;
-    }
 
     cr->status = _cairo_gstate_user_to_device_distance (cr->gstate, dx, dy);
     if (cr->status)
@@ -971,10 +929,8 @@
 void
 cairo_device_to_user (cairo_t *cr, double *x, double *y)
 {
-    if (cr->status) {
-	_cairo_set_error (cr, cr->status);
+    if (cr->status)
 	return;
-    }
 
     cr->status = _cairo_gstate_device_to_user (cr->gstate, x, y);
     if (cr->status)
@@ -995,10 +951,8 @@
 void
 cairo_device_to_user_distance (cairo_t *cr, double *dx, double *dy)
 {
-    if (cr->status) {
-	_cairo_set_error (cr, cr->status);
+    if (cr->status)
 	return;
-    }
 
     cr->status = _cairo_gstate_device_to_user_distance (cr->gstate, dx, dy);
     if (cr->status)
@@ -1008,10 +962,8 @@
 void
 cairo_new_path (cairo_t *cr)
 {
-    if (cr->status) {
-	_cairo_set_error (cr, cr->status);
+    if (cr->status)
 	return;
-    }
 
     _cairo_path_fixed_fini (&cr->path);
 }
@@ -1022,10 +974,8 @@
 {
     cairo_fixed_t x_fixed, y_fixed;
 
-    if (cr->status) {
-	_cairo_set_error (cr, cr->status);
+    if (cr->status)
 	return;
-    }
 
     _cairo_gstate_user_to_backend (cr->gstate, &x, &y);
     x_fixed = _cairo_fixed_from_double (x);
@@ -1042,10 +992,8 @@
 {
     cairo_fixed_t x_fixed, y_fixed;
 
-    if (cr->status) {
-	_cairo_set_error (cr, cr->status);
+    if (cr->status)
 	return;
-    }
 
     _cairo_gstate_user_to_backend (cr->gstate, &x, &y);
     x_fixed = _cairo_fixed_from_double (x);
@@ -1066,10 +1014,8 @@
     cairo_fixed_t x2_fixed, y2_fixed;
     cairo_fixed_t x3_fixed, y3_fixed;
 	
-    if (cr->status) {
-	_cairo_set_error (cr, cr->status);
+    if (cr->status)
 	return;
-    }
 
     _cairo_gstate_user_to_backend (cr->gstate, &x1, &y1);
     _cairo_gstate_user_to_backend (cr->gstate, &x2, &y2);
@@ -1131,10 +1077,8 @@
 	   double radius,
 	   double angle1, double angle2)
 {
-    if (cr->status) {
-	_cairo_set_error (cr, cr->status);
+    if (cr->status)
 	return;
-    }
 
     /* Do nothing, successfully, if radius is <= 0 */
     if (radius <= 0.0)
@@ -1171,10 +1115,8 @@
 		    double radius,
 		    double angle1, double angle2)
 {
-    if (cr->status) {
-	_cairo_set_error (cr, cr->status);
+    if (cr->status)
 	return;
-    }
 
     /* Do nothing, successfully, if radius is <= 0 */
     if (radius <= 0.0)
@@ -1213,10 +1155,8 @@
 {
     cairo_fixed_t dx_fixed, dy_fixed;
 
-    if (cr->status) {
-	_cairo_set_error (cr, cr->status);
+    if (cr->status) 
 	return;
-    }
 
     _cairo_gstate_user_to_device_distance (cr->gstate, &dx, &dy);
     dx_fixed = _cairo_fixed_from_double (dx);
@@ -1232,10 +1172,8 @@
 {
     cairo_fixed_t dx_fixed, dy_fixed;
 
-    if (cr->status) {
-	_cairo_set_error (cr, cr->status);
+    if (cr->status)
 	return;
-    }
 
     _cairo_gstate_user_to_device_distance (cr->gstate, &dx, &dy);
     dx_fixed = _cairo_fixed_from_double (dx);
@@ -1257,10 +1195,8 @@
     cairo_fixed_t dx2_fixed, dy2_fixed;
     cairo_fixed_t dx3_fixed, dy3_fixed;
 
-    if (cr->status) {
-	_cairo_set_error (cr, cr->status);
+    if (cr->status)
 	return;
-    }
 
     _cairo_gstate_user_to_device_distance (cr->gstate, &dx1, &dy1);
     _cairo_gstate_user_to_device_distance (cr->gstate, &dx2, &dy2);
@@ -1288,10 +1224,8 @@
 		 double x, double y,
 		 double width, double height)
 {
-    if (cr->status) {
-	_cairo_set_error (cr, cr->status);
+    if (cr->status)
 	return;
-    }
 
     cairo_move_to (cr, x, y);
     cairo_rel_line_to (cr, width, 0);
@@ -1316,10 +1250,8 @@
 void
 cairo_close_path (cairo_t *cr)
 {
-    if (cr->status) {
-	_cairo_set_error (cr, cr->status);
+    if (cr->status)
 	return;
-    }
 
     cr->status = _cairo_path_fixed_close_path (&cr->path);
     if (cr->status)
@@ -1337,10 +1269,8 @@
 void
 cairo_paint (cairo_t *cr)
 {
-    if (cr->status) {
-	_cairo_set_error (cr, cr->status);
+    if (cr->status)
 	return;
-    }
 
     cr->status = _cairo_gstate_paint (cr->gstate);
     if (cr->status)
@@ -1364,10 +1294,8 @@
     cairo_color_t color;
     cairo_pattern_union_t pattern;
   
-    if (cr->status) {
-	_cairo_set_error (cr, cr->status);
+    if (cr->status)
 	return;
-    }
 
     if (CAIRO_ALPHA_IS_OPAQUE (alpha)) {
 	cairo_paint (cr);
@@ -1398,10 +1326,8 @@
 cairo_mask (cairo_t         *cr,
 	    cairo_pattern_t *pattern)
 {
-    if (cr->status) {
-	_cairo_set_error (cr, cr->status);
+    if (cr->status)
 	return;
-    }
 
     if (pattern == NULL) {
 	_cairo_set_error (cr, CAIRO_STATUS_NULL_POINTER);
@@ -1439,10 +1365,8 @@
     cairo_pattern_t *pattern;
     cairo_matrix_t matrix;
 
-    if (cr->status) {
-	_cairo_set_error (cr, cr->status);
+    if (cr->status)
 	return;
-    }
 
     pattern = cairo_pattern_create_for_surface (surface);
 
@@ -1489,10 +1413,8 @@
 void
 cairo_stroke_preserve (cairo_t *cr)
 {
-    if (cr->status) {
-	_cairo_set_error (cr, cr->status);
+    if (cr->status)
 	return;
-    }
 
     cr->status = _cairo_gstate_stroke (cr->gstate, &cr->path);
     if (cr->status)
@@ -1532,10 +1454,8 @@
 void
 cairo_fill_preserve (cairo_t *cr)
 {
-    if (cr->status) {
-	_cairo_set_error (cr, cr->status);
+    if (cr->status)
 	return;
-    }
 
     cr->status = _cairo_gstate_fill (cr->gstate, &cr->path);
     if (cr->status)
@@ -1546,10 +1466,8 @@
 void
 cairo_copy_page (cairo_t *cr)
 {
-    if (cr->status) {
-	_cairo_set_error (cr, cr->status);
+    if (cr->status)
 	return;
-    }
 
     cr->status = _cairo_gstate_copy_page (cr->gstate);
     if (cr->status)
@@ -1559,10 +1477,8 @@
 void
 cairo_show_page (cairo_t *cr)
 {
-    if (cr->status) {
-	_cairo_set_error (cr, cr->status);
+    if (cr->status)
 	return;
-    }
 
     cr->status = _cairo_gstate_show_page (cr->gstate);
     if (cr->status)
@@ -1574,18 +1490,14 @@
 {
     int inside;
 
-    if (cr->status) {
-	_cairo_set_error (cr, cr->status);
+    if (cr->status)
 	return 0;
-    }
 
     cr->status = _cairo_gstate_in_stroke (cr->gstate,
 					  &cr->path,
 					  x, y, &inside);
-    if (cr->status) {
-	_cairo_set_error (cr, cr->status);
+    if (cr->status)
 	return 0;
-    }
 
     return inside;
 }
@@ -1595,10 +1507,8 @@
 {
     int inside;
 
-    if (cr->status) {
-	_cairo_set_error (cr, cr->status);
+    if (cr->status)
 	return 0;
-    }
 
     cr->status = _cairo_gstate_in_fill (cr->gstate,
 					&cr->path,
@@ -1615,10 +1525,8 @@
 cairo_stroke_extents (cairo_t *cr,
                       double *x1, double *y1, double *x2, double *y2)
 {
-    if (cr->status) {
-	_cairo_set_error (cr, cr->status);
+    if (cr->status)
 	return;
-    }
     
     cr->status = _cairo_gstate_stroke_extents (cr->gstate,
 					       &cr->path,
@@ -1631,10 +1539,8 @@
 cairo_fill_extents (cairo_t *cr,
                     double *x1, double *y1, double *x2, double *y2)
 {
-    if (cr->status) {
-	_cairo_set_error (cr, cr->status);
+    if (cr->status)
 	return;
-    }
     
     cr->status = _cairo_gstate_fill_extents (cr->gstate,
 					     &cr->path,
@@ -1698,10 +1604,8 @@
 void
 cairo_clip_preserve (cairo_t *cr)
 {
-    if (cr->status) {
-	_cairo_set_error (cr, cr->status);
+    if (cr->status)
 	return;
-    }
 
     cr->status = _cairo_gstate_clip (cr->gstate, &cr->path);
     if (cr->status)
@@ -1728,10 +1632,8 @@
 void
 cairo_reset_clip (cairo_t *cr)
 {
-    if (cr->status) {
-	_cairo_set_error (cr, cr->status);
+    if (cr->status)
 	return;
-    }
 
     cr->status = _cairo_gstate_reset_clip (cr->gstate);
     if (cr->status)
@@ -1759,10 +1661,8 @@
 			cairo_font_slant_t    slant, 
 			cairo_font_weight_t   weight)
 {
-    if (cr->status) {
-	_cairo_set_error (cr, cr->status);
+    if (cr->status)
 	return;
-    }
 
     cr->status = _cairo_gstate_select_font_face (cr->gstate, family, slant, weight);
     if (cr->status)
@@ -1785,10 +1685,8 @@
 {
     cairo_font_face_t *font_face;
 
-    if (cr->status) {
-	_cairo_set_error (cr, cr->status);
+    if (cr->status)
 	return (cairo_font_face_t*) &_cairo_font_face_nil;
-    }
 
     cr->status = _cairo_gstate_get_font_face (cr->gstate, &font_face);
     if (cr->status) {
@@ -1811,10 +1709,8 @@
 cairo_font_extents (cairo_t              *cr, 
 		    cairo_font_extents_t *extents)
 {
-    if (cr->status) {
-	_cairo_set_error (cr, cr->status);
+    if (cr->status)
 	return;
-    }
 
     cr->status = _cairo_gstate_get_font_extents (cr->gstate, extents);
     if (cr->status)
@@ -1834,10 +1730,8 @@
 cairo_set_font_face (cairo_t           *cr,
 		     cairo_font_face_t *font_face)
 {
-    if (cr->status) {
-	_cairo_set_error (cr, cr->status);
+    if (cr->status)
 	return;
-    }
 
     cr->status = _cairo_gstate_set_font_face (cr->gstate, font_face);  
     if (cr->status)
@@ -1858,10 +1752,8 @@
 void
 cairo_set_font_size (cairo_t *cr, double size)
 {
-    if (cr->status) {
-	_cairo_set_error (cr, cr->status);
+    if (cr->status)
 	return;
-    }
 
     cr->status = _cairo_gstate_set_font_size (cr->gstate, size);
     if (cr->status)
@@ -1885,10 +1777,8 @@
 cairo_set_font_matrix (cairo_t		    *cr,
 		       const cairo_matrix_t *matrix)
 {
-    if (cr->status) {
-	_cairo_set_error (cr, cr->status);
+    if (cr->status)
 	return;
-    }
 
     cr->status = _cairo_gstate_set_font_matrix (cr->gstate, matrix);
     if (cr->status)
@@ -1924,10 +1814,8 @@
 cairo_set_font_options (cairo_t                    *cr,
 			const cairo_font_options_t *options)
 {
-    if (cr->status) {
-	_cairo_set_error (cr, cr->status);
+    if (cr->status)
 	return;
-    }
 
     cr->status = _cairo_gstate_set_font_options (cr->gstate, options);
     if (cr->status)
@@ -1981,10 +1869,8 @@
     int num_glyphs;
     double x, y;
 
-    if (cr->status) {
-	_cairo_set_error (cr, cr->status);
+    if (cr->status)
 	return;
-    }
 
     if (utf8 == NULL) {
 	extents->x_bearing = 0.0;
@@ -2041,10 +1927,8 @@
 		     int                    num_glyphs,
 		     cairo_text_extents_t   *extents)
 {
-    if (cr->status) {
-	_cairo_set_error (cr, cr->status);
+    if (cr->status)
 	return;
-    }
 
     cr->status = _cairo_gstate_glyph_extents (cr->gstate, glyphs, num_glyphs,
 					      extents);
@@ -2059,10 +1943,8 @@
     int num_glyphs;
     double x, y;
 
-    if (cr->status) {
-	_cairo_set_error (cr, cr->status);
+    if (cr->status)
 	return;
-    }
 
     if (utf8 == NULL)
 	return;
@@ -2092,10 +1974,8 @@
 void
 cairo_show_glyphs (cairo_t *cr, cairo_glyph_t *glyphs, int num_glyphs)
 {
-    if (cr->status) {
-	_cairo_set_error (cr, cr->status);
+    if (cr->status)
 	return;
-    }
 
     cr->status = _cairo_gstate_show_glyphs (cr->gstate, glyphs, num_glyphs);
     if (cr->status)
@@ -2109,10 +1989,8 @@
     int num_glyphs;
     double x, y;
 
-    if (cr->status) {
-	_cairo_set_error (cr, cr->status);
+    if (cr->status)
 	return;
-    }
 
     cairo_get_current_point (cr, &x, &y);
 
@@ -2135,16 +2013,13 @@
 
     if (cr->status)
 	_cairo_set_error (cr, cr->status);
-
 }
 
 void
 cairo_glyph_path (cairo_t *cr, cairo_glyph_t *glyphs, int num_glyphs)
 {
-    if (cr->status) {
-	_cairo_set_error (cr, cr->status);
+    if (cr->status)
 	return;
-    }
 
     cr->status = _cairo_gstate_glyph_path (cr->gstate,
 					   glyphs, num_glyphs,
@@ -2434,10 +2309,8 @@
 cairo_append_path (cairo_t	*cr,
 		   cairo_path_t *path)
 {
-    if (cr->status) {
-	_cairo_set_error (cr, cr->status);
+    if (cr->status)
 	return;
-    }
 
     if (path == NULL) {
 	_cairo_set_error (cr, CAIRO_STATUS_NULL_POINTER);



More information about the cairo-commit mailing list