[cairo-commit] rcairo/src rb_cairo_context.c,1.23,1.24

Kouhei Sutou commit at pdx.freedesktop.org
Mon Jul 28 18:26:56 PDT 2008


Committed by: kou

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

Modified Files:
	rb_cairo_context.c 
Log Message:
* src/rb_cairo_context.c: expose Cairo::Cotext#destroy.


Index: rb_cairo_context.c
===================================================================
RCS file: /cvs/cairo/rcairo/src/rb_cairo_context.c,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -d -r1.23 -r1.24
--- rb_cairo_context.c	21 Jul 2008 00:45:11 -0000	1.23
+++ rb_cairo_context.c	29 Jul 2008 01:26:54 -0000	1.24
@@ -57,6 +57,8 @@
       rb_raise (rb_eTypeError, "not a cairo graphics context");
     }
   Data_Get_Struct (obj, cairo_t, context);
+  if (!context)
+    rb_cairo_check_status (CAIRO_STATUS_NULL_POINTER);
   return context;
 }
 
@@ -102,6 +104,14 @@
 }
 
 static VALUE
+cr_destroy (VALUE self)
+{
+  cairo_destroy (_SELF);
+  DATA_PTR (self) = NULL;
+  return Qnil;
+}
+
+static VALUE
 cr_restore (VALUE self)
 {
   cairo_restore (_SELF);
@@ -1411,6 +1421,7 @@
 
   /* Functions for manipulating state objects */
   rb_define_method (rb_cCairo_Context, "initialize", cr_initialize, 1);
+  rb_define_method (rb_cCairo_Context, "destroy", cr_destroy, 0);
 
   rb_define_method (rb_cCairo_Context, "save", cr_save, 0);
   rb_define_method (rb_cCairo_Context, "restore", cr_restore, 0);



More information about the cairo-commit mailing list