[cairo-commit] rcairo/src rb_cairo_surface.c,1.37,1.38

Kouhei Sutou commit at pdx.freedesktop.org
Sat Aug 2 00:49:21 PDT 2008


Committed by: kou

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

Modified Files:
	rb_cairo_surface.c 
Log Message:
* src/rb_cairo_surface.c: handle unknown surface type as Cairo::Surface.
* src/rb_cairo_surface.c: add Cairo::Surface#destroy.


Index: rb_cairo_surface.c
===================================================================
RCS file: /cvs/cairo/rcairo/src/rb_cairo_surface.c,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -d -r1.37 -r1.38
--- rb_cairo_surface.c	2 Aug 2008 01:29:08 -0000	1.37
+++ rb_cairo_surface.c	2 Aug 2008 07:49:19 -0000	1.38
@@ -135,7 +135,7 @@
       break;
 #endif
     default:
-      rb_raise (rb_eArgError, "unknown source type: %d", type);
+      klass = rb_cCairo_Surface;
       break;
     }
 
@@ -296,6 +296,8 @@
       rb_raise (rb_eTypeError, "not a cairo surface");
     }
   Data_Get_Struct (obj, cairo_surface_t, surface);
+  if (!surface)
+    rb_cairo_check_status (CAIRO_STATUS_NULL_POINTER);
   return surface;
 }
 
@@ -384,6 +386,18 @@
 
 /* Surface manipulation */
 static VALUE
+cr_surface_destroy (VALUE self)
+{
+  cairo_surface_t *surface;
+
+  surface = _SELF;
+  cairo_surface_destroy (surface);
+  DATA_PTR (self) = NULL;
+
+  return self;
+}
+
+static VALUE
 cr_surface_finish (VALUE self)
 {
   cairo_surface_t *surface;
@@ -1195,6 +1209,7 @@
 
   rb_define_method (rb_cCairo_Surface, "create_similar",
                     cr_surface_create_similar, 3);
+  rb_define_method (rb_cCairo_Surface, "destroy", cr_surface_destroy, 0);
   rb_define_method (rb_cCairo_Surface, "finish", cr_surface_finish, 0);
   rb_define_method (rb_cCairo_Surface, "content", cr_surface_get_content, 0);
 



More information about the cairo-commit mailing list