X-Git-Url: http://git.code-monkey.de/?p=ruby-ecore.git;a=blobdiff_plain;f=src%2Fecore_evas%2Frb_buffer.c;fp=src%2Fecore_evas%2Frb_buffer.c;h=9526f963cf182bc255af0a8e3eacc9209b40535a;hp=db316cc1737881cf16938c5109bab40899aacfeb;hb=fa957a85d2bac8f3ec0845737540254f25d6685c;hpb=abb800d76a0c982e0038289d4df96e357f791005 diff --git a/src/ecore_evas/rb_buffer.c b/src/ecore_evas/rb_buffer.c index db316cc..9526f96 100644 --- a/src/ecore_evas/rb_buffer.c +++ b/src/ecore_evas/rb_buffer.c @@ -1,5 +1,5 @@ /* - * $Id: rb_buffer.c 174 2005-01-19 21:31:04Z tilman $ + * $Id: rb_buffer.c 351 2006-02-10 15:25:40Z tilman $ * * Copyright (C) 2004-2005 ruby-ecore team (see AUTHORS) * @@ -32,20 +32,29 @@ static void c_free (RbEcoreEvas *ee) c_ecore_evas_free (ee, true); } +static VALUE c_alloc (VALUE klass) +{ + RbEcoreEvas *ee = NULL; + + ecore_init (); + ecore_evas_init (); + + return Data_Make_Struct (klass, RbEcoreEvas, + c_ecore_evas_mark, c_free, ee); +} + /* * call-seq: * Ecore::Evas::Buffer.new([w, h]) => buffer * * Creates an Ecore::Evas::Buffer object. */ -static VALUE c_new (int argc, VALUE *argv, VALUE klass) +static VALUE c_init (int argc, VALUE *argv, VALUE self) { - VALUE self, w, h; - RbEcoreEvas *ee = NULL; + VALUE w, h; int iw = 0, ih = 0; - self = Data_Make_Struct (klass, RbEcoreEvas, - c_ecore_evas_mark, c_free, ee); + GET_OBJ (self, RbEcoreEvas, ee); rb_scan_args (argc, argv, "02", &w, &h); @@ -59,12 +68,9 @@ static VALUE c_new (int argc, VALUE *argv, VALUE klass) ih = FIX2INT (h); } - ecore_init (); - ecore_evas_init (); - ee->real = ecore_evas_buffer_new (iw, ih); - rb_obj_call_init (self, 0, NULL); + rb_call_super (argc, argv); return self; } @@ -89,6 +95,7 @@ void Init_Buffer (void) { VALUE c = rb_define_class_under (mEvas, "Buffer", cEcoreEvas); - rb_define_singleton_method (c, "new", c_new, -1); + rb_define_alloc_func (c, c_alloc); + rb_define_method (c, "initialize", c_init, -1); rb_define_method (c, "pixels", c_pixels_get, 0); }