[cairo-commit] rcairo/src rb_cairo_surface.c,1.17,1.18

Kouhei Sutou commit at pdx.freedesktop.org
Thu Jan 17 20:57:23 PST 2008


Committed by: kou

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

Modified Files:
	rb_cairo_surface.c 
Log Message:
* src/rb_cairo_surface.c: fixed # of arguments for Cairo::Surface#mark_dirty.
* src/rb_cairo_surface.c: improved argument error message.


Index: rb_cairo_surface.c
===================================================================
RCS file: /cvs/cairo/rcairo/src/rb_cairo_surface.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- rb_cairo_surface.c	11 Jan 2008 12:19:44 -0000	1.17
+++ rb_cairo_surface.c	18 Jan 2008 04:57:20 -0000	1.18
@@ -35,6 +35,7 @@
 static ID cr_id_target;
 static ID cr_id_read;
 static ID cr_id_write;
+static ID cr_id_inspect;
 static cairo_user_data_key_t cr_closure_key;
 
 #define _SELF  (RVAL2CRSURFACE(self))
@@ -77,6 +78,14 @@
   return klass;
 }
 
+static char *
+inspect (VALUE object)
+{
+  VALUE inspected;
+  inspected = rb_funcall (object, cr_id_inspect, 0);
+  return StringValueCStr(inspected);
+}
+
 /* read/write callback */
 typedef struct cr_io_callback_closure {
   VALUE target;
@@ -385,8 +394,18 @@
     }
   else
     {
+      int i;
+      VALUE args;
+
+      args = rb_ary_new2 (n);
+      for (i = 0; i < n; i++)
+        {
+          rb_ary_push (args, argv[i]);
+        }
+
       rb_raise (rb_eArgError,
-                "invalid argument (expect () or (x, y, width, height))");
+                "invalid argument (expect () or (x, y, width, height)): %s",
+                inspect (args));
     }
 
   cr_surface_check_status (_SELF);
@@ -516,7 +535,8 @@
               "invalid argument (expect "
               "(width, height) or "
               "(format, width, height) or "
-              "(data, format, width, height, stride))");
+              "(data, format, width, height, stride)): %s",
+              inspect (rb_ary_new3 (4, arg1, arg2, arg3, arg4)));
 
   cr_surface_check_status (surface);
   DATA_PTR (self) = surface;
@@ -907,7 +927,8 @@
   cr_id_target = rb_intern ("target");
   cr_id_read = rb_intern ("read");
   cr_id_write = rb_intern ("write");
-  
+  cr_id_inspect = rb_intern ("inspect");
+
   rb_cCairo_Surface =
     rb_define_class_under (rb_mCairo, "Surface", rb_cObject);
   rb_define_alloc_func (rb_cCairo_Surface, cr_surface_allocate);
@@ -920,7 +941,7 @@
   rb_define_method (rb_cCairo_Surface, "font_options",
                     cr_surface_get_font_options, 0);
   rb_define_method (rb_cCairo_Surface, "flush", cr_surface_flush, 0);
-  rb_define_method (rb_cCairo_Surface, "mark_dirty", cr_surface_mark_dirty, 0);
+  rb_define_method (rb_cCairo_Surface, "mark_dirty", cr_surface_mark_dirty, -1);
   rb_define_method (rb_cCairo_Surface, "set_device_offset",
                     cr_surface_set_device_offset, 2);
   rb_define_method (rb_cCairo_Surface, "device_offset",



More information about the cairo-commit mailing list