[cairo-commit] rcairo/src cairo.def, 1.8, 1.9 rb_cairo.h, 1.11, 1.12 rb_cairo_surface.c, 1.20, 1.21

Kouhei Sutou commit at pdx.freedesktop.org
Thu Feb 21 05:29:59 PST 2008


Committed by: kou

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

Modified Files:
	cairo.def rb_cairo.h rb_cairo_surface.c 
Log Message:
* src/cairo.def, src/rb_cairo.h, src/rb_cairo_surface.c:
  Cairo::Win32PrintingSurface will work.


Index: cairo.def
===================================================================
RCS file: /cvs/cairo/rcairo/src/cairo.def,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- cairo.def	21 Feb 2008 13:18:10 -0000	1.8
+++ cairo.def	21 Feb 2008 13:30:19 -0000	1.9
@@ -27,6 +27,7 @@
     rb_cCairo_PSSurface       DATA
     rb_cCairo_SVGSurface      DATA
     rb_cCairo_Win32Surface    DATA
+    rb_cCairo_Win32PrintingSurface DATA
     rb_cCairo_QuartzSurface   DATA
 
     rb_mCairo_Operator        DATA

Index: rb_cairo.h
===================================================================
RCS file: /cvs/cairo/rcairo/src/rb_cairo.h,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- rb_cairo.h	21 Feb 2008 13:18:10 -0000	1.11
+++ rb_cairo.h	21 Feb 2008 13:30:19 -0000	1.12
@@ -104,6 +104,7 @@
 RB_CAIRO_VAR VALUE rb_cCairo_PSSurface;
 RB_CAIRO_VAR VALUE rb_cCairo_SVGSurface;
 RB_CAIRO_VAR VALUE rb_cCairo_Win32Surface;
+RB_CAIRO_VAR VALUE rb_cCairo_Win32PrintingSurface;
 /* For backward compatibility*/
 #define rb_cCairo_WIN32Surface rb_cCairo_Win32Surface
 RB_CAIRO_VAR VALUE rb_cCairo_QuartzSurface;

Index: rb_cairo_surface.c
===================================================================
RCS file: /cvs/cairo/rcairo/src/rb_cairo_surface.c,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- rb_cairo_surface.c	21 Feb 2008 13:18:10 -0000	1.20
+++ rb_cairo_surface.c	21 Feb 2008 13:30:20 -0000	1.21
@@ -30,6 +30,7 @@
 VALUE rb_cCairo_PSSurface = Qnil;
 VALUE rb_cCairo_SVGSurface = Qnil;
 VALUE rb_cCairo_Win32Surface = Qnil;
+VALUE rb_cCairo_Win32PrintingSurface = Qnil;
 VALUE rb_cCairo_QuartzSurface = Qnil;
 
 static ID cr_id_target;
@@ -833,6 +834,21 @@
   return Qnil;
 }
 
+#if CAIRO_CHECK_VERSION(1, 5, 2)
+static VALUE
+cr_win32_printing_surface_initialize (VALUE self, VALUE hdc)
+{
+  cairo_surface_t *surface = NULL;
+
+  surface = cairo_win32_printing_surface_create (NUM2PTR (hdc));
+  cr_surface_check_status (surface);
+  DATA_PTR (self) = surface;
+  if (rb_block_given_p ())
+    yield_and_finish (self);
+  return Qnil;
+}
+#endif
+
 static VALUE
 cr_win32_surface_get_hdc (VALUE self)
 {
@@ -1076,6 +1092,17 @@
                     cr_win32_surface_get_hdc, 0);
   rb_define_method (rb_cCairo_Win32Surface, "image",
                     cr_win32_surface_get_image, 0);
+
+#  if CAIRO_CHECK_VERSION(1, 5, 2)
+  rb_cCairo_Win32PrintingSurface =
+    rb_define_class_under (rb_mCairo, "Win32PrintingSurface", rb_cCairo_Surface);
+
+  rb_define_method (rb_cCairo_Win32PrintingSurfaceSurface, "initialize",
+                    cr_win32_printing_surface_initialize, -1);
+  rb_define_method (rb_cCairo_Win32PrintingSurface, "hdc",
+                    cr_win32_surface_get_hdc, 0);
+#  endif
+
 #endif
 
 #if CAIRO_HAS_QUARTZ_SURFACE



More information about the cairo-commit mailing list