X-Git-Url: http://git.code-monkey.de/?p=ruby-ecore.git;a=blobdiff_plain;f=src%2Fecore_evas%2Frb_buffer.c;h=423bb8f168a99922a6e4d96e131ae02194166a85;hp=db316cc1737881cf16938c5109bab40899aacfeb;hb=0f8d24c745efc1057f8d25ada1375c88a1ab2ed7;hpb=5cc48c20486292fa4bacb9073dd72c6df5414c74 diff --git a/src/ecore_evas/rb_buffer.c b/src/ecore_evas/rb_buffer.c index db316cc..423bb8f 100644 --- a/src/ecore_evas/rb_buffer.c +++ b/src/ecore_evas/rb_buffer.c @@ -1,6 +1,4 @@ /* - * $Id: rb_buffer.c 174 2005-01-19 21:31:04Z tilman $ - * * Copyright (C) 2004-2005 ruby-ecore team (see AUTHORS) * * This library is free software; you can redistribute it and/or @@ -32,20 +30,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 +66,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 +93,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); }