[cairo-commit] rcairo/src rb_cairo_surface.c,1.2,1.3

Kouhei Sutou commit at pdx.freedesktop.org
Sat Apr 7 23:12:59 PDT 2007


Committed by: kou

Update of /cvs/cairo/rcairo/src
In directory kemper:/tmp/cvs-serv26502/src

Modified Files:
	rb_cairo_surface.c 
Log Message:
* src/rb_cairo_surface.c (yield_and_finish):
  - renamed from ensure_finish_proc().
  - don't use ensure.


Index: rb_cairo_surface.c
===================================================================
RCS file: /cvs/cairo/rcairo/src/rb_cairo_surface.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- rb_cairo_surface.c	8 Apr 2007 06:04:02 -0000	1.2
+++ rb_cairo_surface.c	8 Apr 2007 06:12:50 -0000	1.3
@@ -264,6 +264,25 @@
 }
 
 /* Surface manipulation */
+static void
+yield_and_finish (VALUE self)
+{
+  cairo_surface_t *surface;
+  cairo_status_t status;
+
+  rb_yield (self);
+
+  surface = _SELF;
+  if (cairo_surface_status (surface))
+    return;
+  cairo_surface_finish (surface);
+  status = cairo_surface_status (surface);
+  if (status == CAIRO_STATUS_SUCCESS || status == CAIRO_STATUS_SURFACE_FINISHED)
+    return;
+
+  cr_surface_check_status (surface);
+}
+
 static VALUE
 cr_surface_create_similar (VALUE self, VALUE content,
                            VALUE width, VALUE height)
@@ -294,33 +313,6 @@
 }
 
 static VALUE
-ensure_finish_proc (VALUE self)
-{
-  cairo_surface_t *surface;
-  cairo_status_t status;
-
-  surface = _SELF;
-
-  if (cairo_surface_status (surface))
-    return Qnil;
-
-  cairo_surface_finish (surface);
-
-  status = cairo_surface_status (surface);
-  if (status == CAIRO_STATUS_SUCCESS || status == CAIRO_STATUS_SURFACE_FINISHED)
-    return Qnil;
-
-  cr_surface_check_status (surface);
-  return Qnil;
-}
-
-static void
-ensure_finish (VALUE surface)
-{
-  rb_ensure (rb_yield, surface, ensure_finish_proc, surface);
-}
-
-static VALUE
 cr_surface_get_type (VALUE self)
 {
   return INT2NUM (cairo_surface_get_type (_SELF));
@@ -546,7 +538,7 @@
   cr_surface_check_status (surface);
   DATA_PTR (self) = surface;
   if (rb_block_given_p ())
-    ensure_finish (self);
+    yield_and_finish (self);
   return Qnil;
 }
 
@@ -639,7 +631,7 @@
   cr_surface_check_status (surface);                                    \
   DATA_PTR (self) = surface;                                            \
   if (rb_block_given_p ())                                              \
-    ensure_finish (self);                                               \
+    yield_and_finish (self);                                            \
   return Qnil;                                                          \
 }
 



More information about the cairo-commit mailing list