[cairo-commit] src/cairo-gstate.c src/cairo.h src/cairo-paginated-surface.c src/cairo-surface.c src/cairo-svg-surface.c

Behdad Esfahbod behdad at kemper.freedesktop.org
Fri Jan 25 16:38:36 PST 2008


 src/cairo-gstate.c            |    6 ++++--
 src/cairo-paginated-surface.c |   12 ++++++++----
 src/cairo-surface.c           |   33 ++++++++++++++++++---------------
 src/cairo-svg-surface.c       |    5 +++--
 src/cairo.h                   |    4 ++--
 5 files changed, 35 insertions(+), 25 deletions(-)

New commits:
commit 756420a780e870bed6f174ca7f3f14421d1ff7d2
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Fri Jan 25 19:38:27 2008 -0500

    [cairo_surface_show/copy_page()] Make them return void, like cairo_show/copy_page() do

diff --git a/src/cairo-gstate.c b/src/cairo-gstate.c
index a00a52c..4cbab95 100644
--- a/src/cairo-gstate.c
+++ b/src/cairo-gstate.c
@@ -1151,13 +1151,15 @@ BAIL:
 cairo_status_t
 _cairo_gstate_copy_page (cairo_gstate_t *gstate)
 {
-    return cairo_surface_copy_page (gstate->target);
+    cairo_surface_copy_page (gstate->target);
+    return cairo_surface_status (gstate->target);
 }
 
 cairo_status_t
 _cairo_gstate_show_page (cairo_gstate_t *gstate)
 {
-    return cairo_surface_show_page (gstate->target);
+    cairo_surface_show_page (gstate->target);
+    return cairo_surface_status (gstate->target);
 }
 
 static void
diff --git a/src/cairo-paginated-surface.c b/src/cairo-paginated-surface.c
index 953f463..83f9dc9 100644
--- a/src/cairo-paginated-surface.c
+++ b/src/cairo-paginated-surface.c
@@ -162,8 +162,10 @@ _cairo_paginated_surface_finish (void *abstract_surface)
     cairo_paginated_surface_t *surface = abstract_surface;
     cairo_status_t status = CAIRO_STATUS_SUCCESS;
 
-    if (surface->page_is_blank == FALSE || surface->page_num == 1)
-	status = cairo_surface_show_page (abstract_surface);
+    if (surface->page_is_blank == FALSE || surface->page_num == 1) {
+	cairo_surface_show_page (abstract_surface);
+	status = cairo_surface_status (abstract_surface);
+    }
 
     if (status == CAIRO_STATUS_SUCCESS) {
 	cairo_surface_finish (surface->target);
@@ -444,7 +446,8 @@ _cairo_paginated_surface_copy_page (void *abstract_surface)
      * show_page and we implement the copying by simply not destroying
      * the meta-surface. */
 
-    return cairo_surface_show_page (surface->target);
+    cairo_surface_show_page (surface->target);
+    return cairo_surface_status (surface->target);
 }
 
 static cairo_int_status_t
@@ -461,7 +464,8 @@ _cairo_paginated_surface_show_page (void *abstract_surface)
     if (status)
 	return status;
 
-    status = cairo_surface_show_page (surface->target);
+    cairo_surface_show_page (surface->target);
+    status = cairo_surface_status (surface->target);
     if (status)
 	return status;
 
diff --git a/src/cairo-surface.c b/src/cairo-surface.c
index a251be4..2883460 100644
--- a/src/cairo-surface.c
+++ b/src/cairo-surface.c
@@ -1658,23 +1658,25 @@ _cairo_surface_composite_trapezoids (cairo_operator_t		op,
  *
  * Since: 1.6
  */
-cairo_status_t
+void
 cairo_surface_copy_page (cairo_surface_t *surface)
 {
     assert (! surface->is_snapshot);
 
     if (surface->status)
-	return surface->status;
+	return;
 
-    if (surface->finished)
-	return _cairo_surface_set_error (surface,CAIRO_STATUS_SURFACE_FINISHED);
+    if (surface->finished) {
+	_cairo_surface_set_error (surface,CAIRO_STATUS_SURFACE_FINISHED);
+	return;
+    }
 
     /* It's fine if some backends don't implement copy_page */
     if (surface->backend->copy_page == NULL)
-	return CAIRO_STATUS_SUCCESS;
+	return;
 
-    return _cairo_surface_set_error (surface,
-	                             surface->backend->copy_page (surface));
+    _cairo_surface_set_error (surface,
+			      surface->backend->copy_page (surface));
 }
 slim_hidden_def (cairo_surface_copy_page);
 
@@ -1687,24 +1689,25 @@ slim_hidden_def (cairo_surface_copy_page);
  *
  * Since: 1.6
  **/
-
-cairo_status_t
+void
 cairo_surface_show_page (cairo_surface_t *surface)
 {
     assert (! surface->is_snapshot);
 
     if (surface->status)
-	return surface->status;
+	return;
 
-    if (surface->finished)
-	return _cairo_surface_set_error (surface,CAIRO_STATUS_SURFACE_FINISHED);
+    if (surface->finished) {
+	_cairo_surface_set_error (surface,CAIRO_STATUS_SURFACE_FINISHED);
+	return;
+    }
 
     /* It's fine if some backends don't implement show_page */
     if (surface->backend->show_page == NULL)
-	return CAIRO_STATUS_SUCCESS;
+	return;
 
-    return _cairo_surface_set_error (surface,
-	                             surface->backend->show_page (surface));
+    _cairo_surface_set_error (surface,
+			      surface->backend->show_page (surface));
 }
 slim_hidden_def (cairo_surface_show_page);
 
diff --git a/src/cairo-svg-surface.c b/src/cairo-svg-surface.c
index 2c3cb58..60d93e7 100644
--- a/src/cairo-svg-surface.c
+++ b/src/cairo-svg-surface.c
@@ -1045,7 +1045,8 @@ _cairo_svg_surface_emit_meta_surface (cairo_svg_document_t *document,
 	return status;
     }
 
-    status = cairo_surface_show_page (paginated_surface);
+    cairo_surface_show_page (paginated_surface);
+    status = cairo_surface_status (paginated_surface);
     if (status) {
 	cairo_surface_destroy (&meta->base);
 	cairo_surface_destroy (paginated_surface);
@@ -1133,7 +1134,7 @@ _cairo_svg_surface_emit_composite_meta_pattern (cairo_output_stream_t	*output,
     cairo_meta_surface_t *meta_surface;
     cairo_matrix_t p2u;
     cairo_status_t status;
-    int id;
+    int id = 0;
 
     p2u = pattern->base.matrix;
     status = cairo_matrix_invert (&p2u);
diff --git a/src/cairo.h b/src/cairo.h
index 157b6e1..cb04f3c 100644
--- a/src/cairo.h
+++ b/src/cairo.h
@@ -1545,10 +1545,10 @@ cairo_surface_set_fallback_resolution (cairo_surface_t	*surface,
 				       double		 x_pixels_per_inch,
 				       double		 y_pixels_per_inch);
 
-cairo_public cairo_status_t
+cairo_public void
 cairo_surface_copy_page (cairo_surface_t *surface);
 
-cairo_public cairo_status_t
+cairo_public void
 cairo_surface_show_page (cairo_surface_t *surface);
 
 /* Image-surface functions */


More information about the cairo-commit mailing list