From 2de5f9f833885104f3fb1bf1636d7323c160cdfd Mon Sep 17 00:00:00 2001 From: Tilman Sauerbeck Date: Sat, 26 Jun 2004 16:43:41 +0000 Subject: [PATCH] Added framebuffer support. --- src/ecore_evas/Makefile.am | 5 +- src/ecore_evas/rb_ecore_evas_main.c | 5 +- src/ecore_evas/rb_fb.c | 86 +++++++++++++++++++++++++++++ src/ecore_evas/rb_fb.h | 26 +++++++++ 4 files changed, 118 insertions(+), 4 deletions(-) create mode 100644 src/ecore_evas/rb_fb.c create mode 100644 src/ecore_evas/rb_fb.h diff --git a/src/ecore_evas/Makefile.am b/src/ecore_evas/Makefile.am index 70718a1..f9687ae 100644 --- a/src/ecore_evas/Makefile.am +++ b/src/ecore_evas/Makefile.am @@ -1,4 +1,4 @@ -## $Id: Makefile.am 10 2004-06-19 19:57:02Z tilman $ +## $Id: Makefile.am 22 2004-06-26 16:43:41Z tilman $ AM_CFLAGS = $(ECORE_CFLAGS) $(EVAS_CFLAGS) INCLUDES = -I$(RUBYDIR) -I$(RUBYSITEDIR) @@ -9,7 +9,8 @@ extdir = $(RUBYSITEDIR) ecore_evas_la_SOURCES = rb_ecore_evas_main.c rb_ecore_evas_main.h \ rb_ecore_evas.c rb_ecore_evas.h \ rb_software_x11.c rb_software_x11.h \ - rb_gl_x11.c rb_gl_x11.h + rb_gl_x11.c rb_gl_x11.h \ + rb_fb.c rb_fb.h ecore_evas_la_LIBADD = -lruby $(ECORE_LIBS) $(EVAS_LIBS) ecore_evas_la_LDFLAGS = -module -avoid-version diff --git a/src/ecore_evas/rb_ecore_evas_main.c b/src/ecore_evas/rb_ecore_evas_main.c index 3e00f81..d3487df 100644 --- a/src/ecore_evas/rb_ecore_evas_main.c +++ b/src/ecore_evas/rb_ecore_evas_main.c @@ -1,5 +1,5 @@ /* - * $Id: rb_ecore_evas_main.c 16 2004-06-20 14:28:44Z tilman $ + * $Id: rb_ecore_evas_main.c 22 2004-06-26 16:43:41Z tilman $ * * Copyright (C) 2004 Tilman Sauerbeck (tilman at code-monkey de) * @@ -27,6 +27,7 @@ #include "rb_ecore_evas.h" #include "rb_software_x11.h" #include "rb_gl_x11.h" +#include "rb_fb.h" static VALUE m_init (VALUE self) { @@ -51,6 +52,6 @@ void Init_ecore_evas (void) Init_EcoreEvas (); Init_SoftwareX11 (); Init_GlX11 (); - /*Init_FrameBuffer ();*/ + Init_Fb (); } diff --git a/src/ecore_evas/rb_fb.c b/src/ecore_evas/rb_fb.c new file mode 100644 index 0000000..86b12c2 --- /dev/null +++ b/src/ecore_evas/rb_fb.c @@ -0,0 +1,86 @@ +/* + * $Id$ + * + * Copyright (C) 2004 Tilman Sauerbeck (tilman at code-monkey de) + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include + +#include + +#include "rb_ecore_evas_main.h" +#include "rb_ecore_evas.h" + +VALUE cFb; + +static VALUE c_init (int argc, VALUE *argv, VALUE self) +{ + VALUE disp, rot, w, h; + Ecore_Evas **ee = NULL; + char *cdisp = NULL; + int irot = 0, iw = 0, ih = 0; + + Data_Get_Struct (self, Ecore_Evas *, ee); + + rb_scan_args (argc, argv, "04", &disp, &rot, &w, &h); + + if (!NIL_P (disp)) { + Check_Type (disp, T_STRING); + cdisp = StringValuePtr (disp); + } + + if (!NIL_P (rot)) { + Check_Type (rot, T_FIXNUM); + irot = NUM2INT (rot); + } + + if (!NIL_P (w)) { + Check_Type (w, T_FIXNUM); + iw = NUM2INT (w); + } + + if (!NIL_P (h)) { + Check_Type (h, T_FIXNUM); + ih = NUM2INT (h); + } + + *ee = ecore_evas_fb_new (cdisp, irot, iw, ih); + + return self; +} + +static VALUE c_new (int argc, VALUE *argv, VALUE klass) +{ + VALUE self; + Ecore_Evas **ee; + + self = Data_Make_Struct (klass, Ecore_Evas *, + NULL, c_ecore_evas_free, ee); + + rb_obj_call_init (self, argc, argv); + + return self; +} + +void Init_Fb (void) +{ + cFb = rb_define_class_under (mEvas, "Fb", cEcoreEvas); + + rb_define_singleton_method (cFb, "new", c_new, -1); + rb_define_method (cFb, "initialize", c_init, -1); +} + diff --git a/src/ecore_evas/rb_fb.h b/src/ecore_evas/rb_fb.h new file mode 100644 index 0000000..ffdffbe --- /dev/null +++ b/src/ecore_evas/rb_fb.h @@ -0,0 +1,26 @@ +/* + * $Id$ + * + * Copyright (C) 2004 Tilman Sauerbeck (tilman at code-monkey de) + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef __RB_FB_H +#define __RB_FB_H + +void Init_Fb (void); + +#endif -- 2.30.2