From dfe93a7f0ada3ced637309dc9f6d7a76270f85d6 Mon Sep 17 00:00:00 2001 From: Gustavo Sverzut Barbieri Date: Wed, 5 Dec 2012 12:24:01 +0000 Subject: [PATCH] directfb says bye... After agreement in the mail list, core developers agree to remove this engine that was not being supported for a long time. Given that most operations Evas uses are not accelerated in DirectFB, or at least hardware that exclusively supports DirectFB, it's better for those people to just use Evas/Ecore software (buffer) rendering and expose DirectFB's framebuffer as destination surface. SVN revision: 80232 --- .gitignore | 2 - ChangeLog | 4 + Makefile.am | 10 - NEWS | 6 +- configure.ac | 63 - m4/evas_check_engine.m4 | 34 - pc/ecore-directfb.pc.in | 12 - pc/evas-directfb.pc.in | 3 - src/Makefile.am | 4 - src/Makefile_Ecore_DirectFB.am | 34 - src/Makefile_Ecore_Evas.am | 13 - src/Makefile_Evas.am | 37 - src/lib/ecore_directfb/Ecore_DirectFB.h | 181 -- src/lib/ecore_directfb/ecore_directfb.c | 758 ------- src/lib/ecore_directfb/ecore_directfb_keys.h | 184 -- .../ecore_directfb/ecore_directfb_private.h | 52 - src/lib/ecore_evas/Ecore_Evas.h | 6 +- src/lib/ecore_evas/ecore_evas.c | 28 - src/lib/ecore_evas/ecore_evas_directfb.c | 586 +----- src/lib/ecore_evas/ecore_evas_private.h | 13 - src/lib/evas/Evas.h | 3 +- src/lib/evas/file/evas_module.c | 4 - .../engines/directfb/Evas_Engine_DirectFB.h | 25 - .../evas/engines/directfb/evas_engine.c | 1755 ----------------- .../evas/engines/directfb/evas_engine.h | 71 - src/modules/evas/engines/directfb/polygon.c | 269 --- 26 files changed, 16 insertions(+), 4141 deletions(-) delete mode 100644 pc/ecore-directfb.pc.in delete mode 100644 pc/evas-directfb.pc.in delete mode 100644 src/Makefile_Ecore_DirectFB.am delete mode 100644 src/lib/ecore_directfb/Ecore_DirectFB.h delete mode 100644 src/lib/ecore_directfb/ecore_directfb.c delete mode 100644 src/lib/ecore_directfb/ecore_directfb_keys.h delete mode 100644 src/lib/ecore_directfb/ecore_directfb_private.h delete mode 100644 src/modules/evas/engines/directfb/Evas_Engine_DirectFB.h delete mode 100644 src/modules/evas/engines/directfb/evas_engine.c delete mode 100644 src/modules/evas/engines/directfb/evas_engine.h delete mode 100644 src/modules/evas/engines/directfb/polygon.c diff --git a/.gitignore b/.gitignore index 8cbc80b2dc..4e26642799 100644 --- a/.gitignore +++ b/.gitignore @@ -41,7 +41,6 @@ Makefile.in /pc/evil.pc /pc/embryo.pc /pc/evas-direct3d.pc -/pc/evas-directfb.pc /pc/evas-fb.pc /pc/evas-opengl-cocoa.pc /pc/evas-opengl-sdl.pc @@ -99,7 +98,6 @@ m4/wint_t.m4 m4/xsize.m4 pc/ecore-cocoa.pc pc/ecore-con.pc -pc/ecore-directfb.pc pc/ecore-evas.pc pc/ecore-fb.pc pc/ecore-file.pc diff --git a/ChangeLog b/ChangeLog index faeefbcfdd..92d4e0e013 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2012-12-05 Gustavo Sverzut Barbieri (k-s) + + * Removed DirectFB support (both ecore_directfb, evas and ecore_evas). + 2012-12-04 Gwanglim Lee * Add window profile support: diff --git a/Makefile.am b/Makefile.am index 0cca9c24c4..117a632c6a 100644 --- a/Makefile.am +++ b/Makefile.am @@ -67,7 +67,6 @@ pc/eina.pc \ pc/eet.pc \ pc/eo.pc \ pc/evas.pc \ -pc/evas-directfb.pc \ pc/evas-fb.pc \ pc/evas-opengl-x11.pc \ pc/evas-opengl-sdl.pc \ @@ -85,7 +84,6 @@ pc/ecore-file.pc \ pc/ecore-input.pc \ pc/ecore-input-evas.pc \ pc/ecore-cocoa.pc \ -pc/ecore-directfb.pc \ pc/ecore-fb.pc \ pc/ecore-psl1ght.pc \ pc/ecore-sdl.pc \ @@ -131,10 +129,6 @@ if BUILD_ENGINE_SOFTWARE_X11 pkgconfig_DATA += pc/evas-software-x11.pc endif -if BUILD_ENGINE_DIRECTFB -pkgconfig_DATA += pc/evas-directfb.pc -endif - if BUILD_ENGINE_FB pkgconfig_DATA += pc/evas-fb.pc endif @@ -179,10 +173,6 @@ if HAVE_ECORE_COCOA pkgconfig_DATA += pc/ecore-cocoa.pc endif -if HAVE_ECORE_DIRECTFB -pkgconfig_DATA += pc/ecore-directfb.pc -endif - if HAVE_ECORE_FB pkgconfig_DATA += pc/ecore-fb.pc endif diff --git a/NEWS b/NEWS index 09a0500dc8..660948df74 100644 --- a/NEWS +++ b/NEWS @@ -46,6 +46,10 @@ Deprecations: ECORE_X_ATOM_E_PROFILE_LIST ecore_x_e_window_profile_list_set() ecore_x_e_window_profile_list_get() + * ecore_evas: deprecate directfb engine. + +Removed: + * directfb support: ecore_directfb and evas directfb engine. Improvements: * Single EFL tree covering all EFL library components. @@ -63,4 +67,4 @@ Fixes: to properly handle GL_SCISSOR_BOX and GL_VIEWPORT parameters. * Fixed textblock textprop leak. * Fixed evas_object_box to reset size_hint_min to zero when no child. - * Fix build of Ecore_Evas_Extn on Solaris. \ No newline at end of file + * Fix build of Ecore_Evas_Extn on Solaris. diff --git a/configure.ac b/configure.ac index 525456d981..77a85d9ab8 100644 --- a/configure.ac +++ b/configure.ac @@ -99,7 +99,6 @@ requirements_libs_ecore_ipc="" requirements_libs_ecore_file="" requirements_libs_ecore_input="" requirements_libs_ecore_cocoa="" -requirements_libs_ecore_directfb="" requirements_libs_ecore_fb="" requirements_libs_ecore_psl1ght="" requirements_libs_ecore_sdl="" @@ -129,7 +128,6 @@ requirements_pc_ecore_file="" requirements_pc_ecore_input="" requirements_pc_ecore_input_evas="" requirements_pc_ecore_cocoa="" -requirements_pc_ecore_directfb="" requirements_pc_ecore_fb="" requirements_pc_ecore_psl1ght="" requirements_pc_ecore_sdl="" @@ -178,7 +176,6 @@ AC_SUBST([requirements_libs_ecore_ipc]) AC_SUBST([requirements_libs_ecore_file]) AC_SUBST([requirements_libs_ecore_input]) AC_SUBST([requirements_libs_ecore_cocoa]) -AC_SUBST([requirements_libs_ecore_directfb]) AC_SUBST([requirements_libs_ecore_fb]) AC_SUBST([requirements_libs_ecore_psl1ght]) AC_SUBST([requirements_libs_ecore_sdl]) @@ -208,7 +205,6 @@ AC_SUBST([requirements_pc_ecore_file]) AC_SUBST([requirements_pc_ecore_input]) AC_SUBST([requirements_pc_ecore_input_evas]) AC_SUBST([requirements_pc_ecore_cocoa]) -AC_SUBST([requirements_pc_ecore_directfb]) AC_SUBST([requirements_pc_ecore_fb]) AC_SUBST([requirements_pc_ecore_psl1ght]) AC_SUBST([requirements_pc_ecore_sdl]) @@ -1323,7 +1319,6 @@ want_evas_engine_gl_xcb="no" want_evas_engine_gl_sdl="no" want_evas_engine_gl_cocoa="no" want_evas_engine_fb="no" -want_evas_engine_directfb="no" want_evas_engine_psl1ght="no" want_evas_engine_wayland_shm="no" want_evas_engine_wayland_egl="no" @@ -1502,7 +1497,6 @@ fi ## Engines EVAS_CHECK_ENGINE([buffer], [${want_evas_engine_buffer}], [yes], [Buffer]) -EVAS_CHECK_ENGINE([directfb], [${want_evas_engine_directfb}], [no], [DirectFB]) EVAS_CHECK_ENGINE([fb], [${want_evas_engine_fb}], [no], [Framebuffer]) EVAS_CHECK_ENGINE([gl-cocoa], [${want_evas_engine_gl_cocoa}], [no], [OpenGL Cocoa]) EVAS_CHECK_ENGINE([gl-sdl], [${want_evas_engine_gl_sdl}], [no], [OpenGL SDL]) @@ -2726,47 +2720,6 @@ AM_CONDITIONAL([HAVE_ECORE_COCOA], [test "x${have_ecore_cocoa}" = "xyes"]) #### End of Ecore_Cocoa -#### Ecore_DirectFB - -AC_MSG_NOTICE([Ecore_DirectFB checks]) - -### Additional options to configure - -### Default values - -### Checks for programs - -### Checks for libraries - -## Eina, Ecore - -requirements_pc_ecore_directfb="ecore >= ${PACKAGE_VERSION} eina >= ${PACKAGE_VERSION} ${requirements_pc_ecore_directfb}" - -## DirectFB - -PKG_CHECK_MODULES([ECORE_DIRECTFB], - [directfb >= 0.9.16], - [ - have_ecore_directfb="yes" - requirements_pc_ecore_directfb="directfb >= 0.9.16 ${requirements_pc_ecore_directfb}" - ], - [have_ecore_directfb="no"]) - -AM_CONDITIONAL([HAVE_ECORE_DIRECTFB], [test "x${have_ecore_directfb}" = "xyes"]) - -### Checks for header files - -### Checks for types - -### Checks for structures - -### Checks for compiler characteristics - -### Checks for linker characteristics - -### Checks for library functions - -#### End of Ecore_Directfb #### Ecore_FB @@ -3781,7 +3734,6 @@ want_ecore_evas_software_ddraw="no" want_ecore_evas_software_sdl="no" want_ecore_evas_gl_sdl="no" want_ecore_evas_gl_cocoa="no" -want_ecore_evas_directfb="no" want_ecore_evas_fb="no" want_ecore_evas_ews="yes" want_ecore_evas_extn="yes" @@ -3811,7 +3763,6 @@ case "$host_os" in want_ecore_evas_software_sdl="yes" want_ecore_evas_gl_sdl="yes" want_ecore_evas_gl_cocoa="no" - want_ecore_evas_directfb="yes" want_ecore_evas_fb="yes" want_ecore_evas_wayland_shm="yes" want_ecore_evas_wayland_egl="yes" @@ -3845,15 +3796,6 @@ ECORE_EVAS_CHECK_MODULE_FULL([opengl-cocoa], [${have_ecore_cocoa}], [requirements_pc_ecore_evas="ecore-cocoa >= ${PACKAGE_VERSION} ${requirements_pc_ecore_evas}"]) -# ecore_evas_directfb - -ECORE_EVAS_CHECK_MODULE_FULL([directfb], - [${have_evas_engine_directfb}], - [${want_ecore_evas_directfb}], - [DirectFB], - [${have_ecore_directfb}], - [requirements_pc_ecore_evas="ecore-directfb >= ${PACKAGE_VERSION} ${requirements_pc_ecore_evas}"]) - # ecore_evas_ews ECORE_EVAS_CHECK_MODULE_FULL([ews], @@ -4187,7 +4129,6 @@ pc/escape.pc pc/eina.pc pc/eet.pc pc/eo.pc -pc/evas-directfb.pc pc/evas-fb.pc pc/evas-opengl-x11.pc pc/evas-opengl-sdl.pc @@ -4208,7 +4149,6 @@ pc/ecore-file.pc pc/ecore-input.pc pc/ecore-input-evas.pc pc/ecore-cocoa.pc -pc/ecore-directfb.pc pc/ecore-fb.pc pc/ecore-psl1ght.pc pc/ecore-sdl.pc @@ -4271,7 +4211,6 @@ else fi echo " OpenGL Cocoa...............: $have_evas_engine_gl_cocoa" echo " Software Framebuffer.......: $have_evas_engine_fb" -echo " DirectFB...................: $have_evas_engine_directfb" echo " PSL1GHT....................: $have_evas_engine_psl1ght" echo " Wayland Shm................: $have_evas_engine_wayland_shm" echo " Wayland Egl................: $have_evas_engine_wayland_egl" @@ -4413,7 +4352,6 @@ echo " Ecore_FB...................: $have_ecore_fb" if test "x${have_ecore_fb}" = "xyes" ; then echo " Touchscreen..............: $have_tslib" fi -echo " Ecore_DirectFB.............: $have_ecore_directfb" echo " Ecore_WinCE................: $have_wince" echo " Ecore_PSL1GHT..............: $have_ps3" echo " Ecore_Wayland..............: $have_ecore_wayland" @@ -4436,7 +4374,6 @@ echo " Ecore_Evas...................: $have_ecore_evas" echo " Software SDL...............: $have_ecore_evas_software_sdl" echo " OpenGL SDL.................: $have_ecore_evas_opengl_sdl" echo " OpenGL Cocoa...............: $have_ecore_evas_opengl_cocoa" - echo " DirectFB...................: $have_ecore_evas_directfb" echo " PSL1GHT....................: $have_ecore_evas_psl1ght" echo " Software Framebuffer.......: $have_ecore_evas_fb" echo " Sing.Proc. Windowing System: $have_ecore_evas_ews" diff --git a/m4/evas_check_engine.m4 b/m4/evas_check_engine.m4 index 6e4ef4f375..73623776e8 100644 --- a/m4/evas_check_engine.m4 +++ b/m4/evas_check_engine.m4 @@ -599,40 +599,6 @@ AS_IF([test "x${have_dep}" = "xyes"], [$4], [$5]) ]) -dnl use: EVAS_CHECK_ENGINE_DEP_DIRECTFB(engine, simple, want_static[, ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]]) - -AC_DEFUN([EVAS_CHECK_ENGINE_DEP_DIRECTFB], -[ - -requirement="" -have_dep="no" -evas_engine_[]$1[]_cflags="" -evas_engine_[]$1[]_libs="" - -PKG_CHECK_EXISTS([directfb >= 0.9.16], - [ - have_dep="yes" - requirement="directfb >= 0.9.16" - ], - [have_dep="no"]) - -if test "x${have_dep}" = "xyes" ; then - if test "x$3" = "xstatic" ; then - requirements_pc_evas="${requirement} ${requirements_pc_evas}" - requirements_pc_deps_evas="${requirement} ${requirements_pc_deps_evas}" - else - PKG_CHECK_MODULES([DIRECTFB], [${requirement}]) - evas_image_loader_[]$1[]_cflags="${DIRECTFB_CFLAGS}" - evas_image_loader_[]$1[]_libs="${DIRECTFB_LIBS}" - fi -fi - -AC_SUBST([evas_engine_$1_cflags]) -AC_SUBST([evas_engine_$1_libs]) - -AS_IF([test "x${have_dep}" = "xyes"], [$4], [$5]) - -]) dnl use: EVAS_CHECK_ENGINE_DEP_PSL1GHT(engine, simple, want_static[, ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]]) diff --git a/pc/ecore-directfb.pc.in b/pc/ecore-directfb.pc.in deleted file mode 100644 index b02870b80a..0000000000 --- a/pc/ecore-directfb.pc.in +++ /dev/null @@ -1,12 +0,0 @@ -prefix=@prefix@ -exec_prefix=@exec_prefix@ -libdir=@libdir@ -includedir=@includedir@ - -Name: ecore-directfb -Description: E core library, DirectFB module -Requires.private: @requirements_pc_ecore_directfb@ -Version: @VERSION@ -Libs: -L${libdir} -lecore_directfb -Libs.private: @requirements_libs_ecore_directfb@ -Cflags: -I${includedir}/ecore-@VMAJ@ diff --git a/pc/evas-directfb.pc.in b/pc/evas-directfb.pc.in deleted file mode 100644 index 9a1bc3aba4..0000000000 --- a/pc/evas-directfb.pc.in +++ /dev/null @@ -1,3 +0,0 @@ -Name: evas-directfb -Description: Evas DirectFB engine -Version: @VERSION@ diff --git a/src/Makefile.am b/src/Makefile.am index 73ac3a9048..4cca020e1b 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -29,9 +29,6 @@ include Makefile_Ecore_Input.am if HAVE_ECORE_COCOA include Makefile_Ecore_Cocoa.am endif -if HAVE_ECORE_DIRECTFB -include Makefile_Ecore_DirectFB.am -endif if HAVE_ECORE_FB include Makefile_Ecore_FB.am endif @@ -92,7 +89,6 @@ clean-local: rm -rf modules/eina/mp/chained_pool/*.gcno rm -rf modules/evas/engines/buffer/*.gcno rm -rf modules/evas/engines/direct3d/*.gcno - rm -rf modules/evas/engines/directfb/*.gcno rm -rf modules/evas/engines/fb/*.gcno rm -rf modules/evas/engines/gl_cocoa/*.gcno rm -rf modules/evas/engines/gl_common/*.gcno diff --git a/src/Makefile_Ecore_DirectFB.am b/src/Makefile_Ecore_DirectFB.am deleted file mode 100644 index 6e2d54c27a..0000000000 --- a/src/Makefile_Ecore_DirectFB.am +++ /dev/null @@ -1,34 +0,0 @@ - -### Library - -lib_LTLIBRARIES += lib/ecore_directfb/libecore_directfb.la - -installed_ecoredirectfbmainheadersdir = $(includedir)/ecore-@VMAJ@ -dist_installed_ecoredirectfbmainheaders_DATA = \ -lib/ecore_directfb/Ecore_DirectFB.h - -lib_ecore_directfb_libecore_directfb_la_SOURCES = \ -lib/ecore_directfb/ecore_directfb.c \ -lib/ecore_directfb/ecore_directfb_keys.h \ -lib/ecore_directfb/ecore_directfb_private.h - -lib_ecore_directfb_libecore_directfb_la_CPPFLAGS = \ --I$(top_srcdir)/src/lib/eina \ --I$(top_srcdir)/src/lib/eo \ --I$(top_srcdir)/src/lib/ecore \ --I$(top_srcdir)/src/lib/ecore_directfb \ --I$(top_builddir)/src/lib/eina \ --I$(top_builddir)/src/lib/eo \ --I$(top_builddir)/src/lib/ecore \ --I$(top_builddir)/src/lib/ecore_directfb \ -@EFL_CFLAGS@ \ -@EFL_COV_CFLAGS@ \ -@ECORE_DIRECTFB_CFLAGS@ - -lib_ecore_directfb_libecore_directfb_la_LIBADD = \ -lib/ecore/libecore.la \ -lib/eo/libeo.la \ -lib/eina/libeina.la \ -@ECORE_DIRECTFB_LIBS@ - -lib_ecore_directfb_libecore_directfb_la_LDFLAGS = -no-undefined -version-info @version_info@ @release_info@ diff --git a/src/Makefile_Ecore_Evas.am b/src/Makefile_Ecore_Evas.am index 40036b753d..70a5579f4e 100644 --- a/src/Makefile_Ecore_Evas.am +++ b/src/Makefile_Ecore_Evas.am @@ -61,14 +61,6 @@ lib_ecore_evas_libecore_evas_la_CPPFLAGS += \ -I$(top_builddir)/src/modules/evas/engines/gl_cocoa endif -if HAVE_ECORE_DIRECTFB -lib_ecore_evas_libecore_evas_la_CPPFLAGS += \ --I$(top_srcdir)/src/lib/ecore_directfb \ --I$(top_srcdir)/src/modules/evas/engines/directfb \ --I$(top_builddir)/src/lib/ecore_directfb \ --I$(top_builddir)/src/modules/evas/engines/directfb -endif - if HAVE_ECORE_FB lib_ecore_evas_libecore_evas_la_CPPFLAGS += \ -I$(top_srcdir)/src/lib/ecore_fb \ @@ -144,11 +136,6 @@ lib_ecore_evas_libecore_evas_la_LIBADD += \ lib/ecore_cocoa/libecore_cocoa.la endif -if HAVE_ECORE_DIRECTFB -lib_ecore_evas_libecore_evas_la_LIBADD += \ -lib/ecore_directfb/libecore_directfb.la -endif - if HAVE_ECORE_FB lib_ecore_evas_libecore_evas_la_LIBADD += \ lib/ecore_fb/libecore_fb.la diff --git a/src/Makefile_Evas.am b/src/Makefile_Evas.am index 3b7aa80c77..bcd5fe73a7 100644 --- a/src/Makefile_Evas.am +++ b/src/Makefile_Evas.am @@ -439,43 +439,6 @@ modules_evas_engines_buffer_module_la_LIBTOOLFLAGS = --tag=disable-static endif endif -if BUILD_ENGINE_DIRECTFB -dist_installed_evasmainheaders_DATA += modules/evas/engines/directfb/Evas_Engine_DirectFB.h -DIRECTFB_SOURCES = \ -modules/evas/engines/directfb/evas_engine.c \ -modules/evas/engines/directfb/polygon.c \ -modules/evas/engines/directfb/evas_engine.h -if EVAS_STATIC_BUILD_DIRECTFB -lib_evas_libevas_la_SOURCES += $(DIRECTFB_SOURCES) -lib_evas_libevas_la_CPPFLAGS += @evas_engine_directfb_cflags@ -lib_evas_libevas_la_LIBADD += @evas_engine_directfb_libs@ -else -enginedirectfbpkgdir = $(libdir)/evas/modules/engines/directfb/$(MODULE_ARCH) -enginedirectfbpkg_LTLIBRARIES = modules/evas/engines/directfb/module.la -modules_evas_engines_directfb_module_la_SOURCES = $(DIRECTFB_SOURCES) -modules_evas_engines_directfb_module_la_CPPFLAGS = \ --I$(top_srcdir)/src/lib/eina \ --I$(top_builddir)/src/lib/eina \ --I$(top_srcdir)/src/lib/eo \ --I$(top_builddir)/src/lib/eo \ --I$(top_srcdir)/src/lib/evas \ --I$(top_builddir)/src/lib/evas \ --I$(top_srcdir)/src/lib/evas/include \ --I$(top_builddir)/src/lib/evas/include \ --I$(top_srcdir)/src/lib/evas/cserve2 \ --I$(top_builddir)/src/lib/evas/cserve2 \ -@evas_engine_directfb_cflags@ \ -@EFL_CFLAGS@ \ -@EVAS_CFLAGS@ -modules_evas_engines_directfb_module_la_LIBADD = \ -lib/evas/libevas.la \ -@EFL_LIBS@ \ -@evas_engine_directfb_libs@ -modules_evas_engines_directfb_module_la_LDFLAGS = -no-undefined -module -avoid-version -modules_evas_engines_directfb_module_la_LIBTOOLFLAGS = --tag=disable-static -endif -endif - if BUILD_ENGINE_FB dist_installed_evasmainheaders_DATA += modules/evas/engines/fb/Evas_Engine_FB.h FB_SOURCES = \ diff --git a/src/lib/ecore_directfb/Ecore_DirectFB.h b/src/lib/ecore_directfb/Ecore_DirectFB.h deleted file mode 100644 index 3b94816d96..0000000000 --- a/src/lib/ecore_directfb/Ecore_DirectFB.h +++ /dev/null @@ -1,181 +0,0 @@ -#ifndef _ECORE_DIRECTFB_H -#define _ECORE_DIRECTFB_H - -#include - -#include - -#ifdef EAPI -# undef EAPI -#endif /* ifdef EAPI */ - -#ifdef __GNUC__ -# if __GNUC__ >= 4 -# define EAPI __attribute__ ((visibility("default"))) -# else /* if __GNUC__ >= 4 */ -# define EAPI -# endif /* if __GNUC__ >= 4 */ -#else /* ifdef __GNUC__ */ -# define EAPI -#endif /* ifdef __GNUC__ */ - -#ifdef __cplusplus -extern "C" { -#endif /* ifdef __cplusplus */ - -EAPI extern int ECORE_DIRECTFB_EVENT_POSITION; -EAPI extern int ECORE_DIRECTFB_EVENT_SIZE; -EAPI extern int ECORE_DIRECTFB_EVENT_CLOSE; -EAPI extern int ECORE_DIRECTFB_EVENT_DESTROYED; -EAPI extern int ECORE_DIRECTFB_EVENT_GOT_FOCUS; -EAPI extern int ECORE_DIRECTFB_EVENT_LOST_FOCUS; -EAPI extern int ECORE_DIRECTFB_EVENT_KEY_DOWN; -EAPI extern int ECORE_DIRECTFB_EVENT_KEY_UP; -EAPI extern int ECORE_DIRECTFB_EVENT_BUTTON_DOWN; -EAPI extern int ECORE_DIRECTFB_EVENT_BUTTON_UP; -EAPI extern int ECORE_DIRECTFB_EVENT_MOTION; -EAPI extern int ECORE_DIRECTFB_EVENT_ENTER; -EAPI extern int ECORE_DIRECTFB_EVENT_LEAVE; -EAPI extern int ECORE_DIRECTFB_EVENT_WHEEL; - -#ifndef _ECORE_DIRECTFB_WINDOW_PREDEF -typedef struct _Ecore_DirectFB_Window Ecore_DirectFB_Window; -#endif /* ifndef _ECORE_DIRECTFB_WINDOW_PREDEF */ -typedef struct _Ecore_DirectFB_Cursor Ecore_DirectFB_Cursor; - -typedef struct _Ecore_DirectFB_Event_Key_Down Ecore_DirectFB_Event_Key_Down; -typedef struct _Ecore_DirectFB_Event_Key_Up Ecore_DirectFB_Event_Key_Up; -typedef struct _Ecore_DirectFB_Event_Button_Down Ecore_DirectFB_Event_Button_Down; -typedef struct _Ecore_DirectFB_Event_Button_Up Ecore_DirectFB_Event_Button_Up; -typedef struct _Ecore_DirectFB_Event_Motion Ecore_DirectFB_Event_Motion; -typedef struct _Ecore_DirectFB_Event_Enter Ecore_DirectFB_Event_Enter; -typedef struct _Ecore_DirectFB_Event_Leave Ecore_DirectFB_Event_Leave; -typedef struct _Ecore_DirectFB_Event_Wheel Ecore_DirectFB_Event_Wheel; -typedef struct _Ecore_DirectFB_Event_Got_Focus Ecore_DirectFB_Event_Got_Focus; -typedef struct _Ecore_DirectFB_Event_Lost_Focus Ecore_DirectFB_Event_Lost_Focus; - -/* this struct is to keep windows data (id, window itself and surface) in memory as every call - * to DirectFB for this values (e.g window->GetSurface(window,&surface)) will increment the - * reference count, then we will have to release N times the data, so better we just ask for - them once */ -struct _Ecore_DirectFB_Window -{ - DFBWindowID id; - IDirectFBWindow *window; - IDirectFBSurface *surface; - Ecore_DirectFB_Cursor *cursor; -}; - -struct _Ecore_DirectFB_Cursor -{ - IDirectFBSurface *surface; - int hot_x; - int hot_y; -}; - -struct _Ecore_DirectFB_Event_Key_Down /** DirectFB Key Down event */ -{ - char *name; /**< The name of the key that was released */ - char *string; /**< The logical symbol of the key that was pressed */ - char *key_compose; /**< The UTF-8 string conversion if any */ - unsigned int time; - DFBWindowID win; -}; - -struct _Ecore_DirectFB_Event_Key_Up /** DirectFB Key Up event */ -{ - char *name; /**< The name of the key that was released */ - char *string; /**< The logical symbol of the key that was pressed */ - char *key_compose; /**< The UTF-8 string conversion if any */ - unsigned int time; - DFBWindowID win; -}; - -struct _Ecore_DirectFB_Event_Button_Down -{ - int button; - int modifiers; - int x, y; - unsigned int time; - int double_click : 1; - int triple_click : 1; - DFBWindowID win; -}; -struct _Ecore_DirectFB_Event_Button_Up -{ - int button; - int modifiers; - int x, y; - unsigned int time; - DFBWindowID win; - int double_click : 1; - int triple_click : 1; -}; -struct _Ecore_DirectFB_Event_Motion -{ - int modifiers; - int x, y; - unsigned int time; - DFBWindowID win; -}; - -struct _Ecore_DirectFB_Event_Enter -{ - int modifiers; - int x, y; - unsigned int time; - DFBWindowID win; -}; - -struct _Ecore_DirectFB_Event_Leave -{ - int modifiers; - int x, y; - unsigned int time; - DFBWindowID win; -}; - -struct _Ecore_DirectFB_Event_Wheel -{ - int direction; - int z; - int modifiers; - unsigned int time; - DFBWindowID win; -}; - -struct _Ecore_DirectFB_Event_Got_Focus -{ - unsigned int time; - DFBWindowID win; -}; - -struct _Ecore_DirectFB_Event_Lost_Focus -{ - unsigned int time; - DFBWindowID win; -}; - -/* main functions */ -EAPI int ecore_directfb_init(const char *name); -EAPI int ecore_directfb_shutdown(void); -EAPI IDirectFB * ecore_directfb_interface_get(void); - -/* window operations */ -EAPI Ecore_DirectFB_Window *ecore_directfb_window_new(int x, int y, int w, int h); -EAPI void ecore_directfb_window_free(Ecore_DirectFB_Window *window); -EAPI void ecore_directfb_window_move(Ecore_DirectFB_Window *window, int x, int y); -EAPI void ecore_directfb_window_resize(Ecore_DirectFB_Window *window, int w, int h); -EAPI void ecore_directfb_window_focus(Ecore_DirectFB_Window *window); -EAPI void ecore_directfb_window_show(Ecore_DirectFB_Window *window); -EAPI void ecore_directfb_window_hide(Ecore_DirectFB_Window *window); -EAPI void ecore_directfb_window_shaped_set(Ecore_DirectFB_Window *window, Eina_Bool set); -EAPI void ecore_directfb_window_fullscreen_set(Ecore_DirectFB_Window *window, Eina_Bool set); -EAPI void ecore_directfb_window_size_get(Ecore_DirectFB_Window *window, int *w, int *h); -EAPI void ecore_directfb_window_cursor_show(Ecore_DirectFB_Window *window, Eina_Bool show); - -#ifdef __cplusplus -} -#endif /* ifdef __cplusplus */ - -#endif /* ifndef _ECORE_DIRECTFB_H */ diff --git a/src/lib/ecore_directfb/ecore_directfb.c b/src/lib/ecore_directfb/ecore_directfb.c deleted file mode 100644 index 008fa1d6f9..0000000000 --- a/src/lib/ecore_directfb/ecore_directfb.c +++ /dev/null @@ -1,758 +0,0 @@ -#ifdef HAVE_CONFIG_H -# include -#endif /* ifdef HAVE_CONFIG_H */ - -#include -#include -#include - -#include "Ecore_DirectFB.h" -#include "ecore_directfb_private.h" -#include "ecore_directfb_keys.h" -#include "Ecore.h" -#include "ecore_private.h" - -/* ecore_directfb */ -/******************/ -/* About */ -/* with this you can create windows of directfb and handle events through ecore - * TODO: - * - handle all event types - * - - * */ -int _ecore_directfb_log_dom = -1; - -static int _ecore_directfb_init_count = 0; - -static int _window_event_fd = 0; -static int _input_event_fd = 0; - -static int _ecore_directfb_fullscreen_window_id = 0; -static int _cursor_x = 0; -static int _cursor_y = 0; - -EAPI int ECORE_DIRECTFB_EVENT_POSITION = 0; -EAPI int ECORE_DIRECTFB_EVENT_SIZE = 0; -EAPI int ECORE_DIRECTFB_EVENT_CLOSE = 0; -EAPI int ECORE_DIRECTFB_EVENT_DESTROYED = 0; -EAPI int ECORE_DIRECTFB_EVENT_GOT_FOCUS = 0; -EAPI int ECORE_DIRECTFB_EVENT_LOST_FOCUS = 0; -EAPI int ECORE_DIRECTFB_EVENT_KEY_DOWN = 0; -EAPI int ECORE_DIRECTFB_EVENT_KEY_UP = 0; -EAPI int ECORE_DIRECTFB_EVENT_BUTTON_DOWN = 0; -EAPI int ECORE_DIRECTFB_EVENT_BUTTON_UP = 0; -EAPI int ECORE_DIRECTFB_EVENT_MOTION = 0; -EAPI int ECORE_DIRECTFB_EVENT_ENTER = 0; -EAPI int ECORE_DIRECTFB_EVENT_LEAVE = 0; -EAPI int ECORE_DIRECTFB_EVENT_WHEEL = 0; - -static Ecore_Fd_Handler *_window_event_fd_handler_handle = NULL; -static Ecore_Fd_Handler *_input_event_fd_handler_handle = NULL; - -/* this hash is to store all the possible key names for fast lookup */ -static Eina_Hash *_ecore_directfb_key_symbols_hash = NULL; - -static IDirectFB *_dfb = NULL; // the main interface -static IDirectFBEventBuffer *_window_event; // the main event buffer (all windows are attached to this) -static IDirectFBEventBuffer *_input_event; // the main event buffer (all windows are attached to this) -static IDirectFBDisplayLayer *_layer; // the main layer -static DFBResult _err; // useful for DFBCHECK - -/*******************/ -/* local functions */ -/*******************/ - -/* free ecore directfb events functions */ -/****************************************/ - -static void -_ecore_directfb_event_free_key_down(void *data EINA_UNUSED, void *ev) -{ - Ecore_DirectFB_Event_Key_Down *e; - - e = ev; - if(e->name) - free(e->name); - - if (e->string) - free(e->string); - - if (e->key_compose) - free(e->key_compose); - - free(e); -} - -static void -_ecore_directfb_event_free_key_up(void *data EINA_UNUSED, void *ev) -{ - Ecore_DirectFB_Event_Key_Up *e; - - e = ev; - if(e->name) - free(e->name); - - if (e->string) - free(e->string); - - if (e->key_compose) - free(e->key_compose); - - free(e); -} - -/* directfb window input events handler */ -/****************************************/ - -static void -_ecore_directfb_event_handle_motion(DFBEvent *evt) -{ - Ecore_DirectFB_Event_Motion *e; - e = calloc(1, sizeof(Ecore_DirectFB_Event_Motion)); - - switch(evt->clazz) - { - case DFEC_INPUT: - e->modifiers = 0; - switch(evt->input.axis) - { - case DIAI_X: - e->x = _cursor_x = evt->input.axisabs; - e->y = _cursor_y; - break; - - case DIAI_Y: - e->y = _cursor_y = evt->input.axisabs; - e->x = _cursor_x; - break; - - case DIAI_Z: - //_ecore_directfb_event_handle_wheel(evt); - return; - - default: - return; - } - e->win = _ecore_directfb_fullscreen_window_id; - e->time = 0; - break; - - case DFEC_WINDOW: - e->modifiers = 0; - e->x = evt->window.x; - e->y = evt->window.y; - e->win = evt->window.window_id; - e->time = 0; - break; - - default: - break; - } - ecore_event_add(ECORE_DIRECTFB_EVENT_MOTION, e, NULL, NULL); -} - -static void -_ecore_directfb_event_handle_key_down(DFBEvent *evt) -{ - Ecore_DirectFB_Event_Key_Down *e; - unsigned int key_symbol; - struct keymap *k; - - e = calloc(1, sizeof(Ecore_DirectFB_Event_Key_Down)); - - switch(evt->clazz) - { - case DFEC_INPUT: - key_symbol = evt->input.key_symbol; - k = eina_hash_find(_ecore_directfb_key_symbols_hash, &key_symbol); - - if(!k) - { - ERR("Symbol %0X of class DFEC_INPUT not found.", evt->input.key_symbol); - return; - } - - e->name = strdup(k->name); - e->string = strdup(k->string); - e->key_compose = NULL; - e->win = _ecore_directfb_fullscreen_window_id; - e->time = 0; - break; - - case DFEC_WINDOW: - key_symbol = evt->window.key_symbol; - k = eina_hash_find(_ecore_directfb_key_symbols_hash, &key_symbol); - - if(!k) - { - ERR("Symbol %0X of class DFEC_WINDOW not found.", evt->window.key_symbol); - return; - } - - e->name = strdup(k->name); - e->string = strdup(k->string); - e->key_compose = NULL; - e->win = evt->window.window_id; - e->time = 0; - break; - - default: - break; - } - - ecore_event_add(ECORE_DIRECTFB_EVENT_KEY_DOWN, e, _ecore_directfb_event_free_key_down, NULL); -} - -static void -_ecore_directfb_event_handle_key_up(DFBEvent *evt) -{ - Ecore_DirectFB_Event_Key_Up *e; - unsigned int key_symbol; - struct keymap *k; - - e = calloc(1, sizeof(Ecore_DirectFB_Event_Key_Up)); - - switch(evt->clazz) - { - case DFEC_INPUT: - key_symbol = evt->input.key_symbol; - k = eina_hash_find(_ecore_directfb_key_symbols_hash, &key_symbol); - - if(!k) - { - ERR("Symbol %0X of class DFEC_INPUT not found.", evt->input.key_symbol); - return; - } - - e->name = strdup(k->name); - e->string = strdup(k->string); - e->key_compose = NULL; - e->win = _ecore_directfb_fullscreen_window_id; - e->time = 0; - break; - - case DFEC_WINDOW: - key_symbol = evt->window.key_symbol; - k = eina_hash_find(_ecore_directfb_key_symbols_hash, &key_symbol); - - if(!k) - { - ERR("Symbol %0X of class DFEC_WINDOW not found.", evt->window.key_symbol); - return; - } - - e->name = strdup(k->name); - e->string = strdup(k->string); - e->key_compose = NULL; - e->win = evt->window.window_id; - e->time = 0; - break; - - default: - break; - } - ecore_event_add(ECORE_DIRECTFB_EVENT_KEY_UP, e, _ecore_directfb_event_free_key_up, NULL); -} - -static void -_ecore_directfb_event_handle_button_down(DFBEvent *evt) -{ - Ecore_DirectFB_Event_Button_Down *e; - e = calloc(1, sizeof(Ecore_DirectFB_Event_Button_Down)); - - switch(evt->clazz) - { - case DFEC_INPUT: - e->button = evt->input.button + 1; - e->modifiers = 0; - DFBCHECK(_layer->GetCursorPosition(_layer,&e->x,&e->y)); - e->x = _cursor_x; - e->y = _cursor_y; - e->win = _ecore_directfb_fullscreen_window_id; - e->time = 0; - - break; - - case DFEC_WINDOW: - e->button = evt->window.button + 1; - e->modifiers = 0; - e->x = evt->window.x; - e->y = evt->window.y; - e->win = evt->window.window_id; - e->time = 0; - break; - - default: - break; - } - - ecore_event_add(ECORE_DIRECTFB_EVENT_BUTTON_DOWN, e, NULL, NULL); -} - -static void -_ecore_directfb_event_handle_button_up(DFBEvent *evt) -{ - Ecore_DirectFB_Event_Button_Up *e; - e = calloc(1, sizeof(Ecore_DirectFB_Event_Button_Up)); - - switch(evt->clazz) - { - case DFEC_INPUT: - e->button = evt->input.button + 1; - e->modifiers = 0; - e->x = _cursor_x; - e->y = _cursor_y; - e->win = _ecore_directfb_fullscreen_window_id; - e->time = 0; - - break; - - case DFEC_WINDOW: - e->button = evt->window.button + 1; - e->modifiers = 0; - e->x = evt->window.x; - e->y = evt->window.y; - e->win = evt->window.window_id; - e->time = 0; - break; - - default: - break; - } - ecore_event_add(ECORE_DIRECTFB_EVENT_BUTTON_UP, e, NULL, NULL); -} - -static void -_ecore_directfb_event_handle_enter(DFBWindowEvent *evt) -{ - Ecore_DirectFB_Event_Enter *e; - e = calloc(1, sizeof(Ecore_DirectFB_Event_Enter)); - - e->modifiers = 0; - e->x = evt->x; - e->y = evt->y; - e->win = evt->window_id; - e->time = 0; - - ecore_event_add(ECORE_DIRECTFB_EVENT_ENTER, e, NULL, NULL); -} - -static void -_ecore_directfb_event_handle_leave(DFBWindowEvent *evt) -{ - Ecore_DirectFB_Event_Leave *e; - e = calloc(1, sizeof(Ecore_DirectFB_Event_Leave)); - - e->modifiers = 0; - e->x = evt->x; - e->y = evt->y; - e->win = evt->window_id; - e->time = 0; - - ecore_event_add(ECORE_DIRECTFB_EVENT_LEAVE, e, NULL, NULL); -} - -static void -_ecore_directfb_event_handle_wheel(DFBWindowEvent *evt) -{ - Ecore_DirectFB_Event_Wheel *e; - e = calloc(1, sizeof(Ecore_DirectFB_Event_Wheel)); - - // currently there's no direction (only up/down); - e->direction = 0; - e->z = evt->step; - e->modifiers = 0; - e->win = evt->window_id; - e->time = 0; - - ecore_event_add(ECORE_DIRECTFB_EVENT_WHEEL, e, NULL, NULL); -} - -static void -_ecore_directfb_event_handle_got_focus(DFBWindowEvent *evt) -{ - Ecore_DirectFB_Event_Got_Focus *e; - e = calloc(1, sizeof(Ecore_DirectFB_Event_Got_Focus)); - - e->win = evt->window_id; - e->time = 0; - - ecore_event_add(ECORE_DIRECTFB_EVENT_GOT_FOCUS, e, NULL, NULL); -} - -static void -_ecore_directfb_event_handle_lost_focus(DFBWindowEvent *evt) -{ - Ecore_DirectFB_Event_Lost_Focus *e; - e = calloc(1, sizeof(Ecore_DirectFB_Event_Lost_Focus)); - - e->win = evt->window_id; - e->time = 0; - - ecore_event_add(ECORE_DIRECTFB_EVENT_LOST_FOCUS, e, NULL, NULL); -} - -/* inputs and windows fds handlers */ -/***********************************/ -/* TODO fix this to handle windows and input events (fullscreen/window mode) - * in fullscreen theres no window_id so get the id from a global var (only one fullscreen - * window at a time */ - -static Eina_Bool -_ecore_directfb_input_event_fd_handler(void *data EINA_UNUSED,Ecore_Fd_Handler *fd_handler EINA_UNUSED) -{ - DFBEvent evt; - int v = 0; - - v = read(_input_event_fd, &evt, sizeof(DFBEvent)); - if (v < 0) - return EINA_TRUE; - - if (v < 1) - return EINA_TRUE; - - /* we are getting duplicate events, only parse if we are in fullscreen */ - //if(_ecore_directfb_fullscreen_window_id == 0) break; - if(evt.input.type == DIET_KEYPRESS) - _ecore_directfb_event_handle_key_down(&evt); - - if(evt.input.type == DIET_KEYRELEASE) - _ecore_directfb_event_handle_key_up(&evt); - - if(evt.input.type == DIET_BUTTONPRESS) - _ecore_directfb_event_handle_button_down(&evt); - - if(evt.input.type == DIET_BUTTONRELEASE) - _ecore_directfb_event_handle_button_up(&evt); - - if(evt.input.type == DIET_AXISMOTION) - _ecore_directfb_event_handle_motion(&evt); - - return EINA_TRUE; -} - -static Eina_Bool -_ecore_directfb_window_event_fd_handler(void *data EINA_UNUSED,Ecore_Fd_Handler *fd_handler EINA_UNUSED) -{ - DFBEvent evt; - int v = 0; - - v = read(_window_event_fd, &evt, sizeof(DFBEvent)); - if (v < 0) - return EINA_TRUE; - - if (v < 1) - return EINA_TRUE; - - if(evt.window.type & DWET_POSITION) - INF("position"); - - if(evt.window.type & DWET_SIZE) - INF("size"); - - if(evt.window.type & DWET_CLOSE) - INF("close"); - - if(evt.window.type & DWET_DESTROYED) - INF("destroyed"); - - if(evt.window.type & DWET_GOTFOCUS) - _ecore_directfb_event_handle_got_focus(&evt.window); - - if(evt.window.type & DWET_LOSTFOCUS) - _ecore_directfb_event_handle_lost_focus(&evt.window); - - if(evt.window.type & DWET_KEYDOWN) - _ecore_directfb_event_handle_key_down(&evt); - - if(evt.window.type & DWET_KEYUP) - _ecore_directfb_event_handle_key_up(&evt); - - if(evt.window.type & DWET_BUTTONDOWN) - _ecore_directfb_event_handle_button_down(&evt); - - if(evt.window.type & DWET_BUTTONUP) - _ecore_directfb_event_handle_button_up(&evt); - - if(evt.window.type & DWET_MOTION) - _ecore_directfb_event_handle_motion(&evt); - - if(evt.window.type & DWET_ENTER) - _ecore_directfb_event_handle_enter(&evt.window); - - if(evt.window.type & DWET_LEAVE) - _ecore_directfb_event_handle_leave(&evt.window); - - if(evt.window.type & DWET_WHEEL) - _ecore_directfb_event_handle_wheel(&evt.window); - - return EINA_TRUE; -} - -/* api functions */ -/*****************/ - -EAPI IDirectFB * -ecore_directfb_interface_get(void) -{ - return _dfb; -} - -EAPI Ecore_DirectFB_Window * -ecore_directfb_window_new(int x, int y, int w, int h) -{ - Ecore_DirectFB_Window *window; - IDirectFBWindow *dfb_window; - IDirectFBSurface *dfb_surface = NULL; - DFBWindowDescription desc; - DFBWindowID id; - - memset(&desc, 0, sizeof(DFBWindowDescription)); - desc.flags = (DWDESC_POSX | DWDESC_POSY | DWDESC_WIDTH | DWDESC_HEIGHT | DWDESC_CAPS); - desc.posx = x; - desc.posy = y; - desc.width = w; - desc.height = h; - desc.caps = DWCAPS_ALPHACHANNEL; - - DFBCHECK(_layer->CreateWindow(_layer, &desc, &dfb_window)); - - dfb_window->AttachEventBuffer(dfb_window, _window_event); - dfb_window->SetOptions(dfb_window,DWOP_NONE); - dfb_window->SetOpacity(dfb_window, 0xFF); - - DFBCHECK(dfb_window->GetID(dfb_window, &id)); - DFBCHECK(dfb_window->GetSurface(dfb_window,&dfb_surface)); - - window = malloc(sizeof(Ecore_DirectFB_Window)); - window->id = id; - window->window = dfb_window; - window->surface = dfb_surface; - window->cursor = NULL; - - return window; -} - -EAPI void -ecore_directfb_window_free(Ecore_DirectFB_Window *ecore_window) -{ - DFBCHECK(ecore_window->surface->Release(ecore_window->surface)); - DFBCHECK(ecore_window->window->Release(ecore_window->window)); - free(ecore_window); -} - -EAPI void -ecore_directfb_window_move(Ecore_DirectFB_Window *ecore_window, int x, int y) -{ - DFBCHECK(ecore_window->window->MoveTo(ecore_window->window, x, y)); -} - -EAPI void -ecore_directfb_window_resize(Ecore_DirectFB_Window *ecore_window, int w, int h) -{ - DFBCHECK(ecore_window->window->Resize(ecore_window->window, w, h)); -} - -EAPI void -ecore_directfb_window_focus(Ecore_DirectFB_Window *ecore_window) -{ - DFBCHECK(ecore_window->window->RequestFocus(ecore_window->window)); -} - -EAPI void -ecore_directfb_window_hide(Ecore_DirectFB_Window *ecore_window) -{ - DFBCHECK(ecore_window->window->SetOpacity(ecore_window->window, 0)); -} - -EAPI void -ecore_directfb_window_show(Ecore_DirectFB_Window *ecore_window) -{ - DFBCHECK(ecore_window->window->SetOpacity(ecore_window->window, 0xFF)); -} - -EAPI void -ecore_directfb_window_shaped_set(Ecore_DirectFB_Window *ecore_window, Eina_Bool set) -{ - DFBWindowOptions opts; - - DFBCHECK(ecore_window->window->GetOptions(ecore_window->window, &opts)); - if(set) - { - opts |= DWOP_SHAPED; - opts |= DWOP_ALPHACHANNEL; - DFBCHECK(ecore_window->window->SetOptions(ecore_window->window, opts)); - } - else - { - opts &= ~DWOP_SHAPED; - opts &= ~DWOP_ALPHACHANNEL; - DFBCHECK(ecore_window->window->SetOptions(ecore_window->window, opts)); - } -} - -EAPI void -ecore_directfb_window_cursor_show(Ecore_DirectFB_Window *ecore_window, Eina_Bool show) -{ - if(!show) - { - /* create an empty cursor and set it */ - IDirectFBSurface *cursor; - DFBSurfaceDescription desc; - - memset(&desc, 0, sizeof(DFBSurfaceDescription)); - desc.flags = (DSDESC_HEIGHT | DSDESC_WIDTH | DSDESC_PIXELFORMAT); - desc.width = 1; - desc.height = 1; - desc.pixelformat = DSPF_A1; - - DFBCHECK(_dfb->CreateSurface(_dfb,&desc,&cursor)); - DFBCHECK(cursor->Clear(cursor,0,0,0,0)); - DFBCHECK(ecore_window->window->SetCursorShape(ecore_window->window, cursor, 0, 0)); - } - else - { - /* we already have a cursor surface so set it*/ - if(ecore_window->cursor) - { - DFBCHECK(ecore_window->window->SetCursorShape(ecore_window->window, ecore_window->cursor->surface, ecore_window->cursor->hot_x, ecore_window->cursor->hot_y)); - } - /* or just set the default directfb cursor */ - else - { - DFBCHECK(ecore_window->window->SetCursorShape(ecore_window->window, NULL, 0, 0)); - } - } -} - -EAPI void -ecore_directfb_window_cursor_set(Ecore_DirectFB_Window *ecore_window, Ecore_DirectFB_Cursor *cursor) -{ - if((!cursor) && (ecore_window->cursor)) - { - ecore_window->cursor = NULL; - DFBCHECK(ecore_window->window->SetCursorShape(ecore_window->window, NULL, 0, 0)); - return; - } - - if(cursor) - { - ecore_window->cursor = cursor; - DFBCHECK(ecore_window->window->SetCursorShape(ecore_window->window, cursor->surface, cursor->hot_x, cursor->hot_y)); - } -} - -EAPI void -ecore_directfb_window_fullscreen_set(Ecore_DirectFB_Window *ecore_window, Eina_Bool on) -{ - // always release the surface (we are going to get a new one in both cases) - DFBCHECK(ecore_window->surface->Release(ecore_window->surface)); - if(on) - { - DFBCHECK(_layer->SetCooperativeLevel(_layer,DLSCL_EXCLUSIVE)); - DFBCHECK(_layer->GetSurface(_layer,&ecore_window->surface)); - DFBCHECK(_dfb->CreateInputEventBuffer(_dfb, DICAPS_ALL, DFB_FALSE, &_input_event)); - DFBCHECK(_input_event->CreateFileDescriptor(_input_event,&_input_event_fd)); - /* the event of axismove sends one axis at a time, so we must store both */ - DFBCHECK(_layer->GetCursorPosition(_layer,&_cursor_x,&_cursor_y)); - - _input_event_fd_handler_handle = ecore_main_fd_handler_add(_input_event_fd,ECORE_FD_READ,_ecore_directfb_input_event_fd_handler, NULL,NULL,NULL); - _ecore_directfb_fullscreen_window_id = ecore_window->id; - } - else - { - ecore_main_fd_handler_del(_input_event_fd_handler_handle); - DFBCHECK(_input_event->Release(_input_event)); - DFBCHECK(_layer->SetCooperativeLevel(_layer,DLSCL_SHARED)); - DFBCHECK(ecore_window->window->GetSurface(ecore_window->window, &ecore_window->surface)); - _ecore_directfb_fullscreen_window_id = 0; - } -} - -EAPI void -ecore_directfb_window_size_get(Ecore_DirectFB_Window *ecore_window, int *w, int *h) -{ - DFBCHECK(ecore_window->surface->GetSize(ecore_window->surface,w,h)); - return; -} - -EAPI int -ecore_directfb_init(const char *name EINA_UNUSED) -{ - int i = 0; - - if (++_ecore_directfb_init_count != 1) - return _ecore_directfb_init_count; - - _ecore_directfb_log_dom = eina_log_domain_register - ("ecore_directfb", ECORE_DIRECTFB_DEFAULT_LOG_COLOR); - if(_ecore_directfb_log_dom < 0) - { - EINA_LOG_ERR("Impossible to create a log domain for the Ecore directFB module."); - return _ecore_directfb_init_count--; - } - - DFBCHECK(DirectFBInit(NULL,NULL)); - DFBCHECK(DirectFBCreate(&_dfb)); - - DFBCHECK(_dfb->GetDisplayLayer(_dfb, DLID_PRIMARY, &_layer)); - DFBCHECK(_layer->SetCooperativeLevel(_layer, DLSCL_SHARED)); - - /* window events and fd */ - DFBCHECK(_dfb->CreateEventBuffer(_dfb, &_window_event)); - DFBCHECK(_window_event->CreateFileDescriptor(_window_event,&_window_event_fd)); - _window_event_fd_handler_handle = ecore_main_fd_handler_add(_window_event_fd,ECORE_FD_READ,_ecore_directfb_window_event_fd_handler, NULL,NULL,NULL); - - /* register ecore directfb events */ - ECORE_DIRECTFB_EVENT_POSITION = ecore_event_type_new(); - ECORE_DIRECTFB_EVENT_SIZE = ecore_event_type_new(); - ECORE_DIRECTFB_EVENT_CLOSE = ecore_event_type_new(); - ECORE_DIRECTFB_EVENT_DESTROYED = ecore_event_type_new(); - ECORE_DIRECTFB_EVENT_GOT_FOCUS = ecore_event_type_new(); - ECORE_DIRECTFB_EVENT_LOST_FOCUS = ecore_event_type_new(); - ECORE_DIRECTFB_EVENT_KEY_DOWN = ecore_event_type_new(); - ECORE_DIRECTFB_EVENT_KEY_UP = ecore_event_type_new(); - ECORE_DIRECTFB_EVENT_BUTTON_DOWN = ecore_event_type_new(); - ECORE_DIRECTFB_EVENT_BUTTON_UP = ecore_event_type_new(); - ECORE_DIRECTFB_EVENT_MOTION = ecore_event_type_new(); - ECORE_DIRECTFB_EVENT_ENTER = ecore_event_type_new(); - ECORE_DIRECTFB_EVENT_LEAVE = ecore_event_type_new(); - ECORE_DIRECTFB_EVENT_WHEEL = ecore_event_type_new(); - - /* create the hash table for the keynames */ - _ecore_directfb_key_symbols_hash = eina_hash_int32_new(free); - for(i = 0; i < _ecore_directfb_key_symbols_count; i++) - { - struct keymap *k; - k = malloc(sizeof(struct keymap)); - k->name = _ecore_directfb_key_symbols[i].name; - k->string = _ecore_directfb_key_symbols[i].string; - eina_hash_add(_ecore_directfb_key_symbols_hash, &_ecore_directfb_key_symbols[i].id, k); - } - /* create the hash for the windows(key = windowid, val = Ecore_DirectFB_Window struct) */ - return _ecore_directfb_init_count; -} - -EAPI int -ecore_directfb_shutdown(void) -{ - if (--_ecore_directfb_init_count != 0) - return _ecore_directfb_init_count; - - ecore_main_fd_handler_del(_window_event_fd_handler_handle); - eina_hash_free(_ecore_directfb_key_symbols_hash); - - if(_ecore_directfb_fullscreen_window_id) - { - DFBCHECK(_input_event->Release(_input_event)); - ecore_main_fd_handler_del(_input_event_fd_handler_handle); - } - - DFBCHECK(_window_event->Release(_window_event)); - DFBCHECK(_layer->Release(_layer)); - DFBCHECK(_dfb->Release(_dfb)); - eina_log_domain_unregister(_ecore_directfb_log_dom); - _ecore_directfb_log_dom = -1; - return _ecore_directfb_init_count; -} - diff --git a/src/lib/ecore_directfb/ecore_directfb_keys.h b/src/lib/ecore_directfb/ecore_directfb_keys.h deleted file mode 100644 index 19cca46e57..0000000000 --- a/src/lib/ecore_directfb/ecore_directfb_keys.h +++ /dev/null @@ -1,184 +0,0 @@ -typedef struct _Ecore_DirectFB_Key_Symbols Ecore_DirectFB_Key_Symbols; -struct _Ecore_DirectFB_Key_Symbols -{ - char *string; - char *name; - unsigned int id; -}; - -static const Ecore_DirectFB_Key_Symbols _ecore_directfb_key_symbols[] = { - {"\010", "BackSpace",DIKS_BACKSPACE}, - {"\011", "Tab", DIKS_TAB}, - {"\015", "Return", DIKS_RETURN}, - {"", "Cancel", DIKS_CANCEL}, - {"", "Escape", DIKS_ESCAPE}, - {" ", "space", DIKS_SPACE}, - {"!", "exclam", DIKS_EXCLAMATION_MARK}, - {"\"", "quotedbl", DIKS_QUOTATION}, - {"#", "numbersign", DIKS_NUMBER_SIGN}, - {"$", "dollar", DIKS_DOLLAR_SIGN}, - {"%", "percent", DIKS_PERCENT_SIGN}, - {"&", "ampersand", DIKS_AMPERSAND}, - {"'", "apostrophe", DIKS_APOSTROPHE}, - {"(", "parenleft", DIKS_PARENTHESIS_LEFT}, - {")", "parenright", DIKS_PARENTHESIS_RIGHT}, - {"*", "asterisk", DIKS_ASTERISK}, - {"+", "plus", DIKS_PLUS_SIGN}, - {",", "comma", DIKS_COMMA}, - {"-", "minus", DIKS_MINUS_SIGN}, - {".", "period", DIKS_PERIOD}, - {"/", "slash", DIKS_SLASH}, - {"0", "0", DIKS_0}, - {"1", "1", DIKS_1}, - {"2", "2", DIKS_2}, - {"3", "3", DIKS_3}, - {"4", "4", DIKS_4}, - {"5", "5", DIKS_5}, - {"6", "6", DIKS_6}, - {"7", "7", DIKS_7}, - {"8", "8", DIKS_8}, - {"9", "9", DIKS_9}, - {":", "colon", DIKS_COLON}, - {";", "semicolon", DIKS_SEMICOLON}, - {"<", "less", DIKS_LESS_THAN_SIGN}, - {"=", "equal", DIKS_EQUALS_SIGN}, - {">", "greater", DIKS_GREATER_THAN_SIGN}, - {"?", "question", DIKS_QUESTION_MARK}, - {"@", "at", DIKS_AT}, - {"A", "A", DIKS_CAPITAL_A }, - {"B", "B", DIKS_CAPITAL_B }, - {"C", "C", DIKS_CAPITAL_C }, - {"D", "D", DIKS_CAPITAL_D }, - {"E", "E", DIKS_CAPITAL_E }, - {"F", "F", DIKS_CAPITAL_F }, - {"G", "G", DIKS_CAPITAL_G }, - {"H", "H", DIKS_CAPITAL_H }, - {"I", "I", DIKS_CAPITAL_I }, - {"J", "J", DIKS_CAPITAL_J }, - {"K", "K", DIKS_CAPITAL_K }, - {"L", "L", DIKS_CAPITAL_L }, - {"M", "M", DIKS_CAPITAL_M }, - {"N", "N", DIKS_CAPITAL_N }, - {"O", "O", DIKS_CAPITAL_O }, - {"P", "P", DIKS_CAPITAL_P }, - {"Q", "Q", DIKS_CAPITAL_Q }, - {"R", "R", DIKS_CAPITAL_R }, - {"S", "S", DIKS_CAPITAL_S }, - {"T", "T", DIKS_CAPITAL_T }, - {"U", "U", DIKS_CAPITAL_U }, - {"V", "V", DIKS_CAPITAL_V }, - {"W", "W", DIKS_CAPITAL_W }, - {"X", "X", DIKS_CAPITAL_X }, - {"Y", "Y", DIKS_CAPITAL_Y }, - {"Z", "Z", DIKS_CAPITAL_Z }, - {"[", "bracketleft", DIKS_SQUARE_BRACKET_LEFT }, - {"\\", "backslash", DIKS_BACKSLASH }, - {"]", "bracketright", DIKS_SQUARE_BRACKET_RIGHT }, - {"^", "asciicircum", DIKS_CIRCUMFLEX_ACCENT }, - {"_", "underscore", DIKS_UNDERSCORE }, - {"`", "grave", DIKS_GRAVE_ACCENT}, - {"a", "a", DIKS_SMALL_A }, - {"b","b", DIKS_SMALL_B }, - {"c","c", DIKS_SMALL_C }, - {"d","d", DIKS_SMALL_D }, - {"e","e", DIKS_SMALL_E }, - {"f","f", DIKS_SMALL_F }, - {"g","g", DIKS_SMALL_G }, - {"h","h", DIKS_SMALL_H }, - {"i","i", DIKS_SMALL_I }, - {"j","j", DIKS_SMALL_J }, - {"k","k", DIKS_SMALL_K }, - {"l","l", DIKS_SMALL_L }, - {"m","m", DIKS_SMALL_M }, - {"n","n", DIKS_SMALL_N }, - {"o", "o", DIKS_SMALL_O }, - {"p", "p", DIKS_SMALL_P }, - {"q", "q", DIKS_SMALL_Q }, - {"r", "r", DIKS_SMALL_R }, - {"s", "s", DIKS_SMALL_S }, - {"t", "t", DIKS_SMALL_T }, - {"u", "u", DIKS_SMALL_U }, - {"v", "v", DIKS_SMALL_V }, - {"w", "w", DIKS_SMALL_W }, - {"x", "x", DIKS_SMALL_X }, - {"y", "y", DIKS_SMALL_Y }, - {"z", "z", DIKS_SMALL_Z }, - {"{", "braceleft",DIKS_CURLY_BRACKET_LEFT }, - {"|", "bar", DIKS_VERTICAL_BAR }, - {"}", "braceright", DIKS_CURLY_BRACKET_RIGHT }, - {"~", "asciitilde", DIKS_TILDE }, - {"\177", "Delete", DIKS_DELETE }, - {"", "Left", DIKS_CURSOR_LEFT }, - {"", "Right", DIKS_CURSOR_RIGHT}, - {"", "Up", DIKS_CURSOR_UP}, - {"", "Down", DIKS_CURSOR_DOWN}, - {"", "Insert", DIKS_INSERT}, - {"", "Home", DIKS_HOME}, - {"", "End", DIKS_END}, - {"", "Page_Up", DIKS_PAGE_UP}, - {"", "Page_Down", DIKS_PAGE_DOWN}, - {"", "Print", DIKS_PRINT}, - {"", "Pause", DIKS_PAUSE}, - /* ok */ - {"", "Select",DIKS_SELECT}, - /* goto */ - {"", "Clear", DIKS_CLEAR}, - /* power */ - /* power 2 */ - /* option */ - {"", "Menu",DIKS_MENU}, - {"", "Help",DIKS_HELP}, - /* info */ - /* time */ - /* vendor */ - /* archive */ - /* program */ - /* channel */ - /* favorites */ - /* hasta next */ - {"", "Next",DIKS_NEXT}, - {"", "Begin",DIKS_BEGIN}, - /* digits */ - /* teen */ - /* twen */ - {"", "Break", DIKS_BREAK}, - /* exit */ - /* setup */ - {"", "upleftcorner", DIKS_CURSOR_LEFT_UP }, - {"", "lowleftcorner", DIKS_CURSOR_LEFT_DOWN }, - {"", "uprightcorner", DIKS_CURSOR_UP_RIGHT }, - {"", "lowrightcorner",DIKS_CURSOR_DOWN_RIGHT }, - {"", "F1",DIKS_F1}, - {"", "F2",DIKS_F2}, - {"", "F3",DIKS_F3}, - {"", "F4",DIKS_F4}, - {"", "F5",DIKS_F5}, - {"", "F6",DIKS_F6}, - {"", "F7",DIKS_F7}, - {"", "F8",DIKS_F8}, - {"", "F9",DIKS_F9}, - {"", "F10",DIKS_F10}, - {"", "F11",DIKS_F11}, - {"", "F12",DIKS_F12}, - /* this are only mapped to one, not left right */ - {"", "Shift_L", DIKS_SHIFT}, - /*{"Shift_R",0xFFE2},*/ - {"", "Control_L", DIKS_CONTROL}, - /*{"Control_R",0xFFE4},*/ - {"", "Meta_L", DIKS_META}, - /* {"Meta_R",0xFFE8},*/ - {"", "Alt_L", DIKS_ALT}, - {"", "Alt_R", DIKS_ALTGR}, - {"", "Super_L", DIKS_SUPER}, - /*{"Super_R",0xFFEC},*/ - {"", "Hyper_L", DIKS_HYPER}, - /*{"Hyper_R",0xFFEE},*/ - - {"", "Caps_Lock", DIKS_CAPS_LOCK}, - {"", "Num_Lock", DIKS_NUM_LOCK}, - {"", "Scroll_Lock", DIKS_SCROLL_LOCK}, - /* not included the dead keys */ - /* not included the custom keys */ - {"", "VoidSymbol", DIKS_NULL} -}; -static int _ecore_directfb_key_symbols_count = sizeof(_ecore_directfb_key_symbols) / sizeof(Ecore_DirectFB_Key_Symbols); diff --git a/src/lib/ecore_directfb/ecore_directfb_private.h b/src/lib/ecore_directfb/ecore_directfb_private.h deleted file mode 100644 index ed34587ab5..0000000000 --- a/src/lib/ecore_directfb/ecore_directfb_private.h +++ /dev/null @@ -1,52 +0,0 @@ -#ifndef _ECORE_DIRECTFB_PRIVATE_H -#define _ECORE_DIRECTFB_PRIVATE_H -/* eina_log related things */ - -extern int _ecore_directfb_log_dom; - -#ifdef ECORE_DIRECTFB_DEFAULT_LOG_COLOR -#undef ECORE_DIRECTFB_DEFAULT_LOG_COLOR -#endif /* ifdef ECORE_DIRECTFB_DEFAULT_LOG_COLOR */ -#define ECORE_DIRECTFB_DEFAULT_LOG_COLOR EINA_COLOR_BLUE - -#ifdef ERR -# undef ERR -#endif /* ifdef ERR */ -#define ERR(...) EINA_LOG_DOM_ERR(_ecore_directfb_log_dom, __VA_ARGS__) - -#ifdef DBG -# undef DBG -#endif /* ifdef DBG */ -#define DBG(...) EINA_LOG_DOM_DBG(_ecore_directfb_log_dom, __VA_ARGS__) - -#ifdef INF -# undef INF -#endif /* ifdef INF */ -#define INF(...) EINA_LOG_DOM_INFO(_ecore_directfb_log_dom, __VA_ARGS__) - -#ifdef WRN -# undef WRN -#endif /* ifdef WRN */ -#define WRN(...) EINA_LOG_DOM_WARN(_ecore_directfb_log_dom, __VA_ARGS__) - -#ifdef CRIT -# undef CRIT -#endif /* ifdef CRIT */ -#define CRIT(...) EINA_LOG_DOM_CRIT(_ecore_directfb_log_dom, __VA_ARGS__) - -/* macro for a safe call to DirectFB functions */ -#define DFBCHECK(x ...)\ - {\ - _err = x;\ - if (_err != DFB_OK) {\ - CRIT("%s <%d>:\n\t", __FILE__, __LINE__ );\ - DirectFBErrorFatal( # x, _err );\ - }\ - } - -struct keymap -{ - char *name; - char *string; -}; -#endif /* ifndef _ECORE_DIRECTFB_PRIVATE_H */ diff --git a/src/lib/ecore_evas/Ecore_Evas.h b/src/lib/ecore_evas/Ecore_Evas.h index b701aeec8f..01f13b6fc6 100644 --- a/src/lib/ecore_evas/Ecore_Evas.h +++ b/src/lib/ecore_evas/Ecore_Evas.h @@ -93,7 +93,7 @@ extern "C" { #define HAVE_ECORE_EVAS_FB 1 #define HAVE_ECORE_EVAS_X11_GL 1 //#define HAVE_ECORE_EVAS_X11_16 1 -#define HAVE_ECORE_EVAS_DIRECTFB 1 +//#define HAVE_ECORE_EVAS_DIRECTFB 1 #define HAVE_ECORE_EVAS_WIN32 1 #define HAVE_ECORE_EVAS_COCOA 1 #define HAVE_ECORE_EVAS_SDL 1 @@ -935,8 +935,8 @@ EAPI void ecore_evas_software_x11_16_extra_event_window_add(Ecore_Eva EAPI Ecore_Evas *ecore_evas_fb_new(const char *disp_name, int rotation, int w, int h); -EAPI Ecore_Evas *ecore_evas_directfb_new(const char *disp_name, int windowed, int x, int y, int w, int h); -EAPI Ecore_DirectFB_Window *ecore_evas_directfb_window_get(const Ecore_Evas *ee); +EAPI Ecore_Evas *ecore_evas_directfb_new(const char *disp_name, int windowed, int x, int y, int w, int h) EINA_DEPRECATED; +EAPI Ecore_DirectFB_Window *ecore_evas_directfb_window_get(const Ecore_Evas *ee) EINA_DEPRECATED; EAPI Ecore_Evas *ecore_evas_wayland_shm_new(const char *disp_name, unsigned int parent, int x, int y, int w, int h, Eina_Bool frame); diff --git a/src/lib/ecore_evas/ecore_evas.c b/src/lib/ecore_evas/ecore_evas.c index 9a665fd581..49d90fb607 100644 --- a/src/lib/ecore_evas/ecore_evas.c +++ b/src/lib/ecore_evas/ecore_evas.c @@ -146,11 +146,7 @@ ecore_evas_engine_type_supported_get(Ecore_Evas_Engine_Type engine) return EINA_FALSE; #endif case ECORE_EVAS_ENGINE_DIRECTFB: -#ifdef BUILD_ECORE_EVAS_DIRECTFB - return EINA_TRUE; -#else return EINA_FALSE; -#endif case ECORE_EVAS_ENGINE_SOFTWARE_FB: #ifdef BUILD_ECORE_EVAS_FB return EINA_TRUE; @@ -304,9 +300,6 @@ ecore_evas_shutdown(void) #ifdef BUILD_ECORE_EVAS_SOFTWARE_BUFFER while (_ecore_evas_buffer_shutdown()); #endif -#ifdef BUILD_ECORE_EVAS_DIRECTFB - while (_ecore_evas_directfb_shutdown()); -#endif if (_ecore_evas_async_events_fd) ecore_main_fd_handler_del(_ecore_evas_async_events_fd); @@ -518,24 +511,6 @@ _ecore_evas_constructor_opengl_sdl(int x EINA_UNUSED, int y EINA_UNUSED, int w, } #endif -#ifdef BUILD_ECORE_EVAS_DIRECTFB -static Ecore_Evas * -_ecore_evas_constructor_directfb(int x, int y, int w, int h, const char *extra_options) -{ - Ecore_Evas *ee; - char *disp_name = NULL; - unsigned int windowed = 1; - - _ecore_evas_parse_extra_options_str(extra_options, "display=", &disp_name); - _ecore_evas_parse_extra_options_uint(extra_options, "windowed=", &windowed); - - ee = ecore_evas_directfb_new(disp_name, windowed, x, y, w, h); - free(disp_name); - - return ee; -} -#endif - #ifdef BUILD_ECORE_EVAS_FB static Ecore_Evas * _ecore_evas_constructor_fb(int x EINA_UNUSED, int y EINA_UNUSED, int w, int h, const char *extra_options) @@ -667,9 +642,6 @@ static const struct ecore_evas_engine _engines[] = { #ifdef BUILD_ECORE_EVAS_SOFTWARE_8_X11 {"software_8_x11", _ecore_evas_constructor_software_8_x11}, #endif -#ifdef BUILD_ECORE_EVAS_DIRECTFB - {"directfb", _ecore_evas_constructor_directfb}, -#endif #ifdef BUILD_ECORE_EVAS_FB {"fb", _ecore_evas_constructor_fb}, #endif diff --git a/src/lib/ecore_evas/ecore_evas_directfb.c b/src/lib/ecore_evas/ecore_evas_directfb.c index caeed21def..9557d12722 100644 --- a/src/lib/ecore_evas/ecore_evas_directfb.c +++ b/src/lib/ecore_evas/ecore_evas_directfb.c @@ -6,602 +6,22 @@ #include #include "ecore_private.h" -#ifdef BUILD_ECORE_EVAS_DIRECTFB -#include -#endif #include "ecore_evas_private.h" #include "Ecore_Evas.h" -#ifdef BUILD_ECORE_EVAS_DIRECTFB -static int _ecore_evas_init_count = 0; -static Ecore_Event_Handler *ecore_evas_event_handlers[13]; +/* Ecore_Evas DirectFB support was removed. However we keep the functions + * to not break ABI. + */ -static Eina_Hash *ecore_evases_hash = NULL; - -static int -_ecore_evas_directfb_render(Ecore_Evas *ee) -{ - Eina_List *updates, *ll; - Ecore_Evas *ee2; - int rend = 0; - - EINA_LIST_FOREACH(ee->sub_ecore_evas, ll, ee2) - { - if (ee2->func.fn_pre_render) ee2->func.fn_pre_render(ee2); - if (ee2->engine.func->fn_render) - rend |= ee2->engine.func->fn_render(ee2); - if (ee2->func.fn_post_render) ee2->func.fn_post_render(ee2); - } - - if (ee->func.fn_pre_render) ee->func.fn_pre_render(ee); - updates = evas_render_updates(ee->evas); - if (updates) - { - evas_render_updates_free(updates); - _ecore_evas_idle_timeout_update(ee); - } - if (ee->func.fn_post_render) ee->func.fn_post_render(ee); - - return updates ? 1 : rend; -} - -static char * -_ecore_evas_directfb_winid_str_get(Ecore_X_Window win) -{ - const char *vals = "qWeRtYuIoP5$&<~"; - static char id[9]; - unsigned int val; - val = (unsigned int)win; - id[0] = vals[(val >> 28) & 0xf]; - id[1] = vals[(val >> 24) & 0xf]; - id[2] = vals[(val >> 20) & 0xf]; - id[3] = vals[(val >> 16) & 0xf]; - id[4] = vals[(val >> 12) & 0xf]; - id[5] = vals[(val >> 8) & 0xf]; - id[6] = vals[(val >> 4) & 0xf]; - id[7] = vals[(val ) & 0xf]; - id[8] = 0; - return id; -} - -static Ecore_Evas * -_ecore_evas_directfb_match(DFBWindowID win) -{ - Ecore_Evas *ee; - - ee = eina_hash_find(ecore_evases_hash, _ecore_evas_directfb_winid_str_get(win)); - return ee; -} - -static Eina_Bool -_ecore_evas_directfb_event_key_down(void *data EINA_UNUSED, int type EINA_UNUSED, void *event) -{ - Ecore_Evas *ee; - Ecore_DirectFB_Event_Key_Down *e; - - e = event; - ee = _ecore_evas_directfb_match(e->win); - - if (!ee) return EINA_TRUE; /* pass on event */ - evas_event_feed_key_down(ee->evas, e->name, e->name, e->string, - e->key_compose, e->time, NULL); - return EINA_TRUE; -} - -static Eina_Bool -_ecore_evas_directfb_event_key_up(void *data EINA_UNUSED, int type EINA_UNUSED, void *event) -{ - Ecore_Evas *ee; - Ecore_DirectFB_Event_Key_Up *e; - - e = event; - ee = _ecore_evas_directfb_match(e->win); - - if (!ee) return EINA_TRUE; /* pass on event */ - evas_event_feed_key_up(ee->evas, e->name, e->name, e->string, - e->key_compose, e->time, NULL); - return EINA_TRUE; -} - -static Eina_Bool -_ecore_evas_directfb_event_motion(void *data EINA_UNUSED, int type EINA_UNUSED, void *event) -{ - Ecore_Evas *ee; - Ecore_DirectFB_Event_Motion *e; - - e = event; - ee = _ecore_evas_directfb_match(e->win); - - if (!ee) return EINA_TRUE; /* pass on event */ - _ecore_evas_mouse_move_process(ee, e->x, e->y, e->time); - return EINA_TRUE; -} - -static Eina_Bool -_ecore_evas_directfb_event_button_down(void *data EINA_UNUSED, int type EINA_UNUSED, void *event) -{ - Ecore_Evas *ee; - Ecore_DirectFB_Event_Button_Down *e; - - e = event; - ee = _ecore_evas_directfb_match(e->win); - - if (!ee) return EINA_TRUE; /* pass on event */ - // _ecore_evas_mouse_move_process(ee, e->x, e->y, e->time); - evas_event_feed_mouse_down(ee->evas, e->button, EVAS_BUTTON_NONE, e->time, NULL); - return EINA_TRUE; -} - -static Eina_Bool -_ecore_evas_directfb_event_button_up(void *data EINA_UNUSED, int type EINA_UNUSED, void *event) -{ - Ecore_Evas *ee; - Ecore_DirectFB_Event_Button_Up *e; - Evas_Button_Flags flags = EVAS_BUTTON_NONE; - - e = event; - ee = _ecore_evas_directfb_match(e->win); - - if (!ee) return EINA_TRUE; /* pass on event */ - //_ecore_evas_mouse_move_process(ee, e->x, e->y, e->time); - evas_event_feed_mouse_up(ee->evas, e->button, flags, e->time, NULL); - return EINA_TRUE; -} - -static Eina_Bool -_ecore_evas_directfb_event_enter(void *data EINA_UNUSED, int type EINA_UNUSED, void *event) -{ - Ecore_Evas *ee; - Ecore_DirectFB_Event_Enter *e; - - e = event; - ee = _ecore_evas_directfb_match(e->win); - - if (!ee) return EINA_TRUE; /* pass on event */ - evas_event_feed_mouse_in(ee->evas, e->time, NULL); - //_ecore_evas_mouse_move_process(ee, e->x, e->y, e->time); - return EINA_TRUE; -} - -static Eina_Bool -_ecore_evas_directfb_event_leave(void *data EINA_UNUSED, int type EINA_UNUSED, void *event) -{ - Ecore_Evas *ee; - Ecore_DirectFB_Event_Leave *e; - - e = event; - ee = _ecore_evas_directfb_match(e->win); - - if (!ee) return EINA_TRUE; /* pass on event */ - evas_event_feed_mouse_out(ee->evas, e->time, NULL); - //_ecore_evas_mouse_move_process(ee, e->x, e->y, e->time); - if (ee->func.fn_mouse_out) ee->func.fn_mouse_out(ee); - if (ee->prop.cursor.object) evas_object_hide(ee->prop.cursor.object); - return EINA_TRUE; -} - -static Eina_Bool -_ecore_evas_directfb_event_wheel(void *data EINA_UNUSED, int type EINA_UNUSED, void *event) -{ - Ecore_Evas *ee; - Ecore_DirectFB_Event_Wheel *e; - - e = event; - ee = _ecore_evas_directfb_match(e->win); - - if (!ee) return EINA_TRUE; /* pass on event */ - evas_event_feed_mouse_wheel(ee->evas, e->direction, e->z, e->time, NULL); - return EINA_TRUE; -} - -static Eina_Bool -_ecore_evas_directfb_event_got_focus(void *data EINA_UNUSED, int type EINA_UNUSED, void *event) -{ - Ecore_Evas *ee; - Ecore_DirectFB_Event_Got_Focus *e; - - e = event; - ee = _ecore_evas_directfb_match(e->win); - - if (!ee) return EINA_TRUE; /* pass on event */ - ee->prop.focused = 1; - return EINA_TRUE; -} - -static Eina_Bool -_ecore_evas_directfb_event_lost_focus(void *data EINA_UNUSED, int type EINA_UNUSED, void *event) -{ - Ecore_Evas *ee; - Ecore_DirectFB_Event_Lost_Focus *e; - - e = event; - ee = _ecore_evas_directfb_match(e->win); - - if (!ee) return EINA_TRUE; /* pass on event */ - ee->prop.focused = 0; - return EINA_TRUE; -} - -int -_ecore_evas_directfb_shutdown(void) -{ - _ecore_evas_init_count--; - if (_ecore_evas_init_count == 0) - { - int i; - - for (i = 0; i < 8; i++) - ecore_event_handler_del(ecore_evas_event_handlers[i]); - } - if (_ecore_evas_init_count < 0) _ecore_evas_init_count = 0; - return _ecore_evas_init_count; -} - - - - - -int -_ecore_evas_directfb_init(void) -{ - _ecore_evas_init_count++; - if (_ecore_evas_init_count > 1) return _ecore_evas_init_count; - - ecore_evas_event_handlers[0] = ecore_event_handler_add(ECORE_DIRECTFB_EVENT_KEY_DOWN, _ecore_evas_directfb_event_key_down, NULL); - ecore_evas_event_handlers[1] = ecore_event_handler_add(ECORE_DIRECTFB_EVENT_KEY_UP, _ecore_evas_directfb_event_key_up, NULL); - ecore_evas_event_handlers[2] = ecore_event_handler_add(ECORE_DIRECTFB_EVENT_BUTTON_DOWN, _ecore_evas_directfb_event_button_down, NULL); - ecore_evas_event_handlers[3] = ecore_event_handler_add(ECORE_DIRECTFB_EVENT_BUTTON_UP, _ecore_evas_directfb_event_button_up, NULL); - ecore_evas_event_handlers[4] = ecore_event_handler_add(ECORE_DIRECTFB_EVENT_MOTION, _ecore_evas_directfb_event_motion, NULL); - ecore_evas_event_handlers[5] = ecore_event_handler_add(ECORE_DIRECTFB_EVENT_ENTER, _ecore_evas_directfb_event_enter, NULL); - ecore_evas_event_handlers[6] = ecore_event_handler_add(ECORE_DIRECTFB_EVENT_LEAVE, _ecore_evas_directfb_event_leave, NULL); - ecore_evas_event_handlers[7] = ecore_event_handler_add(ECORE_DIRECTFB_EVENT_WHEEL, _ecore_evas_directfb_event_wheel, NULL); - ecore_evas_event_handlers[8] = ecore_event_handler_add(ECORE_DIRECTFB_EVENT_GOT_FOCUS, _ecore_evas_directfb_event_got_focus, NULL); - ecore_evas_event_handlers[9] = ecore_event_handler_add(ECORE_DIRECTFB_EVENT_LOST_FOCUS, _ecore_evas_directfb_event_lost_focus, NULL); - ecore_evas_event_handlers[10] = NULL; - ecore_evas_event_handlers[11] = NULL; - ecore_evas_event_handlers[12] = NULL; - - return _ecore_evas_init_count; -} - -/* engine functions */ -/********************/ - -static void -_ecore_evas_directfb_free(Ecore_Evas *ee) -{ - eina_hash_del(ecore_evases_hash, _ecore_evas_directfb_winid_str_get(ee->engine.directfb.window->id), ee); - ecore_directfb_window_free(ee->engine.directfb.window); - _ecore_evas_directfb_shutdown(); - ecore_directfb_shutdown(); -} - -static void -_ecore_evas_directfb_move(Ecore_Evas *ee, int x, int y) -{ - ecore_directfb_window_move(ee->engine.directfb.window, x, y); -} - -static void -_ecore_evas_directfb_resize(Ecore_Evas *ee, int w, int h) -{ - ee->req.w = w; - ee->req.h = h; - if ((w == ee->w) && (h == ee->h)) return; - ecore_directfb_window_resize(ee->engine.directfb.window, w, h); - ee->w = w; - ee->h = h; - if ((ee->rotation == 90) || (ee->rotation == 270)) - { - evas_output_size_set(ee->evas, ee->h, ee->w); - evas_output_viewport_set(ee->evas, 0, 0, ee->h, ee->w); - } - else - { - evas_output_size_set(ee->evas, ee->w, ee->h); - evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h); - } -} - -static void -_ecore_evas_directfb_focus_set(Ecore_Evas *ee, int on EINA_UNUSED) -{ - ecore_directfb_window_focus(ee->engine.directfb.window); -} - -static void -_ecore_evas_directfb_hide(Ecore_Evas *ee) -{ - ecore_directfb_window_hide(ee->engine.directfb.window); - ee->should_be_visible = 0; -} - -static void -_ecore_evas_directfb_show(Ecore_Evas *ee) -{ - ecore_directfb_window_show(ee->engine.directfb.window); - ee->should_be_visible = 1; -} - -static void -_ecore_evas_directfb_shaped_set(Ecore_Evas *ee, int shaped) -{ - if (((ee->shaped) && (shaped)) || ((!ee->shaped) && (!shaped))) - return; - ee->shaped = shaped; - if(ee->shaped) - ecore_directfb_window_shaped_set(ee->engine.directfb.window, 1); - else - ecore_directfb_window_shaped_set(ee->engine.directfb.window, 0); - -} - -static void -_ecore_evas_object_cursor_del(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) -{ - Ecore_Evas *ee; - - ee = data; - if (ee) - ee->prop.cursor.object = NULL; -} - -static void -_ecore_evas_directfb_object_cursor_set(Ecore_Evas *ee, Evas_Object *obj, int layer, int hot_x, int hot_y) -{ - int x, y; - - if (ee->prop.cursor.object) evas_object_del(ee->prop.cursor.object); - - if (!obj) - { - ee->prop.cursor.object = NULL; - ee->prop.cursor.layer = 0; - ee->prop.cursor.hot.x = 0; - ee->prop.cursor.hot.y = 0; - ecore_directfb_window_cursor_show(ee->engine.directfb.window, 1); - return; - - } - - ee->prop.cursor.object = obj; - ee->prop.cursor.layer = layer; - ee->prop.cursor.hot.x = hot_x; - ee->prop.cursor.hot.y = hot_y; - - ecore_directfb_window_cursor_show(ee->engine.directfb.window, 0); - - evas_pointer_output_xy_get(ee->evas, &x, &y); - evas_object_layer_set(ee->prop.cursor.object, ee->prop.cursor.layer); - evas_object_move(ee->prop.cursor.object,x - ee->prop.cursor.hot.x,y - ee->prop.cursor.hot.y); - evas_object_pass_events_set(ee->prop.cursor.object, 1); - if (evas_pointer_inside_get(ee->evas)) - evas_object_show(ee->prop.cursor.object); - - evas_object_event_callback_add(obj, EVAS_CALLBACK_DEL, _ecore_evas_object_cursor_del, ee); -} - -static void -_ecore_evas_directfb_fullscreen_set(Ecore_Evas *ee, int on) -{ - Evas_Engine_Info_DirectFB *einfo; - int w; - int h; - int resized = 0; - - if (((ee->prop.fullscreen) && (on)) || ((!ee->prop.fullscreen) && (!on))) - return; - - if (on) - ecore_directfb_window_fullscreen_set(ee->engine.directfb.window, 1); - else - ecore_directfb_window_fullscreen_set(ee->engine.directfb.window, 0); - /* set the new size of the evas */ - ecore_directfb_window_size_get(ee->engine.directfb.window, &w, &h); - if( (ee->w != w) || (ee->h != h)) - { - resized = 1; - ee->w = w; - ee->h = h; - ee->req.w = ee->w; - ee->req.h = ee->h; - if ((ee->rotation == 90) || (ee->rotation == 270)) - { - evas_output_size_set(ee->evas, ee->h, ee->w); - evas_output_viewport_set(ee->evas, 0, 0, ee->h, ee->w); - } - else - { - evas_output_size_set(ee->evas, ee->w, ee->h); - evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h); - } - } - einfo = (Evas_Engine_Info_DirectFB *)evas_engine_info_get(ee->evas); - if (einfo) - { - einfo->info.surface = ee->engine.directfb.window->surface; - if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) - { - ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); - } - } - ee->prop.fullscreen = on; - if (resized) - { - if(ee->func.fn_resize) ee->func.fn_resize(ee); - } -} - -static void * -_ecore_evas_directfb_window_get(const Ecore_Evas *ee) -{ - return ee->engine.directfb.window; -} -#endif - -#ifdef BUILD_ECORE_EVAS_DIRECTFB -static Ecore_Evas_Engine_Func _ecore_directfb_engine_func = -{ - _ecore_evas_directfb_free, /* free an ecore_evas */ - NULL, /* cb resize */ - NULL, /* cb move */ - NULL, /* cb show */ - NULL, /* cb hide */ - NULL, /* cb delete request */ - NULL, /* cb destroy */ - NULL, /* cb focus in */ - NULL, /* cb focus out */ - NULL, /* cb sticky */ - NULL, /* cb unsticky */ - NULL, /* cb mouse in */ - NULL, /* cb mouse out */ - NULL, /* cb pre render */ - NULL, /* cb post render */ - _ecore_evas_directfb_move, /* move */ - NULL, /* managed move */ - _ecore_evas_directfb_resize, /* resize */ - NULL, /* move resize */ - NULL,//_ecore_evas_directfb_rotation_set,/* rotation */ - _ecore_evas_directfb_shaped_set, /* shaped */ - _ecore_evas_directfb_show, /* show */ - _ecore_evas_directfb_hide, /* hide */ - NULL, /* raise */ - NULL, /* lower */ - NULL, /* activate */ - NULL, /* title set */ - NULL, /* name class set */ - NULL, /* size min */ - NULL, /* size max */ - NULL, /* size base */ - NULL, /* size step */ - _ecore_evas_directfb_object_cursor_set, /* set cursor to an evas object */ - NULL, /* layer set */ - _ecore_evas_directfb_focus_set, /* focus */ - NULL, /* iconified */ - NULL, /* borderless */ - NULL, /* override */ - NULL, /* maximized */ - _ecore_evas_directfb_fullscreen_set,/* fullscreen */ - NULL, /* avoid damage */ - NULL, /* withdrawn */ - NULL, /* sticky */ - NULL, /* ignore events */ - NULL, /* alpha */ - NULL, //transparent - NULL, // profiles_set - NULL, // profile_set - - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - - NULL, // render - NULL, // screen_geometry_get - NULL // screen_dpi_get -}; -#endif - -/* api */ -/*******/ - -#ifdef BUILD_ECORE_EVAS_DIRECTFB -EAPI Ecore_Evas * -ecore_evas_directfb_new(const char *disp_name, int windowed, int x, int y, int w, int h) -{ - Evas_Engine_Info_DirectFB *einfo; - Ecore_Evas *ee; - Ecore_DirectFB_Window *window; - int rmethod; - - rmethod = evas_render_method_lookup("directfb"); - if (!rmethod) return NULL; - if (!ecore_directfb_init(disp_name)) return NULL; - ee = calloc(1, sizeof(Ecore_Evas)); - if (!ee) return NULL; - - ECORE_MAGIC_SET(ee, ECORE_MAGIC_EVAS); - _ecore_evas_directfb_init(); - ee->engine.func = (Ecore_Evas_Engine_Func *)&_ecore_directfb_engine_func; - - ee->driver = "directfb"; - if (disp_name) ee->name = strdup(disp_name); - - if (w < 1) w = 1; - if (h < 1) h = 1; - - ee->rotation = 0; - ee->visible = 1; - ee->x = x; - ee->y = y; - ee->w = w; - ee->h = h; - ee->req.x = ee->x; - ee->req.y = ee->y; - ee->req.w = ee->w; - ee->req.h = ee->h; - ee->prop.layer = 1; - ee->prop.fullscreen = 0; - - /* init evas here */ - ee->evas = evas_new(); - evas_data_attach_set(ee->evas, ee); - evas_output_method_set(ee->evas, rmethod); - evas_output_size_set(ee->evas, w, h); - evas_output_viewport_set(ee->evas, 0, 0, w, h); - einfo = (Evas_Engine_Info_DirectFB *)evas_engine_info_get(ee->evas); - - window = ecore_directfb_window_new(x,y,w,h); - ee->engine.directfb.window = window; - if (einfo) - { - einfo->info.dfb = ecore_directfb_interface_get(); - einfo->info.surface = window->surface; - if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) - { - ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); - ecore_evas_free(ee); - return NULL; - } - } - else - { - ERR("evas_engine_info_set() init engine '%s' failed.", ee->driver); - ecore_evas_free(ee); - return NULL; - } - - ee->engine.func->fn_render = _ecore_evas_directfb_render; - _ecore_evas_register(ee); - - if (!ecore_evases_hash) - ecore_evases_hash = eina_hash_string_superfast_new(NULL); - eina_hash_add(ecore_evases_hash, _ecore_evas_directfb_winid_str_get(ee->engine.directfb.window->id), ee); - - return ee; -} -#else EAPI Ecore_Evas * ecore_evas_directfb_new(const char *disp_name EINA_UNUSED, int windowed EINA_UNUSED, int x EINA_UNUSED, int y EINA_UNUSED, int w EINA_UNUSED, int h EINA_UNUSED) { return NULL; } -#endif -#ifdef BUILD_ECORE_EVAS_DIRECTFB -EAPI Ecore_DirectFB_Window * -ecore_evas_directfb_window_get(const Ecore_Evas *ee) -{ - if (!(!strcmp(ee->driver, "directfb"))) return 0; - return (Ecore_DirectFB_Window *) _ecore_evas_directfb_window_get(ee); -} -#else EAPI Ecore_DirectFB_Window * ecore_evas_directfb_window_get(const Ecore_Evas *ee EINA_UNUSED) { return NULL; } -#endif diff --git a/src/lib/ecore_evas/ecore_evas_private.h b/src/lib/ecore_evas/ecore_evas_private.h index 2d9cb016b8..d6cff8f023 100644 --- a/src/lib/ecore_evas/ecore_evas_private.h +++ b/src/lib/ecore_evas/ecore_evas_private.h @@ -33,11 +33,6 @@ # include #endif -#ifdef BUILD_ECORE_EVAS_DIRECTFB -# include -# include "Ecore_DirectFB.h" -#endif - #if defined(BUILD_ECORE_EVAS_SOFTWARE_BUFFER) || defined(BUILD_ECORE_EVAS_EWS) # include #endif @@ -242,11 +237,6 @@ struct _Ecore_Evas_Engine void *data; } buffer; #endif -#ifdef BUILD_ECORE_EVAS_DIRECTFB - struct { - Ecore_DirectFB_Window *window; - } directfb; -#endif #ifdef BUILD_ECORE_EVAS_WIN32 struct { Ecore_Win32_Window *parent; @@ -404,9 +394,6 @@ int _ecore_evas_fb_shutdown(void); int _ecore_evas_buffer_shutdown(void); int _ecore_evas_buffer_render(Ecore_Evas *ee); #endif -#ifdef BUILD_ECORE_EVAS_DIRECTFB -int _ecore_evas_directfb_shutdown(void); -#endif #ifdef BUILD_ECORE_EVAS_WIN32 int _ecore_evas_win32_shutdown(void); #endif diff --git a/src/lib/evas/Evas.h b/src/lib/evas/Evas.h index acd28866e4..8c30a1dde6 100644 --- a/src/lib/evas/Evas.h +++ b/src/lib/evas/Evas.h @@ -8639,8 +8639,7 @@ EAPI void evas_object_image_data_set(Evas_Object *obj, * Each time you call this function on an image object, its data * buffer will have an internal reference counter * incremented. Decrement it back by using - * evas_object_image_data_set(). This is specially important for the - * directfb Evas engine. + * evas_object_image_data_set(). * * This is best suited for when you want to modify an existing image, * without changing its dimensions. diff --git a/src/lib/evas/file/evas_module.c b/src/lib/evas/file/evas_module.c index 8c693ad2d9..cae88d8818 100644 --- a/src/lib/evas/file/evas_module.c +++ b/src/lib/evas/file/evas_module.c @@ -93,7 +93,6 @@ evas_module_paths_init(void) { evas_##Tn##_##Name##_init, evas_##Tn##_##Name##_shutdown } EVAS_EINA_STATIC_MODULE_DEFINE(engine, buffer); -EVAS_EINA_STATIC_MODULE_DEFINE(engine, directfb); EVAS_EINA_STATIC_MODULE_DEFINE(engine, fb); EVAS_EINA_STATIC_MODULE_DEFINE(engine, gl_x11); EVAS_EINA_STATIC_MODULE_DEFINE(engine, gl_sdl); @@ -131,9 +130,6 @@ static const struct { #ifdef EVAS_STATIC_BUILD_BUFFER EVAS_EINA_STATIC_MODULE_USE(engine, buffer), #endif -#ifdef EVAS_STATIC_BUILD_DIRECTFB - EVAS_EINA_STATIC_MODULE_USE(engine, directfb), -#endif #ifdef EVAS_STATIC_BUILD_FB EVAS_EINA_STATIC_MODULE_USE(engine, fb), #endif diff --git a/src/modules/evas/engines/directfb/Evas_Engine_DirectFB.h b/src/modules/evas/engines/directfb/Evas_Engine_DirectFB.h deleted file mode 100644 index 53352b77ca..0000000000 --- a/src/modules/evas/engines/directfb/Evas_Engine_DirectFB.h +++ /dev/null @@ -1,25 +0,0 @@ -#ifndef _EVAS_ENGINE_DIRECTFB_H -#define _EVAS_ENGINE_DIRECTFB_H - -#include -#include - -typedef struct _Evas_Engine_Info_DirectFB Evas_Engine_Info_DirectFB; - -struct _Evas_Engine_Info_DirectFB -{ - /* PRIVATE - don't mess with this baby or evas will poke its tongue out */ - /* at you and make nasty noises */ - Evas_Engine_Info magic; - - struct Evas_Engine_DirectFB_Spec { - IDirectFB *dfb; - IDirectFBSurface *surface; - } info; - - /* non-blocking or blocking mode */ - Evas_Engine_Render_Mode render_mode; -}; -#endif - - diff --git a/src/modules/evas/engines/directfb/evas_engine.c b/src/modules/evas/engines/directfb/evas_engine.c deleted file mode 100644 index 3dc599f4e2..0000000000 --- a/src/modules/evas/engines/directfb/evas_engine.c +++ /dev/null @@ -1,1755 +0,0 @@ -#include -#include -#include -#include -#include -#include "evas_engine.h" -#include "evas_common.h" /* Also includes international specific stuff */ - -/* Uses Evas own image_draw primitive, for comparison purposes only. */ -//#define DFB_USE_EVAS_IMAGE_DRAW 1 -//#define DFB_USE_EVAS_RECT_DRAW 1 -//#define DFB_USE_EVAS_POLYGON_DRAW 1 -//#define DFB_UPDATE_INDIVIDUAL_RECTS 1 -#define DFB_FLIP_FLAGS DSFLIP_NONE -//#define DFB_FLIP_FLAGS (DSFLIP_ONSYNC | DSFLIP_WAIT) - -/* Turn on debug */ -//#define DFB_DEBUG_IMAGE 1 -//#define DFB_DEBUG_FLAGS 1 -//#define DFB_DEBUG_ACCELERATION 1 -int _evas_engine_directfb_log_dom = -1; - -static Evas_Func func = {}; -static Evas_Func parent_func = {}; -static IDirectFB *dfb = NULL; /* XXX HACK to work around evas image cache - * lack of extra data. Fix it instead later. - */ - - -/*********************************************************************** - * Evas helpers - **********************************************************************/ -static void -_context_get_color(RGBA_Draw_Context *dc, int *r, int *g, int *b, int *a) -{ - DATA32 col; - - if (dc->mul.use) - col = dc->mul.col; - else - col = dc->col.col; - - *r = R_VAL(&col); - *g = G_VAL(&col); - *b = B_VAL(&col); - *a = A_VAL(&col); -} - - -/*********************************************************************** - * DirectFB helpers - **********************************************************************/ -static void -_dfb_surface_clear(IDirectFBSurface *surface, int x, int y, int w, int h) -{ - DFBRegion cr; - DFBResult r; - - cr.x1 = x; - cr.y1 = y; - cr.x2 = x + w - 1; - cr.y2 = y + h - 1; - r = surface->SetClip(surface, &cr); - if (r != DFB_OK) - goto error; - - r = surface->Clear(surface, 0, 0, 0, 0); - if (r != DFB_OK) - goto error; - - return; - - error: - ERR("DirectFB: could not clear surface: %s", - DirectFBErrorString(r)); -} - -static void -_image_clear(DirectFB_Engine_Image_Entry *image, int x, int y, int w, int h) -{ - if (image->cache_entry.src->flags.alpha) - _dfb_surface_clear(image->surface, x, y, w, h); -} - -static void -_image_autoset_alpha(DirectFB_Engine_Image_Entry *image) -{ - DFBResult r; - DFBSurfacePixelFormat fmt; - IDirectFBSurface *surface; - RGBA_Image *im; - int has_alpha; - - surface = image->surface; - r = surface->GetPixelFormat(surface, &fmt); - if (r != DFB_OK) - { - ERR("Could not get pixel format: %s", - DirectFBErrorString(r)); - return; - } - - /* XXX: check this in more depth in future, if other PF are supported */ - image->cache_entry.src->flags.alpha = (fmt == DSPF_ARGB); -} - -static void -_dfb_surface_update(IDirectFBSurface *surface, int x, int y, int w, int h) -{ - DFBRegion cr; - DFBResult r; - - cr.x1 = x; - cr.y1 = y; - cr.x2 = x + w - 1; - cr.y2 = y + h - 1; - r = surface->Flip(surface, &cr, DSFLIP_NONE); - if (r != DFB_OK) - WRN("Could not update surface: %s", - DirectFBErrorString(r)); -} - -static IDirectFBSurface * -_dfb_surface_from_data(IDirectFB *dfb, int w, int h, void *data) -{ - IDirectFBSurface *s; - DFBSurfaceDescription desc; - DFBResult r; - - desc.flags = (DSDESC_CAPS | DSDESC_WIDTH | DSDESC_HEIGHT | - DSDESC_PIXELFORMAT | DSDESC_PREALLOCATED); - desc.caps = DSCAPS_PREMULTIPLIED; - desc.width = w; - desc.height = h; - desc.preallocated[0].data = data; - desc.preallocated[0].pitch = w * 4; - desc.preallocated[1].data = NULL; - desc.preallocated[1].pitch = 0; - desc.pixelformat = DSPF_ARGB; - r = dfb->CreateSurface(dfb, &desc, &s); - if (r != DFB_OK) - { - ERR("Cannot create DirectFB surface: %s", - DirectFBErrorString(r)); - return NULL; - } - - s->SetPorterDuff(s, DSPD_SRC_OVER); - - return s; -} - -static void -_dfb_surface_free(IDirectFBSurface *surface) -{ - if (surface) - surface->Release(surface); -} - -static void -_dfb_blit_accel_caps_print(IDirectFBSurface *dst, IDirectFBSurface *src) -{ -#ifdef DFB_DEBUG_ACCELERATION - DFBAccelerationMask mask; - DFBResult r; - - r = dst->GetAccelerationMask(dst, src, &mask); - if (r != DFB_OK) - { - ERR("Could not retrieve acceleration mask: %s", - DirectFBErrorString(r)); - return; - } - - DBG("Acceleration: "); - -#define O(m) if (mask & m) DBG(#m " ") - O(DFXL_FILLRECTANGLE); - O(DFXL_DRAWRECTANGLE); - O(DFXL_DRAWLINE); - O(DFXL_FILLTRIANGLE); - O(DFXL_BLIT); - O(DFXL_STRETCHBLIT); - O(DFXL_TEXTRIANGLES); - O(DFXL_DRAWSTRING); -#undef O - - if (mask == DFXL_NONE) DBG(""); -#endif /* DFB_DEBUG_ACCELERATION */ -} - -#ifdef DFB_DEBUG_FLAGS -static const char * -_dfb_blit_flags_str(DFBSurfaceBlittingFlags flags) -{ - static char buf[1024]; - - buf[0] = 0; - -#define T(m, n) \ - do { \ - if (flags & m) { \ - if (buf[0] != 0) strcat(buf, " | "); \ - strcat(buf, n); \ - } \ - } while (0) - - T(DSBLIT_BLEND_ALPHACHANNEL, "BLEND_ALPHACHANNEL"); - T(DSBLIT_BLEND_COLORALPHA, "BLEND_COLORALPHA"); - T(DSBLIT_COLORIZE, "COLORIZE"); - T(DSBLIT_SRC_COLORKEY, "SRC_COLORKEY"); - T(DSBLIT_DST_COLORKEY, "DST_COLORKEY"); - T(DSBLIT_SRC_PREMULTIPLY, "SRC_PREMULTIPLY"); - T(DSBLIT_DST_PREMULTIPLY, "DST_PREMULTIPLY"); - T(DSBLIT_DEMULTIPLY, "DEMULTIPLY"); - T(DSBLIT_DEINTERLACE, "DSBLIT_DEINTERLACE"); - T(DSBLIT_SRC_PREMULTCOLOR, "SRC_PREMULTCOLOR"); - T(DSBLIT_XOR, "XOR"); - T(DSBLIT_INDEX_TRANSLATION, "INDEX_TRANSLATION"); -#undef T - - if (buf[0] == 0) - strcpy(buf, "NOFX"); - - return buf; -} - -static const char * -_dfb_draw_flags_str(DFBSurfaceDrawingFlags flags) -{ - static char buf[1024]; - - buf[0] = 0; - -#define T(m, n) \ - do { \ - if (flags & m) { \ - if (buf[0] != 0) strcat(buf, " | "); \ - strcat(buf, n); \ - } \ - } while (0) - T(DSDRAW_BLEND, "BLEND"); - T(DSDRAW_DST_COLORKEY, "DST_COLORKEY"); - T(DSDRAW_SRC_PREMULTIPLY, "SRC_PREMULTIPLY"); - T(DSDRAW_DST_PREMULTIPLY, "DST_PREMULTIPLY"); - T(DSDRAW_DEMULTIPLY, "DEMULTIPLY"); - T(DSDRAW_XOR, "DSDRAW_XOR"); -#undef T - if (buf[0] == 0) - strcpy(buf, "NOFX"); - - return buf; -} - -static const char * -_dfb_blend_func_str(DFBSurfaceBlendFunction func) -{ - static char *names[] = { - "ZERO", - "ONE", - "SRCCOLOR", - "INVSRCCOLOR", - "SRCALPHA", - "INVSRCALPHA", - "DESTALPHA", - "INVDESTALPHA", - "DESTCOLOR", - "INVDESTCOLOR", - "SRCALPHASAT" - }; - func--; - if ((func >= 0) && (func <= sizeof(names)/sizeof(*names))) - return names[func]; - else - return NULL; -} -#endif /* DFB_DEBUG_FLAGS */ - -int -_dfb_surface_set_color_from_context(IDirectFBSurface *surface, RGBA_Draw_Context *dc) -{ - DFBSurfaceDrawingFlags flags; - int r, g, b, a; - DFBResult res; - - _context_get_color(dc, &r, &g, &b, &a); - if (a == 0) - return 0; - - r = 0xff * r / a; - g = 0xff * g / a; - b = 0xff * b / a; - - res = surface->SetColor(surface, r, g, b, a); - if (res != DFB_OK) - goto error; - - flags = (a != 255) ? DSDRAW_BLEND : DSDRAW_NOFX; - res = surface->SetDrawingFlags(surface, flags); - if (res != DFB_OK) - goto error; - -#ifdef DFB_DEBUG_FLAGS - DBG("Color=%d %d %d %d, flags=%s", - r, g, b, a, _dfb_draw_flags_str(flags)); -#endif /* DFB_DEBUG_FLAGS */ - - return 1; - - error: - ERR("Could not set color from context: %s", - DirectFBErrorString(res)); - return 0; -} - -static int -_dfb_surface_set_blit_params(DirectFB_Engine_Image_Entry *d, DirectFB_Engine_Image_Entry *s, RGBA_Draw_Context *dc) -{ - IDirectFBSurface *surface; - DFBSurfaceBlittingFlags blit_flags = DSBLIT_NOFX; - DFBResult res; - int r, g, b, a; - - _context_get_color(dc, &r, &g, &b, &a); - if (a == 0) - return 0; - - if (a != 255) - blit_flags = DSBLIT_BLEND_COLORALPHA | DSBLIT_SRC_PREMULTCOLOR; - - if ((r != a) || (g != a) || (b != a)) - { - blit_flags |= DSBLIT_COLORIZE; - - r = 0xff * r / a; - g = 0xff * g / a; - b = 0xff * b / a; - } - - if (s->cache_entry.src->flags.alpha) - blit_flags |= DSBLIT_BLEND_ALPHACHANNEL; - - surface = d->surface; - - if (blit_flags & - (DSBLIT_BLEND_COLORALPHA | DSBLIT_SRC_PREMULTCOLOR | DSBLIT_COLORIZE)) - { - res = surface->SetColor(surface, r, g, b, a); - if (res != DFB_OK) - goto error; - } - - res = surface->SetBlittingFlags(surface, blit_flags); - if (res != DFB_OK) - goto error; - -#ifdef DFB_DEBUG_FLAGS - DBG("sfunc=%s, dfunc=%s, color=%d %d %d %d, blit=%s, draw=%s", - _dfb_blend_func_str(src_func), _dfb_blend_func_str(dst_func), - r, g, b, a, - _dfb_blit_flags_str(blit_flags), _dfb_draw_flags_str(draw_flags)); -#endif /* DFB_DEBUG_FLAGS */ - - return 1; - - error: - ERR("Could not set blit params: %s", - DirectFBErrorString(res)); - return 0; -} - -static int -_dfb_lock_and_sync_image(IDirectFBSurface *surface, RGBA_Image *image, DFBSurfaceLockFlags flags) -{ - DFBResult r; - int pitch, sw, sh; - void *pixels; - - r = surface->GetSize(surface, &sw, &sh); - if (r != DFB_OK) - return 0; - - r = surface->Lock(surface, flags, &pixels, &pitch); - if (r != DFB_OK) - return 0; - - if (pitch != (sw * 4)) - { - /* XXX TODO: support other pixel formats. */ - ERR("IDirectFBSurface pitch(%d) is not supported: " - "should be %d.", - pitch, sw * 4); - surface->Unlock(surface); - return 0; - } - - image->cache_entry.w = sw; - image->cache_entry.h = sh; - image->image.data = pixels; - return 1; -} - -typedef void (*_cb_for_each_cutout_t)(IDirectFBSurface *surface, RGBA_Draw_Context *dc, const DFBRegion *region, void *data); -static void -_dfb_surface_for_each_cutout(IDirectFBSurface *surface, RGBA_Draw_Context *dc, _cb_for_each_cutout_t cb, void *data) -{ - static Cutout_Rects *rects = NULL; - int i; - - rects = evas_common_draw_context_apply_cutouts(dc, rects); - if (!rects) - { - DFBRegion cr; - cr.x1 = 0; - cr.y1 = 0; - surface->GetSize(surface, &cr.x2, &cr.y2); - cr.x2 -= 1; - cr.y2 -= 1; - surface->SetClip(surface, NULL); - cb(surface, dc, &cr, data); - return; - } - - for (i = 0; i < rects->active; ++i) - { - Cutout_Rect *r; - DFBRegion cr; - - r = rects->rects + i; - - cr.x1 = r->x; - cr.y1 = r->y; - cr.x2 = r->x + r->w - 1; - cr.y2 = r->y + r->h - 1; - surface->SetClip(surface, &cr); - cb(surface, dc, &cr, data); - } -} - -static void -_dfb_rect_set(DFBRectangle *r, int x, int y, int w, int h) -{ - r->x = x; - r->y = y; - r->w = w; - r->h = h; -} - - -/*********************************************************************** - * Image Cache - **********************************************************************/ -static Engine_Image_Entry * -evas_cache_image_dfb_alloc(void) -{ - DirectFB_Engine_Image_Entry *deie; - - deie = calloc(1, sizeof (DirectFB_Engine_Image_Entry)); - - return (Engine_Image_Entry *)deie; -} - -static void -evas_cache_image_dfb_delete(Engine_Image_Entry *eie) -{ - free(eie); -} - -static int -evas_cache_image_dfb_constructor(Engine_Image_Entry *eie, void *data) -{ - DirectFB_Engine_Image_Entry *deie = (DirectFB_Engine_Image_Entry *)eie; - Render_Engine *re = data; - IDirectFBSurface *s; - RGBA_Image *im; - - im = (RGBA_Image *)eie->src; - if (!im) - return EVAS_LOAD_ERROR_NONE; // XXX TODO: confirm? - - evas_cache_image_load_data(&im->cache_entry); - if (!im->image.data) - return EVAS_LOAD_ERROR_NONE; // XXX TODO: confirm? - - s = _dfb_surface_from_data(re->spec->dfb, eie->w, eie->h, im->image.data); - if (!s) - return EVAS_LOAD_ERROR_GENERIC; - - deie->surface = s; - deie->flags.engine_surface = 0; - - return EVAS_LOAD_ERROR_NONE; -} - -static void -evas_cache_image_dfb_destructor(Engine_Image_Entry *eie) -{ - DirectFB_Engine_Image_Entry *deie = (DirectFB_Engine_Image_Entry *)eie; - - if (!deie->flags.engine_surface) - _dfb_surface_free(deie->surface); - deie->surface = NULL; -} - -/* note: dst have some properties set, like desired size (w, h) */ -static int -_cache_image_copy(Engine_Image_Entry *dst, const Engine_Image_Entry *src) -{ - DirectFB_Engine_Image_Entry *dst_deie; - const DirectFB_Engine_Image_Entry *src_deie; - IDirectFBSurface *s; - RGBA_Image *im; - - dst_deie = (DirectFB_Engine_Image_Entry *)dst; - src_deie = (const DirectFB_Engine_Image_Entry *)src; - im = (RGBA_Image *)dst->src; - s = _dfb_surface_from_data(dfb, dst->w, dst->h, im->image.data); - if (!s) - return -1; - - dst_deie->surface = s; - dst_deie->flags.engine_surface = 0; - - return 0; -} - -static int -evas_cache_image_dfb_dirty(Engine_Image_Entry *dst, const Engine_Image_Entry *src) -{ - return _cache_image_copy(dst, src); -} - -static void -evas_cache_image_dfb_dirty_region(Engine_Image_Entry *eim, unsigned int x EINA_UNUSED, unsigned int y EINA_UNUSED, unsigned int w EINA_UNUSED, unsigned int h EINA_UNUSED) -{ - RGBA_Image *im; - - im = (RGBA_Image *)eim->src; - im->flags |= RGBA_IMAGE_IS_DIRTY; -} - -static int -evas_cache_image_dfb_update_data(Engine_Image_Entry *dst, void *engine_data) -{ - DirectFB_Engine_Image_Entry *deie = (DirectFB_Engine_Image_Entry *)dst; - IDirectFBSurface *s = engine_data; - Image_Entry *ie; - RGBA_Image *im; - - ie = dst->src; - im = (RGBA_Image *)ie; - - if (s) - { - deie->surface = s; - - /* XXX why size is required here? */ - s->GetSize(s, &dst->w, &dst->h); - - if (im) - { - im->image.data = NULL; /* IDirectFBSurface requires lock */ - im->image.no_free = 1; - ie->w = dst->w; - ie->h = dst->h; - _image_autoset_alpha(deie); - } - } - else - { - _dfb_surface_free(deie->surface); - s = _dfb_surface_from_data(dfb, dst->w, dst->h, im->image.data); - deie->surface = s; - } - - return 0; -} - -static int -evas_cache_image_dfb_size_set(Engine_Image_Entry *dst, const Engine_Image_Entry *src) -{ - return _cache_image_copy(dst, src); -} - -static void -evas_cache_image_dfb_load(Engine_Image_Entry *eim, const Image_Entry *ie) -{ - DirectFB_Engine_Image_Entry *deie = (DirectFB_Engine_Image_Entry *)eim; - IDirectFBSurface *s; - const RGBA_Image *im; - - if (deie->surface) - return; - - im = (const RGBA_Image *)ie; - s = _dfb_surface_from_data(dfb, eim->w, eim->h, im->image.data); - deie->surface = s; -} - -static int -evas_cache_image_dfb_mem_size_get(Engine_Image_Entry *eie) -{ - DirectFB_Engine_Image_Entry *deie = (DirectFB_Engine_Image_Entry *)eie; - DFBResult r; - int size, w, h; - - if (!deie->surface) - return 0; - - size = sizeof(*deie->surface); - - r = deie->surface->GetSize(deie->surface, &w, &h); - if (r != DFB_OK) - { - ERR("Could not get surface size: %s", - DirectFBErrorString(r)); - return size; - } - - size += w * h * 4; // XXX get correct surface size using pixelformat - - return size; -} - -#ifdef DFB_DEBUG_IMAGE -static void -evas_cache_image_dfb_debug(const char *context, Engine_Image_Entry* eie) -{ - DirectFB_Engine_Image_Entry *eim = (DirectFB_Engine_Image_Entry *)eie; - - DBG("*** %s image (%p) ***", context, eim); - if (eim) - { - DBG("W: %d, H: %d, R: %d, Key: %s, DFB Surface: %p", - eie->w, eie->h, eie->references, eie->cache_key, eim->surface); - - if (eie->src) - DBG("Pixels: %p", ((RGBA_Image*) eie->src)->image.data); - } - DBG("*** ***"); -} -#endif - -static const Evas_Cache_Engine_Image_Func _dfb_cache_engine_image_cb = { - NULL /* key */, - evas_cache_image_dfb_alloc /* alloc */, - evas_cache_image_dfb_delete /* dealloc */, - evas_cache_image_dfb_constructor /* constructor */, - evas_cache_image_dfb_destructor /* destructor */, - evas_cache_image_dfb_dirty_region /* dirty_region */, - evas_cache_image_dfb_dirty /* dirty */, - evas_cache_image_dfb_size_set /* size_set */, - evas_cache_image_dfb_update_data /* update_data */, - evas_cache_image_dfb_load /* load */, - evas_cache_image_dfb_mem_size_get /* mem_size_get */, -#ifdef DFB_DEBUG_IMAGE /* debug */ - evas_cache_image_dfb_debug -#else - NULL -#endif -}; - - -/*********************************************************************** - * Evas Engine - **********************************************************************/ -static void * -evas_engine_dfb_info(Evas* e EINA_UNUSED) -{ - Evas_Engine_Info_DirectFB *info; - info = calloc(1, sizeof(Evas_Engine_Info_DirectFB)); - if (!info) - return NULL; - info->magic.magic = rand(); - return info; -} - -static void -evas_engine_dfb_info_free(Evas *e EINA_UNUSED, void *in) -{ - Evas_Engine_Info_DirectFB *info = in; - free(info); -} - -static Eina_Bool -_is_dfb_data_ok(IDirectFB *idfb, IDirectFBSurface *surface, int w, int h) -{ - DFBResult r; - int sw, sh; - - if (!idfb) - { - ERR("missing IDirectFB"); - return EINA_FALSE; - } - dfb = idfb; - - if (!surface) - { - ERR("missing IDirectFBSurface"); - return EINA_FALSE; - } - - r = surface->GetSize(surface, &sw, &sh); - if (r != DFB_OK) - { - ERR("Could not get surface %p size: %s", - surface, DirectFBErrorString(r)); - return EINA_FALSE; - } - - if ((w > sw) || (h > sh)) - { - ERR("Requested size is larger than surface: %dx%d > %dx%d", - w, h, sw, sh); - return EINA_FALSE; - } - else if ((w <= 0) || (h <= 0)) - { - w = sw; - h = sh; - } - - return EINA_TRUE; -} - -static void -_evas_common_init(void) -{ - evas_common_cpu_init(); - evas_common_blend_init(); - evas_common_image_init(); - evas_common_convert_init(); - evas_common_scale_init(); - evas_common_rectangle_init(); - evas_common_polygon_init(); - evas_common_line_init(); - evas_common_font_init(); - evas_common_draw_init(); - evas_common_tilebuf_init(); -} - -static int -evas_engine_dfb_output_reconfigure(Render_Engine *re, int w, int h) -{ - if (re->screen_image) - evas_cache_engine_image_drop(&re->screen_image->cache_entry); - - if (re->tb) - evas_common_tilebuf_free(re->tb); - - re->tb = evas_common_tilebuf_new(w, h); - if (!re->tb) - { - ERR("Could not allocate tile buffer."); - goto failed_tilebuf; - } - evas_common_tilebuf_set_tile_size(re->tb, TILESIZE, TILESIZE); - - /* We create a "fake" RGBA_Image which points to the IDirectFB surface. - * Each access to that surface is wrapped in Lock / Unlock calls whenever - * the data is manipulated directly. - */ - re->screen_image = (DirectFB_Engine_Image_Entry *) - evas_cache_engine_image_engine(re->cache, re->spec->surface); - if (!re->screen_image) - { - ERR("RGBA_Image allocation from DFB failed"); - goto failed_image; - } - re->screen_image->flags.engine_surface = 1; - - _image_autoset_alpha(re->screen_image); - _image_clear(re->screen_image, 0, 0, w, h); - - return 1; - - failed_image: - evas_common_tilebuf_free(re->tb); - re->tb = NULL; - failed_tilebuf: - re->screen_image = NULL; - ERR("Evas DirectFB reconfigure failed"); - return 0; -} - -static void * -_dfb_output_setup(int w, int h, const struct Evas_Engine_DirectFB_Spec *spec) -{ - Render_Engine *re; - - if (!_is_dfb_data_ok(spec->dfb, spec->surface, w, h)) - goto fatal; - - _evas_common_init(); - - re = calloc(1, sizeof(Render_Engine)); - if (!re) - { - perror("calloc"); - goto fatal; - } - re->dfb = spec->dfb; - re->spec = spec; - re->cache = evas_cache_engine_image_init(&_dfb_cache_engine_image_cb, - evas_common_image_cache_get()); - if (!re->cache) - { - ERR("Evas_Cache_Engine_Image allocation failed!"); - goto fatal_after_engine; - } - - if (!evas_engine_dfb_output_reconfigure(re, w, h)) - { - ERR("Could not reconfigure evas engine."); - goto fatal_after_reconfigure; - } - - _dfb_blit_accel_caps_print(spec->surface, NULL); - - return re; - - - fatal_after_reconfigure: - evas_cache_engine_image_shutdown(re->cache); - fatal_after_engine: - free(re); - fatal: - CRIT("DirectFB: unable to continue, abort()!"); - abort(); - return NULL; -} - -static int -evas_engine_dfb_setup(Evas *eo_e, void *in) -{ - Evas_Public_Data *e = eo_data_get(eo_e, EVAS_CLASS); - Evas_Engine_Info_DirectFB *info = in; - - if (!e->engine.data.output) - e->engine.data.output = _dfb_output_setup(e->output.w, e->output.h, - &info->info); - // XXX TODO: else reconfigure existing... - - if (!e->engine.data.output) - return 0; - - if (!e->engine.data.context) - e->engine.data.context = - e->engine.func->context_new(e->engine.data.output); - - return 1; -} - -static void -evas_engine_dfb_output_free(void *data) -{ - Render_Engine *re = data; - - if (!re) - return; - - if (re->cache) - evas_cache_engine_image_shutdown(re->cache); - - evas_common_tilebuf_free(re->tb); - if (re->rects) evas_common_tilebuf_free_render_rects(re->rects); - free(re); - - evas_common_font_shutdown(); - evas_common_image_shutdown(); -} - -static void -evas_engine_dfb_output_resize(void *data, int w, int h) -{ - if (!evas_engine_dfb_output_reconfigure(data, w, h)) - ERR("Failed to resize DirectFB evas"); -} - -static void -evas_engine_dfb_output_tile_size_set(void *data, int w, int h) -{ - Render_Engine *re = data; - - evas_common_tilebuf_set_tile_size(re->tb, w, h); -} - -static void -evas_engine_dfb_output_redraws_rect_add(void *data, int x, int y, int w, int h) -{ - Render_Engine *re = data; - - evas_common_tilebuf_add_redraw(re->tb, x, y, w, h); -} - -static void -evas_engine_dfb_output_redraws_rect_del(void *data, int x, int y, int w, int h) -{ - Render_Engine *re = data; - - evas_common_tilebuf_del_redraw(re->tb, x, y, w, h); -} - -static void -evas_engine_dfb_output_redraws_clear(void *data) -{ - Render_Engine *re = data; - - evas_common_tilebuf_clear(re->tb); -} - -static void * -evas_engine_dfb_output_redraws_next_update_get(void *data, int *x, int *y, int *w, int *h, int *cx, int *cy, int *cw, int *ch) -{ - Render_Engine *re = data; - Tilebuf_Rect *tb_rect; - - if (re->end) - { - re->end = 0; - return NULL; - } - if (!re->rects) - { - re->rects = evas_common_tilebuf_get_render_rects(re->tb); - re->cur_rect = EINA_INLIST_GET(re->rects); - } - if (!re->cur_rect) - return NULL; - - tb_rect = (Tilebuf_Rect*) re->cur_rect; - *cx = *x = tb_rect->x; - *cy = *y = tb_rect->y; - *cw = *w = tb_rect->w; - *ch = *h = tb_rect->h; - re->cur_rect = re->cur_rect->next; - if (!re->cur_rect) - { - evas_common_tilebuf_free_render_rects(re->rects); - re->rects = NULL; - re->end = 1; - } - - return re->screen_image; -} - -static void -evas_engine_dfb_output_redraws_next_update_push(void *data, void *surface EINA_UNUSED, int x, int y, int w, int h) -{ - Render_Engine *re = data; - DFBRegion *r; - - if (re->update_regions_count >= re->update_regions_limit) - { - void *tmp; - - re->update_regions_limit += 16; - - tmp = realloc(re->update_regions, - sizeof(DFBRegion) * re->update_regions_limit); - if (!tmp) - { - perror("realloc"); - return; - } - re->update_regions = tmp; - } - - r = re->update_regions + re->update_regions_count; - re->update_regions_count++; - - r->x1 = x; - r->y1 = y; - r->x2 = x + w - 1; - r->y2 = y + h - 1; -} - -static void -evas_engine_dfb_output_flush(void *data) -{ - Render_Engine *re = data; - IDirectFBSurface *s = re->screen_image->surface; - DFBRegion *r, *r_end; - - r = re->update_regions; - r_end = re->update_regions + re->update_regions_count; - -#ifdef DFB_UPDATE_INDIVIDUAL_RECTS - for (; r < r_end; r++) - s->Flip(s, r, DFB_FLIP_FLAGS); -#else - DFBRegion bb; - - bb.x1 = bb.y1 = 10000; - bb.x2 = bb.y2 = 0; - for (; r < r_end; r++) - { - if (bb.x1 > r->x1) - bb.x1 = r->x1; - if (bb.y1 > r->y1) - bb.y1 = r->y1; - - if (bb.x2 < r->x2) - bb.x2 = r->x2; - if (bb.y2 < r->y2) - bb.y2 = r->y2; - } - - s->Flip(s, &bb, DFB_FLIP_FLAGS); -#endif - - re->update_regions_count = 0; -} - -static void -evas_engine_dfb_output_idle_flush(void *data) -{ - Render_Engine *re = data; - - if (re->update_regions_count != 0) - ERR("update_regions_count not 0 as it should be!"); - - free(re->update_regions); - re->update_regions_count = 0; - re->update_regions_limit = 0; - re->update_regions = NULL; -} - -/* HACK!!! -- KLUDGE!!! - * - * This should really use IDirectFBFont and IDirectFBSurface::DrawString(), - * but to be edje-compatible IDirectFBFont::CreateFont() should be able to - * load fonts from non-files, which it does not. - * - * Try to find a way to create own IDirectFBFont in future and load from - * memory. - */ -static void -evas_engine_dfb_font_draw(void *data, void *context, void *surface, Evas_Font_Set *font EINA_UNUSED, int x, int y, int w EINA_UNUSED, int h EINA_UNUSED, int ow EINA_UNUSED, int oh EINA_UNUSED, Evas_Text_Props *intl_props) -{ - DirectFB_Engine_Image_Entry *eim = surface; - IDirectFBSurface *screen; - Render_Engine *re = data; - RGBA_Image *im; - - im = (RGBA_Image *)eim->cache_entry.src; - screen = eim->surface; - if (!_dfb_lock_and_sync_image(screen, im, DSLF_READ | DSLF_WRITE)) - return; - - evas_common_font_draw_prepare(intl_props); - evas_common_font_draw(im, context, x, y, intl_props); - evas_common_cpu_end_opt(); - - im->image.data = NULL; - - screen->Unlock(screen); -} - - -static void -_cb_draw_line(IDirectFBSurface *surface, RGBA_Draw_Context *dc EINA_UNUSED, const DFBRegion *region EINA_UNUSED, void *data) -{ - const Eina_Rectangle *r = data; - - surface->DrawLine(surface, r->x, r->y, r->w, r->h); /* x2, y2 really */ -} - -static void -evas_engine_dfb_line_draw(void *data EINA_UNUSED, void *context, void *surface, int x1, int y1, int x2, int y2) -{ - DirectFB_Engine_Image_Entry *eim = surface; - Eina_Rectangle r; - - if (!_dfb_surface_set_color_from_context(eim->surface, context)) - return; - - EINA_RECTANGLE_SET(&r, x1, y1, x2, y2); /* x2, y2 (ab)used as w, h */ - _dfb_surface_for_each_cutout(eim->surface, context, _cb_draw_line, &r); -} - -#ifndef DFB_USE_EVAS_RECT_DRAW -static void -_cb_draw_rectangle(IDirectFBSurface *surface, RGBA_Draw_Context *dc EINA_UNUSED, const DFBRegion *region EINA_UNUSED, void *data) -{ - const Eina_Rectangle *r = data; - - surface->FillRectangle(surface, r->x, r->y, r->w, r->h); -} - -static void -evas_engine_dfb_rectangle_draw(void *data, void *context, void *surface, int x, int y, int w, int h) -{ - DirectFB_Engine_Image_Entry *eim = surface; - IDirectFBSurface *screen; - Render_Engine *re = data; - RGBA_Draw_Context *dc = context; - Eina_Rectangle r; - - screen = eim->surface; - if (!_dfb_surface_set_color_from_context(screen, context)) - { - if (dc->render_op != EVAS_RENDER_COPY) - return; - if (!eim->cache_entry.src->flags.alpha) - return; - screen->SetColor(screen, 0, 0, 0, 0); - screen->SetDrawingFlags(screen, DSDRAW_NOFX); - } - - EINA_RECTANGLE_SET(&r, x, y, w, h); - _dfb_surface_for_each_cutout(screen, context, _cb_draw_rectangle, &r); -} -#else -static void -evas_engine_dfb_rectangle_draw(void *data, void *context, void *surface, int x, int y, int w, int h) -{ - DirectFB_Engine_Image_Entry *eim = surface; - IDirectFBSurface *screen; - Render_Engine *re = data; - RGBA_Image *dst; - - dst = (RGBA_Image *)eim->cache_entry.src; - screen = eim->surface; - if (!_dfb_lock_and_sync_image(screen, dst, DSLF_READ | DSLF_WRITE)) - return; - - evas_common_rectangle_draw(dst, context, x, y, w, h); - evas_common_cpu_end_opt(); - - dst->image.data = NULL; - - screen->Unlock(screen); -} -#endif - -#ifndef DFB_USE_EVAS_POLYGON_DRAW -static void -evas_engine_dfb_polygon_draw(void *data EINA_UNUSED, void *context, void *surface, void *polygon, int x, int y) -{ - DirectFB_Engine_Image_Entry *eim = surface; - _dfb_polygon_draw(eim->surface, context, polygon, x, y); -} -#else -static void -evas_engine_dfb_polygon_draw(void *data, void *context, void *surface, void *polygon, int x, int y) -{ - DirectFB_Engine_Image_Entry *eim = surface; - IDirectFBSurface *screen; - Render_Engine *re = data; - RGBA_Image *dst; - - dst = (RGBA_Image *)eim->cache_entry.src; - screen = eim->surface; - if (!_dfb_lock_and_sync_image(screen, dst, DSLF_READ | DSLF_WRITE)) - return; - - evas_common_polygon_draw(dst, context, polygon, x, y); - evas_common_cpu_end_opt(); - - dst->image.data = NULL; - - screen->Unlock(screen); -} -#endif - -/** Image Object *******************************************************/ -static void * -evas_engine_dfb_image_load(void *data, const char *file, const char *key, int *error, Evas_Image_Load_Opts *lo) -{ - Render_Engine *re = data; - - *error = 0; - return evas_cache_engine_image_request(re->cache, file, key, lo, - data, error); -} - -static int -evas_engine_dfb_image_alpha_get(void *data EINA_UNUSED, void *image) -{ - DirectFB_Engine_Image_Entry *eim = image; - Image_Entry *ie; - RGBA_Image *im; - - if (!eim) return 1; - ie = eim->cache_entry.src; - im = (RGBA_Image *)ie; - switch (ie->space) - { - case EVAS_COLORSPACE_ARGB8888: - if (ie->flags.alpha) return 1; - default: - break; - } - return 0; -} - -static void -evas_engine_dfb_image_size_get(void *data EINA_UNUSED, void *image, int *w, int *h) -{ - DirectFB_Engine_Image_Entry *eim = image; - Image_Entry *ie; - - ie = eim->cache_entry.src; - if (w) *w = ie->w; - if (h) *h = ie->h; -} - -static int -evas_engine_dfb_image_colorspace_get(void *data EINA_UNUSED, void *image) -{ - DirectFB_Engine_Image_Entry *eim = image; - - if (!eim) return EVAS_COLORSPACE_ARGB8888; - return eim->cache_entry.src->space; -} - -static void -evas_engine_dfb_image_colorspace_set(void *data, void *image, int cspace) -{ - DirectFB_Engine_Image_Entry *eim = image; - - if (!eim) return; - if (eim->cache_entry.src->space == cspace) return; - - evas_cache_engine_image_colorspace(&eim->cache_entry, cspace, data); -} - -static void * -evas_engine_dfb_image_new_from_copied_data(void *data, int w, int h, DATA32* image_data, int alpha, int cspace) -{ - Render_Engine *re = data; - - return evas_cache_engine_image_copied_data(re->cache, w, h, image_data, - alpha, cspace, NULL); -} - -static void * -evas_engine_dfb_image_new_from_data(void *data, int w, int h, DATA32* image_data, int alpha, int cspace) -{ - Render_Engine *re = data; - - return evas_cache_engine_image_data(re->cache, w, h, image_data, - alpha, cspace, NULL); -} - -static void -evas_engine_dfb_image_free(void *data EINA_UNUSED, void *image) -{ - DirectFB_Engine_Image_Entry *eim = image; - - evas_cache_engine_image_drop(&eim->cache_entry); -} - -static void * -evas_engine_dfb_image_size_set(void *data EINA_UNUSED, void *image, int w, int h) -{ - DirectFB_Engine_Image_Entry *eim = image; - - return evas_cache_engine_image_size_set(&eim->cache_entry, w, h); -} - -static void * -evas_engine_dfb_image_dirty_region(void *data EINA_UNUSED, void *image, int x, int y, int w, int h) -{ - DirectFB_Engine_Image_Entry *eim = image; - - return evas_cache_engine_image_dirty(&eim->cache_entry, x, y, w, h); -} - -static void * -evas_engine_dfb_image_data_get(void *data EINA_UNUSED, void *image, int to_write, DATA32** image_data, int *err EINA_UNUSED) -{ - DirectFB_Engine_Image_Entry *deie = image; - Engine_Image_Entry *ce; - Image_Entry *ie; - RGBA_Image *im; - - if (!deie) - { - *image_data = NULL; - return NULL; - } - - ce = (Engine_Image_Entry *)deie; - ie = ce->src; - im = (RGBA_Image *)ie; - - switch (ie->space) - { - case EVAS_COLORSPACE_ARGB8888: - { - DFBResult r; - IDirectFBSurface *s; - void *pixels; - int pitch; - - if (to_write) - deie = (DirectFB_Engine_Image_Entry *) - evas_cache_engine_image_dirty(ce, 0, 0, ie->w, ie->h); - - evas_cache_engine_image_load_data(ce); - - ce = (Engine_Image_Entry *)deie; - ie = ce->src; - im = (RGBA_Image *)ie; - s = deie->surface; - - if (to_write) - { - r = s->Lock(s, DSLF_WRITE, &pixels, &pitch); - if (r != DFB_OK) - goto error; - deie->flags.is_locked = 1; - } - else - { - r = s->Lock(s, DSLF_READ, &pixels, &pitch); - if (r != DFB_OK) - goto error; - s->Unlock(s); - } - - *image_data = pixels; - im->image.data = pixels; /* remember for _put() */ - break; - - error: - ERR("Could not lock surface %p: %s", - s, DirectFBErrorString(r)); - *image_data = NULL; - break; - } - case EVAS_COLORSPACE_YCBCR422P709_PL: - case EVAS_COLORSPACE_YCBCR422P601_PL: - case EVAS_COLORSPACE_YCBCR422601_PL: - /* XXX untested */ - *image_data = im->cs.data; - break; - default: - abort(); - break; - } - return deie; -} - -static void * -evas_engine_dfb_image_data_put(void *data, void *image, DATA32* image_data) -{ - DirectFB_Engine_Image_Entry *deie = image; - Render_Engine *re = data; - Engine_Image_Entry *ce; - Image_Entry *ie; - RGBA_Image *im; - - if (!deie) return NULL; - - ce = (Engine_Image_Entry *)deie; - ie = ce->src; - im = (RGBA_Image*)ie; - - switch (ie->space) - { - case EVAS_COLORSPACE_ARGB8888: - if (image_data == im->image.data) - { - if (deie->flags.is_locked) - { - deie->surface->Unlock(deie->surface); - deie->flags.is_locked = 0; - } - } - else - { - int alpha, cspace; - - alpha = func.image_alpha_get(re, deie); - cspace = func.image_colorspace_get(re, deie); - - evas_cache_engine_image_drop(ce); - deie = (DirectFB_Engine_Image_Entry *) - evas_cache_engine_image_data(re->cache, ce->w, ce->h, - image_data, alpha, cspace, NULL); - } - break; - case EVAS_COLORSPACE_YCBCR422P601_PL: - case EVAS_COLORSPACE_YCBCR422P709_PL: - case EVAS_COLORSPACE_YCBCR422601_PL: - /* XXX untested */ - if (image_data != im->cs.data) - { - if (im->cs.data) - if (!im->cs.no_free) - free(im->cs.data); - im->cs.data = image_data; - evas_common_image_colorspace_dirty(im); - } - break; - default: - abort(); - break; - } - return deie; -} - -static void -evas_engine_dfb_image_data_preload_request(void *data EINA_UNUSED, void *image, const void *target) -{ - DirectFB_Engine_Image_Entry *deie = image; - RGBA_Image *im; - - if (!deie) return ; - im = (RGBA_Image*) deie->cache_entry.src; - if (!im) return ; - evas_cache_image_preload_data(&im->cache_entry, target); -} - -static void -evas_engine_dfb_image_data_preload_cancel(void *data EINA_UNUSED, void *image, const void *target) -{ - DirectFB_Engine_Image_Entry *deie = image; - RGBA_Image *im; - - if (!deie) return ; - im = (RGBA_Image*) deie->cache_entry.src; - if (!im) return ; - evas_cache_image_preload_cancel(&im->cache_entry, target); -} - -static void * -evas_engine_dfb_image_alpha_set(void *data EINA_UNUSED, void *image, int has_alpha) -{ - DirectFB_Engine_Image_Entry *eim = image; - Engine_Image_Entry *ce; - Image_Entry *ie; - RGBA_Image *im; - - if (!eim) return NULL; - - ce = &eim->cache_entry; - ie = ce->src; - im = (RGBA_Image*)ie; - - if (ie->space != EVAS_COLORSPACE_ARGB8888) - { - ie->flags.alpha = 0; - return eim; - } - - eim = (DirectFB_Engine_Image_Entry *) - evas_cache_engine_image_dirty(ce, 0, 0, ce->w, ce->h); - - ie->flags.alpha = !!has_alpha; - return eim; -} - -struct _for_each_cutout_image -{ - IDirectFBSurface *image; - DFBRectangle src, dst; -}; - -static void -_cb_draw_image_unscaled(IDirectFBSurface *surface, RGBA_Draw_Context *dc EINA_UNUSED, const DFBRegion *region EINA_UNUSED, void *data) -{ - const struct _for_each_cutout_image *p = data; - - surface->Blit(surface, p->image, &p->src, p->dst.x, p->dst.y); -} - -static void -_cb_draw_image_scaled(IDirectFBSurface *surface, RGBA_Draw_Context *dc EINA_UNUSED, const DFBRegion *region EINA_UNUSED, void *data) -{ - const struct _for_each_cutout_image *p = data; - - surface->StretchBlit(surface, p->image, &p->src, &p->dst); -} - -#ifndef DFB_USE_EVAS_IMAGE_DRAW -static void -evas_engine_dfb_image_draw(void *data, void *context, void *surface, void *image, int src_x, int src_y, int src_w, int src_h, int dst_x, int dst_y, int dst_w, int dst_h, int smooth EINA_UNUSED) -{ - DirectFB_Engine_Image_Entry *eim = surface; - Render_Engine *re = data; - IDirectFBSurface *screen; - DirectFB_Engine_Image_Entry *deie = image; - struct _for_each_cutout_image p; - _cb_for_each_cutout_t cb; - - screen = eim->surface; - if (deie->cache_entry.src->space == EVAS_COLORSPACE_ARGB8888) - evas_cache_engine_image_load_data(&deie->cache_entry); - - evas_common_image_colorspace_normalize((RGBA_Image *)deie->cache_entry.src); - - _dfb_surface_set_blit_params(eim, deie, context); - - _dfb_rect_set(&p.src, src_x, src_y, src_w, src_h); - _dfb_rect_set(&p.dst, dst_x, dst_y, dst_w, dst_h); - p.image = deie->surface; - - if ((src_w == dst_w) && (src_h == dst_h)) - cb = _cb_draw_image_unscaled; - else - cb = _cb_draw_image_scaled; - - _dfb_blit_accel_caps_print(screen, deie->surface); - _dfb_surface_for_each_cutout(screen, context, cb, &p); -} -#else /* DFB_USE_EVAS_IMAGE_DRAW */ -static void -evas_engine_dfb_image_draw(void *data, void *context, void *surface, void *image, int src_x, int src_y, int src_w, int src_h, int dst_x, int dst_y, int dst_w, int dst_h, int smooth) -{ - DirectFB_Engine_Image_Entry *deie = image; - DirectFB_Engine_Image_Entry *eim = surface; - Render_Engine *re = data; - RGBA_Image *dst, *src; - IDirectFBSurface *screen; - - screen = eim->surface; - if (deie->cache_entry.src->space == EVAS_COLORSPACE_ARGB8888) - evas_cache_engine_image_load_data(&deie->cache_entry); - - evas_common_image_colorspace_normalize((RGBA_Image *)deie->cache_entry.src); - - dst = (RGBA_Image *)eim->cache_entry.src; - if (!_dfb_lock_and_sync_image(screen, dst, DSLF_READ | DSLF_WRITE)) - return; - - src = (RGBA_Image *)deie->cache_entry.src; - if (!_dfb_lock_and_sync_image(deie->surface, src, DSLF_READ)) - goto error_src; - - if (smooth) - evas_common_scale_rgba_in_to_out_clip_smooth(src, dst, context, - src_x, src_y, src_w, src_h, - dst_x, dst_y, dst_w, dst_h); - else - evas_common_scale_rgba_in_to_out_clip_sample(src, dst, context, - src_x, src_y, src_w, src_h, - dst_x, dst_y, dst_w, dst_h); - evas_common_cpu_end_opt(); - - dst->image.data = NULL; - - screen->Unlock(screen); - deie->surface->Unlock(deie->surface); - - return; - - error_src: - screen->Unlock(screen); -} -#endif - -static void -evas_engine_dfb_image_map_draw(void *data EINA_UNUSED, void *context, void *surface, void *image, RGBA_Map *m, int smooth, int level) -{ - Render_Engine *re = (Render_Engine*) data; - DirectFB_Engine_Image_Entry *deie = image; - DirectFB_Engine_Image_Entry *eim = surface; - IDirectFBSurface *screen; - RGBA_Image *dst, *src; - - if (!deie || !eim) return ; - - screen = eim->surface; - dst = (RGBA_Image *) eim->cache_entry.src; - if (!_dfb_lock_and_sync_image(screen, dst, DSLF_READ | DSLF_WRITE)) - return; - - src = (RGBA_Image *)deie->cache_entry.src; - if (!_dfb_lock_and_sync_image(deie->surface, src, DSLF_READ)) - goto error_src; - - evas_common_map_rgba(src, dst, context, 4, &m->pts[0], smooth, level); - evas_common_cpu_end_opt(); - - screen->Unlock(screen); - deie->surface->Unlock(deie->surface); - - return ; - - error_src: - screen->Unlock(screen); -} - -static void * -evas_engine_dfb_image_map_surface_new(void *data, int w, int h, int alpha) -{ - Render_Engine *re = (Render_Engine*) data; - void *surface; - - surface = evas_cache_engine_image_copied_data(re->cache, - w, h, NULL, alpha, - EVAS_COLORSPACE_ARGB8888, - NULL); - return surface; -} - -static void -evas_engine_dfb_image_map_surface_free(void *data EINA_UNUSED, void *surface) -{ - evas_cache_engine_image_drop(surface); -} - - -static void -evas_engine_dfb_image_cache_flush(void *data) -{ - Render_Engine *re = data; - int size; - - size = evas_cache_engine_image_get(re->cache); - evas_cache_engine_image_set(re->cache, 0); - evas_cache_engine_image_set(re->cache, size); -} - -static void -evas_engine_dfb_image_cache_set(void *data, int bytes) -{ - Render_Engine *re = data; - - evas_cache_engine_image_set(re->cache, bytes); -} - -static int -evas_engine_dfb_image_cache_get(void *data) -{ - Render_Engine *re = data; - - return evas_cache_engine_image_get(re->cache); -} - -static char * -evas_engine_dfb_image_comment_get(void *data EINA_UNUSED, void *image, char *key EINA_UNUSED) -{ - DirectFB_Engine_Image_Entry *eim = image; - RGBA_Image *im; - - if (!eim) return NULL; - im = (RGBA_Image *)eim->cache_entry.src; - - return im->info.comment; -} - -static void -evas_engine_dfb_image_scale_hint_set(void *data EINA_UNUSED, void *image, int hint) -{ -} - -static int -evas_engine_dfb_image_scale_hint_get(void *data EINA_UNUSED, void *image) -{ - return EVAS_IMAGE_SCALE_HINT_NONE; -} - -static Eina_Bool -evas_engine_dfb_canvas_alpha_get(void *data, void *context) -{ - Render_Engine *re = data; - - return re->screen_image->cache_entry.src->flags.alpha; -} - -static int -module_open(Evas_Module *em) -{ - if (!em) return 0; - /* get whatever engine module we inherit from */ - if (!_evas_module_engine_inherit(&parent_func, "software_generic")) return 0; - _evas_engine_directfb_log_dom = eina_log_domain_register - ("evas-directfb", EVAS_DEFAULT_LOG_COLOR); - if (_evas_engine_directfb_log_dom < 0) - { - EINA_LOG_ERR("Can not create a module log domain."); - return 0; - } - /* store it for later use */ - func = parent_func; - /* now to override methods */ -#define ORD(f) EVAS_API_OVERRIDE(f, &func, evas_engine_dfb_) - ORD(info); - ORD(info_free); - ORD(setup); - ORD(canvas_alpha_get); - ORD(output_free); - ORD(output_resize); - ORD(output_tile_size_set); - ORD(output_redraws_rect_add); - ORD(output_redraws_rect_del); - ORD(output_redraws_clear); - ORD(output_redraws_next_update_get); - ORD(output_redraws_next_update_push); - ORD(output_flush); - ORD(output_idle_flush); - ORD(image_load); - ORD(image_new_from_data); - ORD(image_new_from_copied_data); - ORD(image_colorspace_set); - ORD(image_colorspace_get); - ORD(image_free); - ORD(image_size_set); - ORD(image_size_get); - ORD(image_dirty_region); - ORD(image_data_get); - ORD(image_data_put); - ORD(image_data_preload_request); - ORD(image_data_preload_cancel); - ORD(image_alpha_set); - ORD(image_alpha_get); - ORD(image_draw); - ORD(image_comment_get); - ORD(image_cache_flush); - ORD(image_cache_set); - ORD(image_cache_get); - ORD(font_draw); - ORD(line_draw); - ORD(rectangle_draw); - ORD(polygon_draw); - ORD(image_scale_hint_set); - ORD(image_scale_hint_get); - - ORD(image_map_draw); - ORD(image_map_surface_new); - ORD(image_map_surface_free); - - /* now advertise out own api */ - em->functions = (void *)(&func); - return 1; -} - -static void -module_close(Evas_Module *em) -{ - eina_log_domain_unregister(_evas_engine_directfb_log_dom); -} - -static Evas_Module_Api evas_modapi = -{ - EVAS_MODULE_API_VERSION, - "directfb", - "ProFUSION embedded systems", - { - module_open, - module_close - } -}; - -EVAS_MODULE_DEFINE(EVAS_MODULE_TYPE_ENGINE, engine, directfb); - -#ifndef EVAS_STATIC_BUILD_DIRECTFB -EVAS_EINA_MODULE_DEFINE(engine, directfb); -#endif diff --git a/src/modules/evas/engines/directfb/evas_engine.h b/src/modules/evas/engines/directfb/evas_engine.h deleted file mode 100644 index 7ad1e38262..0000000000 --- a/src/modules/evas/engines/directfb/evas_engine.h +++ /dev/null @@ -1,71 +0,0 @@ -#ifndef EVAS_ENGINE_DIRECTFB_H -#define EVAS_ENGINE_DIRECTFB_H - -#include "evas_common.h" -#include "evas_private.h" -#include "Evas_Engine_DirectFB.h" - -extern int _evas_engine_directfb_log_dom ; - -#ifdef ERR -# undef ERR -#endif -#define ERR(...) EINA_LOG_DOM_ERR(_evas_engine_directfb_log_dom, __VA_ARGS__) - -#ifdef DBG -# undef DBG -#endif -#define DBG(...) EINA_LOG_DOM_DBG(_evas_engine_directfb_log_dom, __VA_ARGS__) - -#ifdef INF -# undef INF -#endif -#define INF(...) EINA_LOG_DOM_INFO(_evas_engine_directfb_log_dom, __VA_ARGS__) - -#ifdef WRN -# undef WRN -#endif -#define WRN(...) EINA_LOG_DOM_WARN(_evas_engine_directfb_log_dom, __VA_ARGS__) - -#ifdef CRIT -# undef CRIT -#endif -#define CRIT(...) EINA_LOG_DOM_CRIT(_evas_engine_directfb_log_dom, __VA_ARGS__) - -typedef struct _DirectFB_Engine_Image_Entry DirectFB_Engine_Image_Entry; -struct _DirectFB_Engine_Image_Entry -{ - Engine_Image_Entry cache_entry; - IDirectFBSurface *surface; - - struct - { - Eina_Bool engine_surface : 1; - Eina_Bool is_locked : 1; - } flags; -}; - -typedef struct _Render_Engine Render_Engine; -struct _Render_Engine -{ - DirectFB_Engine_Image_Entry *screen_image; - const struct Evas_Engine_DirectFB_Spec *spec; - IDirectFB *dfb; - - Evas_Cache_Engine_Image *cache; - - Tilebuf *tb; - Tilebuf_Rect *rects; - Eina_Inlist *cur_rect; - - DFBRegion *update_regions; - unsigned int update_regions_count; - unsigned int update_regions_limit; - - Eina_Bool end : 1; -}; - -int _dfb_surface_set_color_from_context(IDirectFBSurface *surface, RGBA_Draw_Context *dc); -void _dfb_polygon_draw(IDirectFBSurface *surface, RGBA_Draw_Context *dc, Eina_Inlist *points, int x, int y); - -#endif diff --git a/src/modules/evas/engines/directfb/polygon.c b/src/modules/evas/engines/directfb/polygon.c deleted file mode 100644 index d040c9d9d8..0000000000 --- a/src/modules/evas/engines/directfb/polygon.c +++ /dev/null @@ -1,269 +0,0 @@ -#include -#include "evas_engine.h" - -/* reduce calls to DirectFB (FillSpans), but uses twice as much memory */ -//#define USE_SPAN_RECTS 1 - -#define MAX_SPANS 512 -typedef struct _RGBA_Edge RGBA_Edge; -typedef struct _RGBA_Vertex RGBA_Vertex; - -struct _RGBA_Edge -{ - double x, dx; - int i; -}; - -struct _RGBA_Vertex -{ - double x, y; - int i; -}; - -#define POLY_EDGE_DEL(_i) \ -{ \ - int _j; \ - \ - for (_j = 0; (_j < num_active_edges) && (edges[_j].i != _i); _j++); \ - if (_j < num_active_edges) \ - { \ - num_active_edges--; \ - memmove(&(edges[_j]), &(edges[_j + 1]), \ - (num_active_edges - _j) * sizeof(RGBA_Edge)); \ - } \ -} - -#define POLY_EDGE_ADD(_i, _y) \ -{ \ - int _j; \ - float _dx; \ - RGBA_Vertex *_p, *_q; \ - if (_i < (n - 1)) _j = _i + 1; \ - else _j = 0; \ - if (point[_i].y < point[_j].y) \ - { \ - _p = &(point[_i]); \ - _q = &(point[_j]); \ - } \ - else \ - { \ - _p = &(point[_j]); \ - _q = &(point[_i]); \ - } \ - edges[num_active_edges].dx = _dx = (_q->x - _p->x) / (_q->y - _p->y); \ - edges[num_active_edges].x = (_dx * ((float)_y + 0.5 - _p->y)) + _p->x; \ - edges[num_active_edges].i = _i; \ - num_active_edges++; \ -} - -static int -polygon_point_sorter(const void *a, const void *b) -{ - RGBA_Vertex *p, *q; - - p = (RGBA_Vertex *)a; - q = (RGBA_Vertex *)b; - if (p->y <= q->y) return -1; - return 1; -} - -static int -polygon_edge_sorter(const void *a, const void *b) -{ - RGBA_Edge *p, *q; - - p = (RGBA_Edge *)a; - q = (RGBA_Edge *)b; - if (p->x <= q->x) return -1; - return 1; -} - -#ifndef USE_SPAN_RECTS -typedef DFBSpan span_t; - -static void -polygon_span_add(span_t *span, int y EINA_UNUSED, int x, int w) -{ - span->x = x; - span->w = w; -} - -static void -polygon_spans_fill(IDirectFBSurface *surface, int y, const span_t *spans, int n_spans) -{ - /* directfb automatically increments y for each span */ - for (; n_spans > 0; n_spans--, spans++) - surface->FillSpans(surface, y, spans, 1); -} -#else /* USE_SPAN_RECTS */ -typedef DFBRectangle span_t; - -static void -polygon_span_add(span_t *span, int y, int x, int w) -{ - span->x = x; - span->y = y; - span->w = w; - span->h = 1; -} - -static void -polygon_spans_fill(IDirectFBSurface *surface, int y, const span_t *spans, int n_spans) -{ - surface->FillRectangles(surface, spans, n_spans); -} -#endif /* USE_SPAN_RECTS */ - - -void -_dfb_polygon_draw(IDirectFBSurface *surface, RGBA_Draw_Context *dc, Eina_Inlist *points, int px, int py) -{ - RGBA_Polygon_Point *pt; - RGBA_Vertex *point; - RGBA_Edge *edges; - int num_active_edges; - int n; - int i, j, k; - int y0, y1, y; - int ext_x, ext_y, ext_w, ext_h; - int *sorted_index; - - ext_x = 0; - ext_y = 0; - surface->GetSize(surface, &ext_w, &ext_h); - if (dc->clip.use) - { - if (dc->clip.x > ext_x) - { - ext_w += ext_x - dc->clip.x; - ext_x = dc->clip.x; - } - if ((ext_x + ext_w) > (dc->clip.x + dc->clip.w)) - { - ext_w = (dc->clip.x + dc->clip.w) - ext_x; - } - if (dc->clip.y > ext_y) - { - ext_h += ext_y - dc->clip.y; - ext_y = dc->clip.y; - } - if ((ext_y + ext_h) > (dc->clip.y + dc->clip.h)) - { - ext_h = (dc->clip.y + dc->clip.h) - ext_y; - } - } - if ((ext_w <= 0) || (ext_h <= 0)) return; - - evas_common_cpu_end_opt(); - - if (!_dfb_surface_set_color_from_context(surface, dc)) - return; - - n = 0; EINA_INLIST_FOREACH(points, pt) n++; - if (n < 3) return; - edges = malloc(sizeof(RGBA_Edge) * n); - if (!edges) return; - point = malloc(sizeof(RGBA_Vertex) * n); - if (!point) - { - free(edges); - return; - } - sorted_index = malloc(sizeof(int) * n); - if (!sorted_index) - { - free(edges); - free(point); - return; - } - - k = 0; - EINA_INLIST_FOREACH(points, pt) - { - point[k].x = pt->x + px; - point[k].y = pt->y + py; - point[k].i = k; - k++; - } - qsort(point, n, sizeof(RGBA_Vertex), polygon_point_sorter); - for (k = 0; k < n; k++) sorted_index[k] = point[k].i; - k = 0; - EINA_INLIST_FOREACH(points, pt) - { - point[k].x = pt->x + px; - point[k].y = pt->y + py; - point[k].i = k; - k++; - } - - y0 = MAX(ext_y, ceil(point[sorted_index[0]].y - 0.5)); - y1 = MIN(ext_y + ext_h - 1, floor(point[sorted_index[n - 1]].y - 0.5)); - - k = 0; - num_active_edges = 0; - - for (y = y0; y <= y1; y++) - { - span_t spans[MAX_SPANS]; - unsigned int n_spans = 0; - - for (; (k < n) && (point[sorted_index[k]].y <= ((double)y + 0.5)); k++) - { - i = sorted_index[k]; - - if (i > 0) j = i - 1; - else j = n - 1; - if (point[j].y <= ((double)y - 0.5)) - { - POLY_EDGE_DEL(j) - } - else if (point[j].y > ((double)y + 0.5)) - { - POLY_EDGE_ADD(j, y) - } - if (i < (n - 1)) j = i + 1; - else j = 0; - if (point[j].y <= ((double)y - 0.5)) - { - POLY_EDGE_DEL(i) - } - else if (point[j].y > ((double)y + 0.5)) - { - POLY_EDGE_ADD(i, y) - } - } - - qsort(edges, num_active_edges, sizeof(RGBA_Edge), polygon_edge_sorter); - - for (j = 0; j < num_active_edges; j += 2) - { - int x0, x1; - - x0 = ceil(edges[j].x - 0.5); - if (j < (num_active_edges - 1)) - x1 = floor(edges[j + 1].x - 0.5); - else - x1 = x0; - if ((x1 >= ext_x) && (x0 < (ext_x + ext_w)) && (x0 <= x1)) - { - if (n_spans == MAX_SPANS) - { - polygon_spans_fill(surface, y, spans, n_spans); - n_spans = 0; - } - - polygon_span_add(spans + n_spans, y, x0, (x1 - x0) + 1); - n_spans++; - } - edges[j].x += edges[j].dx; - edges[j + 1].x += edges[j + 1].dx; - } - - if (n_spans) - polygon_spans_fill(surface, y, spans, n_spans); - } - - free(edges); - free(point); - free(sorted_index); -}