[cairo-commit] rcairo/src rb_cairo_surface.c,1.11,1.12

Kouhei Sutou commit at pdx.freedesktop.org
Sun May 20 16:32:09 PDT 2007


Committed by: kou

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

Modified Files:
	rb_cairo_surface.c 
Log Message:
* src/rb_cairo_surface.c: supported 64bit platform. Thanks to
  Yoshinao Muramatsu!


Index: rb_cairo_surface.c
===================================================================
RCS file: /cvs/cairo/rcairo/src/rb_cairo_surface.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- rb_cairo_surface.c	20 May 2007 11:44:48 -0000	1.11
+++ rb_cairo_surface.c	20 May 2007 23:31:57 -0000	1.12
@@ -724,6 +724,16 @@
 
 #if CAIRO_HAS_WIN32_SURFACE
 /* WIN32-surface functions */
+
+/* from dl/dl.h (ruby 1.9) */
+#if SIZEOF_LONG == SIZEOF_VOIDP
+#  define PTR2NUM(x)   (ULONG2NUM((unsigned long)(x)))
+#  define NUM2PTR(x)   ((void *)(NUM2ULONG(x)))
+#else
+#  define PTR2NUM(x)   (ULL2NUM((unsigned long long)(x)))
+#  define NUM2PTR(x)   ((void *)(NUM2ULL(x)))
+#endif
+
 static VALUE
 cr_win32_surface_initialize (int argc, VALUE *argv, VALUE self)
 {
@@ -737,7 +747,7 @@
     {
     case 1:
       hdc = arg1;
-      surface = cairo_win32_surface_create ((HDC) NUM2UINT (hdc));
+      surface = cairo_win32_surface_create (NUM2PTR (hdc));
       break;
     case 2:
       width = arg1;
@@ -754,7 +764,7 @@
           hdc = arg1;
           width = arg2;
           height = arg3;
-          HDC win32_hdc = NIL_P (hdc) ? NULL : (HDC) NUM2UINT (hdc);
+          HDC win32_hdc = NIL_P (hdc) ? NULL : NUM2PTR (hdc);
           surface = cairo_win32_surface_create_with_ddb (win32_hdc,
                                                          CAIRO_FORMAT_RGB24,
                                                          NUM2INT (width),
@@ -804,7 +814,7 @@
   if (!hdc)
     return Qnil;
   else
-    return UINT2NUM ((unsigned int) hdc);
+    return PTR2NUM (hdc);
 }
 
 static VALUE



More information about the cairo-commit mailing list