[cairo-commit] rcairo/packages/cairo/ext rb_cairo_surface.c, 1.28, 1.29

Kouhei Sutou commit at pdx.freedesktop.org
Mon Nov 27 06:35:14 PST 2006


Committed by: kou

Update of /cvs/cairo/rcairo/packages/cairo/ext
In directory kemper:/tmp/cvs-serv23717/packages/cairo/ext

Modified Files:
	rb_cairo_surface.c 
Log Message:
* packages/cairo/ext/rb_cairo_surface.c: moved #write_to_png to
  Cairo::Surface from Cairo::ImageSurface.


Index: rb_cairo_surface.c
===================================================================
RCS file: /cvs/cairo/rcairo/packages/cairo/ext/rb_cairo_surface.c,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -d -r1.28 -r1.29
--- rb_cairo_surface.c	15 Oct 2006 07:12:33 -0000	1.28
+++ rb_cairo_surface.c	27 Nov 2006 14:35:11 -0000	1.29
@@ -367,7 +367,7 @@
 
 #if CAIRO_HAS_PNG_FUNCTIONS
 static VALUE
-cr_image_surface_write_to_png_stream (VALUE self, VALUE target)
+cr_surface_write_to_png_stream (VALUE self, VALUE target)
 {
   cairo_status_t status;
   cr_io_callback_closure_t closure;
@@ -386,30 +386,30 @@
 }
 
 static VALUE
-cr_image_surface_write_to_png_stream_invoke (VALUE info)
+cr_surface_write_to_png_stream_invoke (VALUE info)
 {
-  return cr_image_surface_write_to_png_stream (rb_ary_entry (info, 0),
-                                               rb_ary_entry (info, 1));
+  return cr_surface_write_to_png_stream (rb_ary_entry (info, 0),
+                                         rb_ary_entry (info, 1));
 }
 
 static VALUE
-cr_image_surface_write_to_png (VALUE self, VALUE filename)
+cr_surface_write_to_png (VALUE self, VALUE filename)
 {
   VALUE info, file;
 
   file = rb_file_open (StringValuePtr (filename), "wb");
   info = rb_ary_new3 (2, self, file);
-  return rb_ensure (cr_image_surface_write_to_png_stream_invoke, info,
+  return rb_ensure (cr_surface_write_to_png_stream_invoke, info,
                     rb_io_close, file);
 }
 
 static VALUE
-cr_image_surface_write_to_png_generic (VALUE self, VALUE target)
+cr_surface_write_to_png_generic (VALUE self, VALUE target)
 {
   if (rb_respond_to (target, cr_id_write))
-    return cr_image_surface_write_to_png_stream (self, target);
+    return cr_surface_write_to_png_stream (self, target);
   else
-    return cr_image_surface_write_to_png (self, target);
+    return cr_surface_write_to_png (self, target);
 }
 #endif
 
@@ -810,6 +810,11 @@
   rb_define_method (rb_cCairo_Surface, "set_fallback_resolution",
                     cr_surface_set_fallback_resolution, 2);
 
+#if CAIRO_HAS_PNG_FUNCTIONS
+  rb_define_method (rb_cCairo_Surface, "write_to_png",
+                    cr_surface_write_to_png_generic, 1);
+#endif
+
   RB_CAIRO_DEF_SETTERS (rb_cCairo_Surface);
 
   /* Image-surface */
@@ -835,12 +840,6 @@
   rb_define_method (rb_cCairo_ImageSurface, "stride",
                     cr_image_surface_get_stride, 0);
 
-#if CAIRO_HAS_PNG_FUNCTIONS
-  rb_define_method (rb_cCairo_ImageSurface, "write_to_png",
-                    cr_image_surface_write_to_png_generic, 1);
-#endif
-
-
 #define INIT_SURFACE(type, name)                                        \
   rb_cCairo_ ## name ## Surface =                                       \
     rb_define_class_under (rb_mCairo, # name "Surface",                 \



More information about the cairo-commit mailing list