From e68d4430d9324a7964c52463ab5f693507d75e15 Mon Sep 17 00:00:00 2001 From: Vincent Torri Date: Tue, 19 Jun 2012 17:06:44 +0000 Subject: [PATCH] Evas: remove software DirectDraw 16 bits engine Nowadays, this engine is completely useless. Windows users (>= XP) use only 32 bits depth color, so let's kill that engine. Less code to maintain for me. SVN revision: 72494 --- legacy/evas/ChangeLog | 4 + legacy/evas/Makefile.am | 5 - legacy/evas/NEWS | 1 + legacy/evas/configure.ac | 10 - legacy/evas/evas-software-16-ddraw.pc.in | 3 - legacy/evas/src/lib/Makefile.am | 5 - legacy/evas/src/lib/file/evas_module.c | 16 +- legacy/evas/src/modules/engines/Makefile.am | 3 - .../Evas_Engine_Software_16_DDraw.h | 32 - .../engines/software_16_ddraw/Makefile.am | 50 -- .../software_16_ddraw/evas_ddraw_buffer.cpp | 87 --- .../software_16_ddraw/evas_ddraw_main.cpp | 71 -- .../engines/software_16_ddraw/evas_engine.c | 628 ------------------ .../engines/software_16_ddraw/evas_engine.h | 85 --- 14 files changed, 11 insertions(+), 989 deletions(-) delete mode 100644 legacy/evas/evas-software-16-ddraw.pc.in delete mode 100644 legacy/evas/src/modules/engines/software_16_ddraw/Evas_Engine_Software_16_DDraw.h delete mode 100644 legacy/evas/src/modules/engines/software_16_ddraw/Makefile.am delete mode 100644 legacy/evas/src/modules/engines/software_16_ddraw/evas_ddraw_buffer.cpp delete mode 100644 legacy/evas/src/modules/engines/software_16_ddraw/evas_ddraw_main.cpp delete mode 100644 legacy/evas/src/modules/engines/software_16_ddraw/evas_engine.c delete mode 100644 legacy/evas/src/modules/engines/software_16_ddraw/evas_engine.h diff --git a/legacy/evas/ChangeLog b/legacy/evas/ChangeLog index 6bc4c0c2e3..54c4279a05 100644 --- a/legacy/evas/ChangeLog +++ b/legacy/evas/ChangeLog @@ -822,3 +822,7 @@ * Fix GL engine bitmap font handling +2012-06-19 Vincent Torri + + * Remove uselesss software DirectDraw 16 bits engine + diff --git a/legacy/evas/Makefile.am b/legacy/evas/Makefile.am index 10686e2ac5..d8cb45a327 100644 --- a/legacy/evas/Makefile.am +++ b/legacy/evas/Makefile.am @@ -40,7 +40,6 @@ evas-software-16-x11.pc.in \ evas-software-8-x11.pc.in \ evas-software-gdi.pc.in \ evas-software-ddraw.pc.in \ -evas-software-16-ddraw.pc.in \ evas-direct3d.pc.in \ evas-software-16-wince.pc.in \ evas-psl1ght.pc.in \ @@ -109,10 +108,6 @@ if BUILD_ENGINE_SOFTWARE_DDRAW pkgconfig_DATA += evas-software-ddraw.pc endif -if BUILD_ENGINE_SOFTWARE_16_DDRAW -pkgconfig_DATA += evas-software-16-ddraw.pc -endif - if BUILD_ENGINE_DIRECT3D pkgconfig_DATA += evas-direct3d.pc endif diff --git a/legacy/evas/NEWS b/legacy/evas/NEWS index e6474fbf71..3ec27d8cc6 100644 --- a/legacy/evas/NEWS +++ b/legacy/evas/NEWS @@ -22,6 +22,7 @@ Fixes: Removal: * Remove EVAS_FRAME_QUEUING, EVAS_SLI, METRIC_CACHE and WORD_CACHE. * Remove librsvg svg loader (If you want to use it, use the evas_generic_loader variant). + * Remove software DirectDraw 16 bits engine Evas 1.2.0 diff --git a/legacy/evas/configure.ac b/legacy/evas/configure.ac index 93e26ed691..57216e0fde 100644 --- a/legacy/evas/configure.ac +++ b/legacy/evas/configure.ac @@ -101,7 +101,6 @@ want_evas_engine_software_gdi="no" want_evas_engine_software_ddraw="no" want_evas_engine_software_8_x11="no" want_evas_engine_software_16_x11="no" -want_evas_engine_software_16_ddraw="no" want_evas_engine_software_16_wince="no" want_evas_engine_software_16_sdl="no" want_evas_engine_gl_xlib="no" @@ -146,7 +145,6 @@ case "$host_os" in want_evas_engine_software_gdi="yes" want_evas_engine_software_ddraw="yes" want_evas_engine_direct3d="yes" - want_evas_engine_software_16_ddraw="yes" want_evas_image_loader_edb="no" want_evas_image_loader_svg="no" ;; @@ -766,8 +764,6 @@ EVAS_CHECK_ENGINE([software-8-x11], [${want_evas_engine_software_8_x11}], [no], EVAS_CHECK_ENGINE([software-16-x11], [${want_evas_engine_software_16_x11}], [no], [Software X11 16 bits]) -EVAS_CHECK_ENGINE([software-16-ddraw], [${want_evas_engine_software_16_ddraw}], [no], [Software DirectDraw 16 bits]) - EVAS_CHECK_ENGINE([software-16-wince], [${want_evas_engine_software_16_wince}], [no], [Software Windows CE 16 bits]) EVAS_CHECK_ENGINE([software-16-sdl], [${want_evas_engine_software_16_sdl}], [no], [Software SDL 16 bits]) @@ -977,9 +973,6 @@ fi if test "x$have_evas_engine_software_16_sdl" = "xyes" -o "x$have_evas_engine_software_16_sdl" = "xstatic"; then have_evas_engine_software_16="yes" fi -if test "x$have_evas_engine_software_16_ddraw" = "xyes" -o "x$have_evas_engine_software_16_ddraw" = "xstatic"; then - have_evas_engine_software_16="yes" -fi if test "x$have_evas_engine_software_16_wince" = "xyes" -o "x$have_evas_engine_software_16_wince" = "xstatic"; then have_evas_engine_software_16="yes" fi @@ -1890,7 +1883,6 @@ evas-software-8-x11.pc evas-software-16-x11.pc evas-software-gdi.pc evas-software-ddraw.pc -evas-software-16-ddraw.pc evas-direct3d.pc evas-software-16-wince.pc evas-software-sdl.pc @@ -1952,7 +1944,6 @@ src/modules/engines/software_8/Makefile src/modules/engines/software_8_x11/Makefile src/modules/engines/software_16/Makefile src/modules/engines/software_16_x11/Makefile -src/modules/engines/software_16_ddraw/Makefile src/modules/engines/software_16_sdl/Makefile src/modules/engines/wayland_shm/Makefile src/modules/engines/wayland_egl/Makefile @@ -2048,7 +2039,6 @@ echo " Software 8bit grayscale....: $have_evas_engine_software_8" # FIXME: kill software 16bit echo " Software 16bit ............: $have_evas_engine_software_16" echo " Software 16bit X11.........: $have_evas_engine_software_16_x11" -echo " Software 16bit Directdraw..: $have_evas_engine_software_16_ddraw" echo " Software 16bit WinCE.......: $have_evas_engine_software_16_wince" echo " Software 16bit SDL.........: $have_evas_engine_software_16_sdl (primitive: $sdl_primitive)" echo " Wayland Shm................: $have_evas_engine_wayland_shm" diff --git a/legacy/evas/evas-software-16-ddraw.pc.in b/legacy/evas/evas-software-16-ddraw.pc.in deleted file mode 100644 index 8c00f61169..0000000000 --- a/legacy/evas/evas-software-16-ddraw.pc.in +++ /dev/null @@ -1,3 +0,0 @@ -Name: evas-software-16-ddraw -Description: Evas 16bit software DirectDaw engine -Version: @VERSION@ diff --git a/legacy/evas/src/lib/Makefile.am b/legacy/evas/src/lib/Makefile.am index 9d9f3a1039..00511f38d8 100644 --- a/legacy/evas/src/lib/Makefile.am +++ b/legacy/evas/src/lib/Makefile.am @@ -52,11 +52,6 @@ if EVAS_STATIC_BUILD_SOFTWARE_16 SUBDIRS += ../modules/engines/software_16/ EVAS_STATIC_MODULE += ../modules/engines/software_16/libevas_engine_software_16.la endif -if EVAS_STATIC_BUILD_SOFTWARE_16_DDRAW -SUBDIRS += ../modules/engines/software_16_ddraw/ -EVAS_STATIC_MODULE += ../modules/engines/software_16_ddraw/libevas_engine_software_16_ddraw.la -EVAS_STATIC_LIBADD += @evas_engine_software_16_ddraw_libs@ -endif if EVAS_STATIC_BUILD_SOFTWARE_16_WINCE SUBDIRS += ../modules/engines/software_16_wince/ EVAS_STATIC_MODULE += ../modules/engines/software_16_wince/libevas_engine_software_16_wince.la diff --git a/legacy/evas/src/lib/file/evas_module.c b/legacy/evas/src/lib/file/evas_module.c index 063c4797a2..18a5e959e8 100644 --- a/legacy/evas/src/lib/file/evas_module.c +++ b/legacy/evas/src/lib/file/evas_module.c @@ -89,7 +89,6 @@ EVAS_EINA_STATIC_MODULE_DEFINE(engine, gl_x11); EVAS_EINA_STATIC_MODULE_DEFINE(engine, gl_sdl); EVAS_EINA_STATIC_MODULE_DEFINE(engine, psl1ght); EVAS_EINA_STATIC_MODULE_DEFINE(engine, software_16); -EVAS_EINA_STATIC_MODULE_DEFINE(engine, software_16_ddraw); EVAS_EINA_STATIC_MODULE_DEFINE(engine, software_16_sdl); EVAS_EINA_STATIC_MODULE_DEFINE(engine, software_16_wince); EVAS_EINA_STATIC_MODULE_DEFINE(engine, software_16_x11); @@ -148,9 +147,6 @@ static const struct { #ifdef EVAS_STATIC_BUILD_SOFTWARE_16 EVAS_EINA_STATIC_MODULE_USE(engine, software_16), #endif -#ifdef EVAS_STATIC_BUILD_SOFTWARE_16_DDRAW - EVAS_EINA_STATIC_MODULE_USE(engine, software_16_ddraw), -#endif #ifdef EVAS_STATIC_BUILD_SOFTWARE_16_SDL EVAS_EINA_STATIC_MODULE_USE(engine, software_16_sdl), #endif @@ -160,18 +156,18 @@ static const struct { #ifdef EVAS_STATIC_BUILD_SOFTWARE_16_X11 EVAS_EINA_STATIC_MODULE_USE(engine, software_16_x11), #endif -#ifdef EVAS_STATIC_BUILD_SOFTWARE_16_DDRAW - EVAS_EINA_STATIC_MODULE_USE(engine, software_ddraw), -#endif -#ifdef EVAS_STATIC_BUILD_SOFTWARE_16_GDI - EVAS_EINA_STATIC_MODULE_USE(engine, software_gdi), -#endif #ifdef EVAS_STATIC_BUILD_SOFTWARE_8 EVAS_EINA_STATIC_MODULE_USE(engine, software_8), #endif #ifdef EVAS_STATIC_BUILD_SOFTWARE_8_X11 EVAS_EINA_STATIC_MODULE_USE(engine, software_8_x11), #endif +#ifdef EVAS_STATIC_BUILD_SOFTWARE_DDRAW + EVAS_EINA_STATIC_MODULE_USE(engine, software_ddraw), +#endif +#ifdef EVAS_STATIC_BUILD_SOFTWARE_GDI + EVAS_EINA_STATIC_MODULE_USE(engine, software_gdi), +#endif #ifdef EVAS_STATIC_BUILD_SOFTWARE_GENERIC EVAS_EINA_STATIC_MODULE_USE(engine, software_generic), #endif diff --git a/legacy/evas/src/modules/engines/Makefile.am b/legacy/evas/src/modules/engines/Makefile.am index e29fb98f5a..3ee22dfbf6 100644 --- a/legacy/evas/src/modules/engines/Makefile.am +++ b/legacy/evas/src/modules/engines/Makefile.am @@ -44,9 +44,6 @@ endif if !EVAS_STATIC_BUILD_SOFTWARE_16 SUBDIRS += software_16 endif -if !EVAS_STATIC_BUILD_SOFTWARE_16_DDRAW -SUBDIRS += software_16_ddraw -endif if !EVAS_STATIC_BUILD_SOFTWARE_16_WINCE SUBDIRS += software_16_wince endif diff --git a/legacy/evas/src/modules/engines/software_16_ddraw/Evas_Engine_Software_16_DDraw.h b/legacy/evas/src/modules/engines/software_16_ddraw/Evas_Engine_Software_16_DDraw.h deleted file mode 100644 index 3c1547a26d..0000000000 --- a/legacy/evas/src/modules/engines/software_16_ddraw/Evas_Engine_Software_16_DDraw.h +++ /dev/null @@ -1,32 +0,0 @@ -#ifndef __EVAS_ENGINE_SOFTWARE_16_DDRAW_H__ -#define __EVAS_ENGINE_SOFTWARE_16_DDRAW_H__ - - -#include -#include - -typedef struct _Evas_Engine_Info_Software_16_DDraw Evas_Engine_Info_Software_16_DDraw; - -struct _Evas_Engine_Info_Software_16_DDraw -{ - /* 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 { - HWND window; - LPDIRECTDRAW object; /* DirectDraw object */ - LPDIRECTDRAWSURFACE surface_primary; /* DirectDraw primary surface */ - LPDIRECTDRAWSURFACE surface_back; /* DirectDraw back surface */ - LPDIRECTDRAWSURFACE surface_source; /* DirectDraw source surface */ - int depth; - - int rotation; - } info; - - /* non-blocking or blocking mode */ - Evas_Engine_Render_Mode render_mode; -}; - - -#endif /* __EVAS_ENGINE_SOFTWARE_16_DDRAW_H__ */ diff --git a/legacy/evas/src/modules/engines/software_16_ddraw/Makefile.am b/legacy/evas/src/modules/engines/software_16_ddraw/Makefile.am deleted file mode 100644 index f68f24daee..0000000000 --- a/legacy/evas/src/modules/engines/software_16_ddraw/Makefile.am +++ /dev/null @@ -1,50 +0,0 @@ - -MAINTAINERCLEANFILES = Makefile.in - -AM_CPPFLAGS = \ --I. \ --I$(top_srcdir)/src/lib \ --I$(top_srcdir)/src/lib/include \ --I$(top_srcdir)/src/modules/engines \ --I$(top_srcdir)/src/modules/engines/software_16 \ -@EINA_CFLAGS@ \ -@FREETYPE_CFLAGS@ \ -@PIXMAN_CFLAGS@ \ -@FRIBIDI_CFLAGS@ \ -@evas_engine_software_16_ddraw_cflags@ - -if BUILD_ENGINE_SOFTWARE_16_DDRAW - -SOFTWARE_16_DDRAW_SOURCES = \ -evas_engine.c \ -evas_ddraw_buffer.cpp \ -evas_ddraw_main.cpp - -SOFTWARE_16_DDRAW_LIBADD = @evas_engine_software_16_ddraw_libs@ - - -includes_HEADERS = Evas_Engine_Software_16_DDraw.h -includesdir = $(includedir)/evas-@VMAJ@ - -if !EVAS_STATIC_BUILD_SOFTWARE_16_DDRAW - -pkgdir = $(libdir)/evas/modules/engines/software_16_ddraw/$(MODULE_ARCH) -pkg_LTLIBRARIES = module.la - -module_la_SOURCES = $(SOFTWARE_16_DDRAW_SOURCES) -module_la_CXXFLAGS = -fno-rtti -fno-exceptions -module_la_LIBADD = $(top_builddir)/src/lib/libevas.la @EINA_LIBS@ $(SOFTWARE_16_DDRAW_LIBADD) -module_la_LDFLAGS = @lt_enable_auto_import@ -no-undefined -module -avoid-version -module_la_LIBTOOLFLAGS = --tag=disable-static - -else - -noinst_LTLIBRARIES = libevas_engine_software_16_ddraw.la - -libevas_engine_software_16_ddraw_la_SOURCES = $(SOFTWARE_16_DDRAW_SOURCES) -libevas_engine_software_16_ddraw_la_LIBADD = $(SOFTWARE_16_DDRAW_LIBADD) - -endif -endif - -EXTRA_DIST = evas_engine.h diff --git a/legacy/evas/src/modules/engines/software_16_ddraw/evas_ddraw_buffer.cpp b/legacy/evas/src/modules/engines/software_16_ddraw/evas_ddraw_buffer.cpp deleted file mode 100644 index 7a0a8b7cf4..0000000000 --- a/legacy/evas/src/modules/engines/software_16_ddraw/evas_ddraw_buffer.cpp +++ /dev/null @@ -1,87 +0,0 @@ -#include "evas_common.h" -#include "evas_engine.h" - - -DDraw_Output_Buffer * -evas_software_ddraw_output_buffer_new(HWND window, - LPDIRECTDRAW object, - LPDIRECTDRAWSURFACE surface_primary, - LPDIRECTDRAWSURFACE surface_back, - LPDIRECTDRAWSURFACE surface_source, - int width, - int height) -{ - DDSURFACEDESC surface_desc; - DDraw_Output_Buffer *ddob; - - ddob = (DDraw_Output_Buffer *)calloc(1, sizeof(DDraw_Output_Buffer)); - if (!ddob) return NULL; - - ddob->dd.window = window; - ddob->dd.object = object; - ddob->dd.surface_primary = surface_primary; - ddob->dd.surface_back = surface_back; - ddob->dd.surface_source = surface_source; - ddob->width = width; - ddob->height = height; - ddob->pitch = width * 2; - - ZeroMemory(&surface_desc, sizeof(surface_desc)); - surface_desc.dwSize = sizeof(surface_desc); - - if (FAILED(ddob->dd.surface_source->Lock(NULL, - &surface_desc, - DDLOCK_WAIT | DDLOCK_SURFACEMEMORYPTR, - NULL))) - { - free(ddob); - return NULL; - } - - ddob->data = (DATA16 *)surface_desc.lpSurface; - - if (FAILED(ddob->dd.surface_source->Unlock(NULL))) - { - free(ddob); - return NULL; - } - if (ddob->im) - evas_cache_image_drop(&ddob->im->cache_entry); - - ddob->im = (Soft16_Image *) evas_cache_image_data(evas_common_soft16_image_cache_get(), width, height, (DATA32 *) ddob->data, 0, EVAS_COLORSPACE_RGB565_A5P); - if (ddob->im) - ddob->im->stride = ddob->pitch; - - return ddob; -} - -void -evas_software_ddraw_output_buffer_free(DDraw_Output_Buffer *ddob, int sync) -{ - free(ddob); -} - -void -evas_software_ddraw_output_buffer_paste(DDraw_Output_Buffer *ddob) -{ - RECT dst_rect; - RECT src_rect; - POINT p; - - SetRect(&src_rect, 0, 0, ddob->width, ddob->height); - - if (FAILED(ddob->dd.surface_back->BltFast(0, 0, - ddob->dd.surface_source, - &src_rect, - DDBLTFAST_NOCOLORKEY | DDBLTFAST_WAIT))) - return; - - p.x = 0; - p.y = 0; - ClientToScreen(ddob->dd.window, &p); - GetClientRect(ddob->dd.window, &dst_rect); - OffsetRect(&dst_rect, p.x, p.y); - ddob->dd.surface_primary->Blt(&dst_rect, - ddob->dd.surface_back, &src_rect, - DDBLT_WAIT, NULL); -} diff --git a/legacy/evas/src/modules/engines/software_16_ddraw/evas_ddraw_main.cpp b/legacy/evas/src/modules/engines/software_16_ddraw/evas_ddraw_main.cpp deleted file mode 100644 index 7a2eb7f367..0000000000 --- a/legacy/evas/src/modules/engines/software_16_ddraw/evas_ddraw_main.cpp +++ /dev/null @@ -1,71 +0,0 @@ -#include "evas_engine.h" - - -void * -evas_software_ddraw_lock(DDraw_Output_Buffer *ddob, int *ddraw_width, int *ddraw_height, int *ddraw_pitch, int *ddraw_depth) -{ - DDSURFACEDESC surface_desc; - - ZeroMemory(&surface_desc, sizeof(surface_desc)); - surface_desc.dwSize = sizeof(surface_desc); - - if (FAILED(ddob->dd.surface_back->Lock(NULL, - &surface_desc, - DDLOCK_WAIT | DDLOCK_SURFACEMEMORYPTR | DDLOCK_WRITEONLY, - NULL))) - return NULL; - - *ddraw_width = surface_desc.dwWidth; - *ddraw_height = surface_desc.dwHeight; - *ddraw_pitch = surface_desc.lPitch; - *ddraw_depth = surface_desc.ddpfPixelFormat.dwRGBBitCount >> 3; - - return surface_desc.lpSurface; -} - -void -evas_software_ddraw_unlock_and_flip(DDraw_Output_Buffer *ddob) -{ - RECT dst_rect; - RECT src_rect; - POINT p; - - if (FAILED(ddob->dd.surface_back->Unlock(NULL))) - return; - - /* we figure out where on the primary surface our window lives */ - p.x = 0; - p.y = 0; - ClientToScreen(ddob->dd.window, &p); - GetClientRect(ddob->dd.window, &dst_rect); - OffsetRect(&dst_rect, p.x, p.y); - SetRect(&src_rect, 0, 0, ddob->width, ddob->height); - - /* nothing to do if the function fails, so we don't check the result */ - ddob->dd.surface_primary->BltFast(0, 0, - ddob->dd.surface_back, &dst_rect, - DDBLTFAST_WAIT || DDBLTFAST_NOCOLORKEY); -} - -void -evas_software_ddraw_surface_resize(DDraw_Output_Buffer *ddob) -{ - DDSURFACEDESC surface_desc; - - ddob->dd.surface_back->Release(); - memset (&surface_desc, 0, sizeof (surface_desc)); - surface_desc.dwSize = sizeof (surface_desc); - /* FIXME: that code does not compile. Must know why */ -#if 0 - surface_desc.dwFlags = DDSD_HEIGHT | DDSD_WIDTH; - surface_desc.dwWidth = width; - surface_desc.dwHeight = height; - IDirectDrawSurface7_SetSurfaceDesc(ddob->dd.surface_back, &surface_desc, NULL); -#else - surface_desc.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH; - surface_desc.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN; - surface_desc.dwWidth = ddob->width; - surface_desc.dwHeight = ddob->height; - ddob->dd.object->CreateSurface(&surface_desc, &ddob->dd.surface_back, NULL); -#endif -} diff --git a/legacy/evas/src/modules/engines/software_16_ddraw/evas_engine.c b/legacy/evas/src/modules/engines/software_16_ddraw/evas_engine.c deleted file mode 100644 index 96297811e6..0000000000 --- a/legacy/evas/src/modules/engines/software_16_ddraw/evas_engine.c +++ /dev/null @@ -1,628 +0,0 @@ -#include "evas_common.h" -#include "evas_private.h" -#include "evas_engine.h" -#include "Evas_Engine_Software_16_DDraw.h" -#include "evas_common_soft16.h" - -int _evas_engine_soft16_ddraw_log_dom = -1; -/* function tables - filled in later (func and parent func) */ -static Evas_Func func, pfunc; - -/* engine struct data */ -typedef struct _Render_Engine Render_Engine; - -struct _Render_Engine -{ - HWND window; - LPDIRECTDRAW object; - LPDIRECTDRAWSURFACE surface_primary; - LPDIRECTDRAWSURFACE surface_back; - LPDIRECTDRAWSURFACE surface_source; - int width; - int height; - int rotation; - Tilebuf *tb; - Tilebuf_Rect *rects; - Tilebuf_Rect *cur_rect; - DDraw_Output_Buffer *ddob; - Soft16_Image *tmp_out; /* used by indirect render, like rotation */ - HRGN clip_rects; - unsigned char end : 1; -}; - -/* prototypes we will use here */ - -static void *eng_info(Evas *e); -static void eng_info_free(Evas *e, void *info); -static int eng_setup(Evas *e, void *info); -static void eng_output_free(void *data); -static void eng_output_resize(void *data, int w, int h); -static void eng_output_tile_size_set(void *data, int w, int h); -static void eng_output_redraws_rect_add(void *data, int x, int y, int w, int h); -static void eng_output_redraws_rect_del(void *data, int x, int y, int w, int h); -static void eng_output_redraws_clear(void *data); -static void *eng_output_redraws_next_update_get(void *data, int *x, int *y, int *w, int *h, int *cx, int *cy, int *cw, int *ch); -static void eng_output_redraws_next_update_push(void *data, void *surface, int x, int y, int w, int h); -static void eng_output_flush(void *data); -static void eng_output_idle_flush(void *data); - -/* engine api this module provides */ -static void * -eng_info(Evas *e) -{ - Evas_Engine_Info_Software_16_DDraw *info; - info = calloc(1, sizeof(Evas_Engine_Info_Software_16_DDraw)); - if (!info) return NULL; - info->magic.magic = rand(); - info->render_mode = EVAS_RENDER_MODE_BLOCKING; - return info; - e = NULL; -} - -static void -eng_info_free(Evas *e, void *info) -{ - Evas_Engine_Info_Software_16_DDraw *in; - in = (Evas_Engine_Info_Software_16_DDraw *)info; - free(in); -} - -static void -_tmp_out_alloc(Render_Engine *re) -{ - Tilebuf_Rect *r; - int w = 0, h = 0; - - EINA_INLIST_FOREACH(re->rects, r) - { - if (r->w > w) w = r->w; - if (r->h > h) h = r->h; - } - - if (re->tmp_out) - { - if ((re->tmp_out->cache_entry.w < w) || (re->tmp_out->cache_entry.h < h)) - { - evas_cache_image_drop(&re->tmp_out->cache_entry); - re->tmp_out = NULL; - } - } - - if (!re->tmp_out) - { - Soft16_Image *im; - - im = (Soft16_Image *) evas_cache_image_empty(evas_common_soft16_image_cache_get()); - im->cache_entry.flags.alpha = 0; - evas_cache_image_surface_alloc(&im->cache_entry, w, h); - - re->tmp_out = im; - } -} - - -static int -eng_setup(Evas *e, void *in) -{ - Render_Engine *re; - Evas_Engine_Info_Software_16_DDraw *info; - - info = (Evas_Engine_Info_Software_16_DDraw *)in; - if (!e->engine.data.output) - { - /* the only check - simplistic, i know, but enough for this - * "special purpose" engine. Remember it is meant to be used - * for limited power devices that have a 16bit display mode - * and no real other acceleration, and high resolution so we - * can pre-dither into 16bpp. */ - if (info->info.depth != 16) - return 0; - /* do common routine init - we wil at least use it for core - * image loading and font loading/glyph rendering & placement */ - 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(); - evas_common_soft16_image_init(); - - /* render engine specific data */ - re = calloc(1, sizeof(Render_Engine)); - if (!re) - return 0; - e->engine.data.output = re; - re->window = info->info.window; - re->object = info->info.object; - re->surface_primary = info->info.surface_primary; - re->surface_back = info->info.surface_back; - re->surface_source = info->info.surface_source; - re->width = e->output.w; - re->height = e->output.h; - re->rotation = info->info.rotation; - re->tb = evas_common_tilebuf_new(e->output.w, e->output.h); - if (re->tb) - evas_common_tilebuf_set_tile_size(re->tb, TILESIZE, TILESIZE); - } - else - { - /* we changed the info after first init - do a re-eval where - * appropriate */ - if (info->info.depth != 16) - return 0; - re = e->engine.data.output; - if (re->tb) evas_common_tilebuf_free(re->tb); - re->window = info->info.window; - re->object = info->info.object; - re->surface_primary = info->info.surface_primary; - re->surface_back = info->info.surface_back; - re->surface_source = info->info.surface_source; - re->width = e->output.w; - re->height = e->output.h; - re->rotation = info->info.rotation; - re->tb = evas_common_tilebuf_new(e->output.w, e->output.h); - if (re->tb) - evas_common_tilebuf_set_tile_size(re->tb, TILESIZE, TILESIZE); - if (re->tmp_out) - { - evas_cache_image_drop(&re->tmp_out->cache_entry); - re->tmp_out = NULL; - } - } - if (!e->engine.data.output) return 0; - /* add a draw context if we dont have one */ - if (!e->engine.data.context) - e->engine.data.context = - e->engine.func->context_new(e->engine.data.output); - - return 1; -} - -static void -eng_output_free(void *data) -{ - Render_Engine *re; - - re = (Render_Engine *)data; - if (re->ddob) evas_software_ddraw_output_buffer_free(re->ddob, 0); - if (re->clip_rects) DeleteObject(re->clip_rects); - if (re->tb) evas_common_tilebuf_free(re->tb); - if (re->rects) evas_common_tilebuf_free_render_rects(re->rects); - if (re->tmp_out) evas_cache_image_drop(&re->tmp_out->cache_entry); - free(re); - - evas_common_font_shutdown(); - evas_common_image_shutdown(); - evas_common_soft16_image_shutdown(); -} - -static void -eng_output_resize(void *data, int w, int h) -{ - Render_Engine *re; - - re = (Render_Engine *)data; - - if ((re->width == w) && (re->height == h)) return; - - if (re->ddob) - evas_software_ddraw_surface_resize(re->ddob); - - evas_common_tilebuf_free(re->tb); - re->width = w; - re->height = h; - re->tb = evas_common_tilebuf_new(w, h); - if (re->tb) - evas_common_tilebuf_set_tile_size(re->tb, TILESIZE, TILESIZE); - if (re->ddob) - { - evas_software_ddraw_output_buffer_free(re->ddob, 0); - re->ddob = NULL; - } - if (re->clip_rects) - { - DeleteObject(re->clip_rects); - re->clip_rects = NULL; - } - if (re->tmp_out) - { - evas_cache_image_drop(&re->tmp_out->cache_entry); - re->tmp_out = NULL; - } -} - -static void -eng_output_tile_size_set(void *data, int w, int h) -{ - Render_Engine *re; - - re = (Render_Engine *)data; - evas_common_tilebuf_set_tile_size(re->tb, w, h); -} - -static void -eng_output_redraws_rect_add(void *data, int x, int y, int w, int h) -{ - Render_Engine *re; - - re = (Render_Engine *)data; - evas_common_tilebuf_add_redraw(re->tb, x, y, w, h); -} - -static void -eng_output_redraws_rect_del(void *data, int x, int y, int w, int h) -{ - Render_Engine *re; - - re = (Render_Engine *)data; - evas_common_tilebuf_del_redraw(re->tb, x, y, w, h); -} - -static void -eng_output_redraws_clear(void *data) -{ - Render_Engine *re; - - re = (Render_Engine *)data; - evas_common_tilebuf_clear(re->tb); -} - -static inline void -_output_buffer_alloc(Render_Engine *re) -{ - int width; - int height; - - if (re->ddob) return; - - if ((re->rotation == 0) || (re->rotation == 180)) - { - width = re->width; - height = re->height; - } - else - { - width = re->height; - height = re->width; - } - - re->ddob = evas_software_ddraw_output_buffer_new(re->window, - re->object, - re->surface_primary, - re->surface_back, - re->surface_source, - width, - height); -} - -static void * -eng_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; - Tilebuf_Rect *rect; - int ux, uy, uw, uh; - - re = (Render_Engine *)data; - if (re->end) - { - re->end = 0; - return NULL; - } - if (!re->rects) - { - re->rects = evas_common_tilebuf_get_render_rects(re->tb); - if (!re->rects) return NULL; - - re->cur_rect = re->rects; - _output_buffer_alloc(re); - if (re->rotation != 0) _tmp_out_alloc(re); /* grows if required */ - } - if (!re->cur_rect) - { - if (re->rects) evas_common_tilebuf_free_render_rects(re->rects); - re->rects = NULL; - return NULL; - } - rect = re->cur_rect; - ux = rect->x; uy = rect->y; uw = rect->w; uh = rect->h; - re->cur_rect = (Tilebuf_Rect *)((EINA_INLIST_GET(re->cur_rect))->next); - if (!re->cur_rect) - { - evas_common_tilebuf_free_render_rects(re->rects); - re->rects = NULL; - re->end = 1; - } - - *x = ux; *y = uy; *w = uw; *h = uh; - if (re->rotation == 0) - { - *cx = ux; *cy = uy; *cw = uw; *ch = uh; - return &re->ddob->im; - } - else - { - *cx = 0; *cy = 0; *cw = uw; *ch = uh; - return re->tmp_out; - } -} - -static void -_blit_rot_90(Soft16_Image *dst, const Soft16_Image *src, - int out_x, int out_y, int w, int h) -{ - DATA16 *dp, *sp; - int x, y; - - sp = src->pixels; - dp = dst->pixels + (out_x + - (w + out_y - 1) * dst->stride); - - for (y = 0; y < h; y++) - { - DATA16 *dp_itr, *sp_itr; - - sp_itr = sp; - dp_itr = dp; - - for (x = 0; x < w; x++) - { - *dp_itr = *sp_itr; - - sp_itr++; - dp_itr -= dst->stride; - } - sp += src->stride; - dp++; - } -} - -static void -_blit_rot_180(Soft16_Image *dst, const Soft16_Image *src, - int out_x, int out_y, int w, int h) -{ - DATA16 *dp, *sp; - int x, y; - - sp = src->pixels; - dp = dst->pixels + ((w + out_x - 1) + - (h + out_y - 1) * dst->stride); - - for (y = 0; y < h; y++) - { - DATA16 *dp_itr, *sp_itr; - - sp_itr = sp; - dp_itr = dp; - - for (x = 0; x < w; x++) - { - *dp_itr = *sp_itr; - - sp_itr++; - dp_itr--; - } - sp += src->stride; - dp -= dst->stride; - } -} - -static void -_blit_rot_270(Soft16_Image *dst, const Soft16_Image *src, - int out_x, int out_y, int w, int h) -{ - DATA16 *dp, *sp; - int x, y; - - sp = src->pixels; - dp = dst->pixels + ((h + out_x - 1) + - out_y * dst->stride); - - for (y = 0; y < h; y++) - { - DATA16 *dp_itr, *sp_itr; - - sp_itr = sp; - dp_itr = dp; - - for (x = 0; x < w; x++) - { - *dp_itr = *sp_itr; - - sp_itr++; - dp_itr += dst->stride; - } - sp += src->stride; - dp--; - } -} - -static void -_tmp_out_process(Render_Engine *re, int out_x, int out_y, int w, int h) -{ - Soft16_Image *d, *s; - - d = &re->ddob->im; - s = re->tmp_out; - - if ((w < 1) || (h < 1) || (out_x >= d->cache_entry.w) || (out_y >= d->cache_entry.h)) - return; - - if (re->rotation == 90) - _blit_rot_90(d, s, out_x, out_y, w, h); - else if (re->rotation == 180) - _blit_rot_180(d, s, out_x, out_y, w, h); - else if (re->rotation == 270) - _blit_rot_270(d, s, out_x, out_y, w, h); -} - -static void -eng_output_redraws_next_update_push(void *data, void *surface, int x, int y, int w, int h) -{ - Render_Engine *re; - HRGN region; - int xx; - int yy; - int width; - int height; - - re = (Render_Engine *)data; - - if (!re->clip_rects) - re->clip_rects = CreateRectRgn(0, 0, 0, 0); - - if (re->rotation == 0) - { - xx = x; - yy = y; - width = w; - height = h; - } - else if (re->rotation == 90) - { - xx = y; - yy = re->width - w - x; - width = h; - height = w; - } - else if (re->rotation == 180) - { - xx = re->width - w - x; - yy = re->height - h - y; - width = w; - height = h; - } - else if (re->rotation == 270) - { - xx = re->height - h - y; - yy = x; - width = h; - height = w; - } - - region = CreateRectRgn(xx, yy, xx + width, yy + height); - - if (re->rotation != 0) - _tmp_out_process(re, xx, yy, w, h); - CombineRgn(re->clip_rects, re->clip_rects, region, RGN_OR); -} - -static void -eng_output_flush(void *data) -{ - Render_Engine *re; - void *ddraw_data; - int ddraw_width; - int ddraw_height; - int ddraw_pitch; - int ddraw_depth; - - re = (Render_Engine *)data; - if (re->clip_rects) - { - /* FIXME : i have to manage that */ -/* XSetRegion(re->disp, re->gc, re->clip_rects); */ - DeleteObject(re->clip_rects); - re->clip_rects = NULL; - } - else return; - - evas_software_ddraw_output_buffer_paste(re->ddob); - - /* FIXME : i have to manage that */ -/* XSetClipMask(re->disp, re->gc, None); */ -} - -static void -eng_output_idle_flush(void *data) -{ - Render_Engine *re; - - re = (Render_Engine *)data; - if (re->ddob) - { - evas_software_ddraw_output_buffer_free(re->ddob, 0); - re->ddob = NULL; - } - if (re->clip_rects) - { - DeleteObject(re->clip_rects); - re->clip_rects = NULL; - } - if (re->tmp_out) - { - evas_cache_image_drop(&re->tmp_out->cache_entry); - re->tmp_out = NULL; - } -} - -static Eina_Bool -eng_canvas_alpha_get(void *data, void *context) -{ - return EINA_FALSE; -} - -/* module advertising code */ -static int -module_open(Evas_Module *em) -{ - if (!em) return 0; - /* get whatever engine module we inherit from */ - if (!_evas_module_engine_inherit(&pfunc, "software_16")) return 0; - _evas_engine_soft16_ddraw_log_dom = eina_log_domain_register - ("evas-software_16_ddraw", EVAS_DEFAULT_LOG_COLOR); - if (_evas_engine_soft16_ddraw_log_dom < 0) - { - EINA_LOG_ERR("Can not create a module log domain."); - return 0; - } - /* store it for later use */ - func = pfunc; - /* now to override methods */ -#define ORD(f) EVAS_API_OVERRIDE(f, &func, eng_) - 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); - /* now advertise out own api */ - em->functions = (void *)(&func); - return 1; -} - -static void -module_close(Evas_Module *em) -{ - eina_log_domain_unregister(_evas_engine_soft16_ddraw_log_dom); -} - -static Evas_Module_Api evas_modapi = -{ - EVAS_MODULE_API_VERSION, - "software_16_ddraw", - "none", - { - module_open, - module_close - } -}; - -EVAS_MODULE_DEFINE(EVAS_MODULE_TYPE_ENGINE, engine, software_16_ddraw); - -#ifndef EVAS_STATIC_BUILD_SOFTWARE_16_DDRAW -EVAS_EINA_MODULE_DEFINE(engine, software_16_ddraw); -#endif diff --git a/legacy/evas/src/modules/engines/software_16_ddraw/evas_engine.h b/legacy/evas/src/modules/engines/software_16_ddraw/evas_engine.h deleted file mode 100644 index fe85e97ab2..0000000000 --- a/legacy/evas/src/modules/engines/software_16_ddraw/evas_engine.h +++ /dev/null @@ -1,85 +0,0 @@ -#ifndef __EVAS_ENGINE_H__ -#define __EVAS_ENGINE_H__ - -#include -#include - -#include "evas_common_soft16.h" - -extern int _evas_engine_soft16_ddraw_log_dom ; -#ifdef ERR -# undef ERR -#endif -#define ERR(...) EINA_LOG_DOM_ERR(_evas_engine_soft16_ddraw_log_dom, __VA_ARGS__) - -#ifdef DBG -# undef DBG -#endif -#define DBG(...) EINA_LOG_DOM_DBG(_evas_engine_soft16_ddraw_log_dom, __VA_ARGS__) - -#ifdef INF -# undef INF -#endif -#define INF(...) EINA_LOG_DOM_INFO(_evas_engine_soft16_ddraw_log_dom, __VA_ARGS__) - -#ifdef WRN -# undef WRN -#endif -#define WRN(...) EINA_LOG_DOM_WARN(_evas_engine_soft16_ddraw_log_dom, __VA_ARGS__) - -#ifdef CRIT -# undef CRIT -#endif -#define CRIT(...) EINA_LOG_DOM_CRIT(_evas_engine_soft16_ddraw_log_dom, __VA_ARGS__) - -typedef struct _DDraw_Output_Buffer DDraw_Output_Buffer; - -struct _DDraw_Output_Buffer -{ - Soft16_Image *im; - struct { - HWND window; - LPDIRECTDRAW object; - LPDIRECTDRAWSURFACE surface_primary; - LPDIRECTDRAWSURFACE surface_back; - LPDIRECTDRAWSURFACE surface_source; - } dd; - void *data; - int x; - int y; - int width; - int height; - int depth; - int pitch; -}; - -/****/ - -#ifdef __cplusplus -extern "C" { -#endif - - -DDraw_Output_Buffer *evas_software_ddraw_output_buffer_new (HWND window, - LPDIRECTDRAW object, - LPDIRECTDRAWSURFACE surface_primary, - LPDIRECTDRAWSURFACE surface_back, - LPDIRECTDRAWSURFACE surface_source, - int width, - int height); -void evas_software_ddraw_output_buffer_free (DDraw_Output_Buffer *ddob, int sync); -void evas_software_ddraw_output_buffer_paste (DDraw_Output_Buffer *ddob); - - -void *evas_software_ddraw_lock(DDraw_Output_Buffer *ddob, int *ddraw_width, int *ddraw_height, int *ddraw_pitch, int *ddraw_depth); - -void evas_software_ddraw_unlock_and_flip(DDraw_Output_Buffer *ddob); - -void evas_software_ddraw_surface_resize(DDraw_Output_Buffer *ddob); - - -#ifdef __cplusplus -} -#endif - -#endif /* __EVAS_ENGINE_H__ */