[cairo-commit] rcairo/src rb_cairo_context.c,1.29,1.30
Kouhei Sutou
commit at pdx.freedesktop.org
Sat Sep 6 04:13:36 PDT 2008
Committed by: kou
Update of /cvs/cairo/rcairo/src
In directory kemper:/tmp/cvs-serv11159/src
Modified Files:
rb_cairo_context.c
Log Message:
* README: add Yusue ENDOH to Thanks list.
* src/rb_cairo_context.c: re-support cairo 1.2.x.
Reported by Yusuke ENDOH. Thanks!!!
Index: rb_cairo_context.c
===================================================================
RCS file: /cvs/cairo/rcairo/src/rb_cairo_context.c,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -d -r1.29 -r1.30
--- rb_cairo_context.c 17 Aug 2008 03:00:41 -0000 1.29
+++ rb_cairo_context.c 6 Sep 2008 11:13:34 -0000 1.30
@@ -110,13 +110,26 @@
return Data_Wrap_Struct (klass, NULL, cr_context_free, NULL);
}
+static void
+cr_set_user_data (cairo_t *cr, const cairo_user_data_key_t *key,
+ void *user_data, cairo_destroy_func_t destroy)
+{
+#if CAIRO_CHECK_VERSION(1, 4, 0)
+ cairo_set_user_data (cr, key, user_data, destroy);
+#else
+ cairo_surface_t *surface;
+ surface = cairo_get_target (cr);
+ cairo_surface_set_user_data (surface, key, user_data, destroy);
+#endif
+}
+
static VALUE
cr_destroy (VALUE self)
{
cairo_t *cr;
cr = _SELF;
- cairo_set_user_data (cr, &cr_object_holder_key, NULL, NULL); /* needed? */
+ cr_set_user_data (cr, &cr_object_holder_key, NULL, NULL);
cairo_destroy (cr);
DATA_PTR (self) = NULL;
@@ -140,9 +153,10 @@
cr = cairo_create (RVAL2CRSURFACE (target));
cr_check_status (cr);
rb_ivar_set (self, cr_id_surface, target);
- cairo_set_user_data (cr, &cr_object_holder_key,
- cr_object_holder_new(self),
- cr_object_holder_free);
+ cr_set_user_data (cr,
+ &cr_object_holder_key,
+ cr_object_holder_new(self),
+ cr_object_holder_free);
DATA_PTR (self) = cr;
if (rb_block_given_p ())
result = rb_ensure (rb_yield, self, cr_destroy_with_destroy_check, self);
More information about the cairo-commit
mailing list