[cairo-commit] rcairo/src rb_cairo_surface.c,1.21,1.22

Kouhei Sutou commit at pdx.freedesktop.org
Sat Feb 23 23:36:34 PST 2008


Committed by: kou

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

Modified Files:
	rb_cairo_surface.c 
Log Message:
* src/rb_cairo_surface.c: worked with cairo >= 1.2.0.


Index: rb_cairo_surface.c
===================================================================
RCS file: /cvs/cairo/rcairo/src/rb_cairo_surface.c,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -d -r1.21 -r1.22
--- rb_cairo_surface.c	21 Feb 2008 13:30:20 -0000	1.21
+++ rb_cairo_surface.c	24 Feb 2008 07:37:18 -0000	1.22
@@ -790,14 +790,21 @@
           (rb_cairo__is_kind_of (arg1, rb_cNumeric) &&
            NUM2INT (arg1) != CAIRO_FORMAT_RGB24))
         {
+#  if CAIRO_CHECK_VERSION(1, 4, 0)
+          HDC win32_hdc;
           hdc = arg1;
           width = arg2;
           height = arg3;
-          HDC win32_hdc = NIL_P (hdc) ? NULL : NUM2PTR (hdc);
+          win32_hdc = NIL_P (hdc) ? NULL : NUM2PTR (hdc);
           surface = cairo_win32_surface_create_with_ddb (win32_hdc,
                                                          CAIRO_FORMAT_RGB24,
                                                          NUM2INT (width),
                                                          NUM2INT (height));
+#  else
+          rb_raise (rb_eArgError,
+                    "Cairo::Win32Surface.new(hdc, width, height) "
+                    "is available since cairo >= 1.4.0");
+#  endif
         }
       else
         {
@@ -811,6 +818,7 @@
       break;
     case 4:
       {
+#  if CAIRO_CHECK_VERSION(1, 4, 0)
         HDC win32_hdc;
         hdc = arg1;
         format = arg2;
@@ -821,6 +829,11 @@
                                                        RVAL2CRFORMAT (format),
                                                        NUM2INT (width),
                                                        NUM2INT (height));
+#  else
+        rb_raise (rb_eArgError,
+                  "Cairo::Win32Surface.new(hdc, format, width, height) "
+                  "is available since cairo >= 1.4.0");
+#  endif
       }
       break;
     }
@@ -834,7 +847,7 @@
   return Qnil;
 }
 
-#if CAIRO_CHECK_VERSION(1, 5, 2)
+#  if CAIRO_CHECK_VERSION(1, 5, 2)
 static VALUE
 cr_win32_printing_surface_initialize (VALUE self, VALUE hdc)
 {
@@ -847,7 +860,7 @@
     yield_and_finish (self);
   return Qnil;
 }
-#endif
+#  endif
 
 static VALUE
 cr_win32_surface_get_hdc (VALUE self)
@@ -861,6 +874,7 @@
     return PTR2NUM (hdc);
 }
 
+#  if CAIRO_CHECK_VERSION(1, 4, 0)
 static VALUE
 cr_win32_surface_get_image (VALUE self)
 {
@@ -872,6 +886,7 @@
   rb_cairo_check_status (cairo_surface_status (surface));
   return CRSURFACE2RVAL (surface);
 }
+#  endif
 #endif
 
 #if CAIRO_HAS_QUARTZ_SURFACE && defined(HAVE_RUBY_COCOA)
@@ -1090,8 +1105,10 @@
                     cr_win32_surface_initialize, -1);
   rb_define_method (rb_cCairo_Win32Surface, "hdc",
                     cr_win32_surface_get_hdc, 0);
+#  if CAIRO_CHECK_VERSION(1, 4, 0)
   rb_define_method (rb_cCairo_Win32Surface, "image",
                     cr_win32_surface_get_image, 0);
+#  endif
 
 #  if CAIRO_CHECK_VERSION(1, 5, 2)
   rb_cCairo_Win32PrintingSurface =



More information about the cairo-commit mailing list