/*
- * $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)
*
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);
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;
}
{
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);
}