[cairo-commit] rcairo/src rb_cairo_surface.c,1.1,1.2
Kouhei Sutou
commit at pdx.freedesktop.org
Sat Apr 7 23:04:11 PDT 2007
- Previous message: [cairo-commit] rcairo/samples pac.rb, 1.6, 1.7 pac2.rb, 1.6,
1.7 png.rb, 1.12, 1.13 scalable.rb, 1.3, 1.4 text-on-path.rb,
1.3, 1.4 text2.rb, 1.6, 1.7
- Next message: [cairo-commit] rcairo ChangeLog,1.122,1.123
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Committed by: kou
Update of /cvs/cairo/rcairo/src
In directory kemper:/tmp/cvs-serv13606/src
Modified Files:
rb_cairo_surface.c
Log Message:
* src/rb_cairo_surface.c (ensure_finish_proc): supported
Cairo::Surface.new with block. If block is exited, a surface is
finished automatically.
* sample/*.rb: followed the above change.
Index: rb_cairo_surface.c
===================================================================
RCS file: /cvs/cairo/rcairo/src/rb_cairo_surface.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- rb_cairo_surface.c 6 Mar 2007 12:17:34 -0000 1.1
+++ rb_cairo_surface.c 8 Apr 2007 06:04:02 -0000 1.2
@@ -294,6 +294,33 @@
}
static VALUE
+ensure_finish_proc (VALUE self)
+{
+ cairo_surface_t *surface;
+ cairo_status_t status;
+
+ surface = _SELF;
+
+ if (cairo_surface_status (surface))
+ return Qnil;
+
+ cairo_surface_finish (surface);
+
+ status = cairo_surface_status (surface);
+ if (status == CAIRO_STATUS_SUCCESS || status == CAIRO_STATUS_SURFACE_FINISHED)
+ return Qnil;
+
+ cr_surface_check_status (surface);
+ return Qnil;
+}
+
+static void
+ensure_finish (VALUE surface)
+{
+ rb_ensure (rb_yield, surface, ensure_finish_proc, surface);
+}
+
+static VALUE
cr_surface_get_type (VALUE self)
{
return INT2NUM (cairo_surface_get_type (_SELF));
@@ -518,6 +545,8 @@
cr_surface_check_status (surface);
DATA_PTR (self) = surface;
+ if (rb_block_given_p ())
+ ensure_finish (self);
return Qnil;
}
@@ -609,6 +638,8 @@
\
cr_surface_check_status (surface); \
DATA_PTR (self) = surface; \
+ if (rb_block_given_p ()) \
+ ensure_finish (self); \
return Qnil; \
}
- Previous message: [cairo-commit] rcairo/samples pac.rb, 1.6, 1.7 pac2.rb, 1.6,
1.7 png.rb, 1.12, 1.13 scalable.rb, 1.3, 1.4 text-on-path.rb,
1.3, 1.4 text2.rb, 1.6, 1.7
- Next message: [cairo-commit] rcairo ChangeLog,1.122,1.123
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the cairo-commit
mailing list