* request the size in the engine info

* add a ressource file that set the video management
   as non legacy. It forces device that are in vga to
   run in vga and not in qvga with gapi
 * use c++ calls to display error messages in evas_wince_ddraw.cpp.
   It removes a problem during linking with some versions of cegcc
 * minor fixing / formatting


SVN revision: 35148
This commit is contained in:
doursse 2008-07-17 23:08:29 +00:00 committed by doursse
parent 2ab5747a80
commit 92a8967501
7 changed files with 126 additions and 43 deletions

View File

@ -15,6 +15,8 @@ struct _Evas_Engine_Info_Software_16_WinCE
struct {
HWND window;
int width;
int height;
int backend; /* 0: auto, 1: raw, 2: gapi, 3: ddraw */
int rotation;
} info;

View File

@ -9,6 +9,9 @@ AM_CPPFLAGS = \
-I$(top_srcdir)/src/modules/engines/software_16 \
@FREETYPE_CFLAGS@
.rc.lo:
$(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --tag=RC --mode=compile $(RC) $(RCFLAGS) $< -o $@
if BUILD_ENGINE_SOFTWARE_16_WINCE
pkgdir = $(libdir)/evas/modules/engines/software_16_wince/$(MODULE_ARCH)
@ -20,7 +23,8 @@ evas_engine.h \
evas_engine.c \
evas_wince_fb_buffer.c \
evas_wince_gapi_buffer.c \
evas_wince_ddraw_buffer.cpp
evas_wince_ddraw_buffer.cpp \
evas_wince_gapi.rc
module_la_CFLAGS = @WIN32_CFLAGS@
module_la_LIBADD = $(top_builddir)/src/lib/libevas.la

View File

@ -136,7 +136,6 @@ _tmp_out_alloc(Render_Engine *re)
im->cache_entry.flags.alpha = 0;
evas_cache_image_surface_alloc(&im->cache_entry, w, h);
re->tmp_out = im;
}
}
@ -178,7 +177,7 @@ eng_setup(Evas *e, void *in)
{
case 1: /* FB */
re->backend = EVAS_ENGINE_WINCE_FB;
re->backend_priv = evas_software_wince_fb_init(info->info.window);
re->backend_priv = evas_software_wince_fb_init(info->info.window, info->info.width, info->info.height);
if (!re->backend_priv)
{
free(re);
@ -192,7 +191,7 @@ eng_setup(Evas *e, void *in)
break;
case 2: /* GAPI */
re->backend = EVAS_ENGINE_WINCE_GAPI;
re->backend_priv = evas_software_wince_gapi_init(info->info.window);
re->backend_priv = evas_software_wince_gapi_init(info->info.window, info->info.width, info->info.height);
if (!re->backend_priv)
{
free(re);
@ -206,7 +205,7 @@ eng_setup(Evas *e, void *in)
break;
case 3: /* DirectDraw */
re->backend = EVAS_ENGINE_WINCE_DDRAW;
re->backend_priv = evas_software_wince_ddraw_init(info->info.window);
re->backend_priv = evas_software_wince_ddraw_init(info->info.window, info->info.width, info->info.height);
if (!re->backend_priv)
{
free(re);
@ -239,7 +238,7 @@ eng_setup(Evas *e, void *in)
{
case 1: /* FB */
re->backend = EVAS_ENGINE_WINCE_FB;
re->backend_priv = evas_software_wince_fb_init(info->info.window);
re->backend_priv = evas_software_wince_fb_init(info->info.window, info->info.width, info->info.height);
if (!re->backend_priv)
{
free(re);
@ -253,7 +252,7 @@ eng_setup(Evas *e, void *in)
break;
case 2: /* GAPI */
re->backend = EVAS_ENGINE_WINCE_GAPI;
re->backend_priv = evas_software_wince_gapi_init(info->info.window);
re->backend_priv = evas_software_wince_gapi_init(info->info.window, info->info.width, info->info.height);
if (!re->backend_priv)
{
free(re);
@ -267,7 +266,7 @@ eng_setup(Evas *e, void *in)
break;
case 3: /* DirectDraw */
re->backend = EVAS_ENGINE_WINCE_DDRAW;
re->backend_priv = evas_software_wince_ddraw_init(info->info.window);
re->backend_priv = evas_software_wince_ddraw_init(info->info.window, info->info.width, info->info.height);
if (!re->backend_priv)
{
free(re);

View File

@ -2,7 +2,9 @@
#define __EVAS_ENGINE_H__
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#undef WIN32_LEAN_AND_MEAN
#include "evas_common_soft16.h"
@ -18,7 +20,9 @@ struct _FB_Output_Buffer
/* Raw FrameBuffer */
void *evas_software_wince_fb_init (HWND window);
void *evas_software_wince_fb_init (HWND window,
int width,
int height);
FB_Output_Buffer *evas_software_wince_fb_output_buffer_new (void *priv,
int width,
int height);
@ -31,10 +35,12 @@ void evas_software_wince_fb_surface_resize(FB_Output_Buffer *fbob);
/* GAPI */
void *evas_software_wince_gapi_init (HWND window);
void *evas_software_wince_gapi_init (HWND window,
int width,
int height);
FB_Output_Buffer *evas_software_wince_gapi_output_buffer_new (void *priv,
int width,
int height);
int width,
int height);
void evas_software_wince_gapi_shutdown(void *priv);
void evas_software_wince_gapi_output_buffer_free (FB_Output_Buffer *fbob);
void evas_software_wince_gapi_output_buffer_paste (FB_Output_Buffer *fbob);
@ -53,10 +59,12 @@ extern "C" {
#endif
void *evas_software_wince_ddraw_init (HWND window);
void *evas_software_wince_ddraw_init (HWND window,
int width,
int height);
FB_Output_Buffer *evas_software_wince_ddraw_output_buffer_new (void *priv,
int width,
int height);
int width,
int height);
void evas_software_wince_ddraw_shutdown(void *priv);
void evas_software_wince_ddraw_output_buffer_free (FB_Output_Buffer *fbob);
void evas_software_wince_ddraw_output_buffer_paste (FB_Output_Buffer *fbob);

View File

@ -1,3 +1,9 @@
#include <iostream>
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#undef WIN32_LEAN_AND_MEAN
#include <ddraw.h>
#include "evas_common.h"
@ -21,7 +27,9 @@ struct Evas_Engine_WinCE_DDraw_Priv
};
void *
evas_software_wince_ddraw_init (HWND window)
evas_software_wince_ddraw_init(HWND window,
int width,
int height)
{
DDSURFACEDESC surface_desc;
Evas_Engine_WinCE_DDraw_Priv *priv;
@ -34,28 +42,28 @@ evas_software_wince_ddraw_init (HWND window)
priv->module = LoadLibrary(L"ddraw.dll");
if (!priv->module)
{
fprintf (stderr, "[Evas] [Engine] [WinCE DDraw] Can not load ddraw.dll\n");
std::cerr << "[Evas] [Engine] [WinCE DDraw] Can not load ddraw.dll" << std::endl;
goto free_priv;
}
lib_DirectDrawCreate = (fct_DirectDrawCreate)GetProcAddress(priv->module, L"DirectDrawCreate");
if (!lib_DirectDrawCreate)
{
fprintf (stderr, "[Evas] [Engine] [WinCE DDraw] Can not initialize DirectDraw\n");
std::cerr << "[Evas] [Engine] [WinCE DDraw] Can not initialize DirectDraw" << std::endl;
goto free_lib;
}
res = lib_DirectDrawCreate(NULL, (IUnknown**)&priv->object, NULL);
if (FAILED(res))
{
fprintf (stderr, "[Evas] [Engine] [WinCE DDraw] Can not create DirectDraw object\n");
std::cerr << "[Evas] [Engine] [WinCE DDraw] Can not create DirectDraw object" << std::endl;
goto free_lib;
}
res = priv->object->SetCooperativeLevel(window, DDSCL_FULLSCREEN);
res = priv->object->SetCooperativeLevel(window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN);
if (FAILED(res))
{
fprintf (stderr, "[Evas] [Engine] [WinCE DDraw] Can not set window to fullscreen\n");
std::cerr<< "[Evas] [Engine] [WinCE DDraw] Can not set window to fullscreen" << std::endl;
goto release_object;
}
@ -67,16 +75,16 @@ evas_software_wince_ddraw_init (HWND window)
res = priv->object->CreateSurface(&surface_desc, &priv->surface, NULL);
if (FAILED(res))
{
fprintf (stderr, "[Evas] [Engine] [WinCE DDraw] Can not create surface\n");
std::cerr << "[Evas] [Engine] [WinCE DDraw] Can not create surface" << std::endl;
goto release_object;
}
memset(&surface_desc, 0, sizeof(surface_desc));
surface_desc.dwSize = sizeof(surface_desc);
res = priv->surface->Lock(0, &surface_desc, DDLOCK_WAITNOTBUSY, 0);
res = priv->surface->Lock(NULL, &surface_desc, DDLOCK_READONLY, NULL);
if (FAILED(res))
{
fprintf (stderr, "[Evas] [Engine] [WinCE DDraw] Can not lock surface\n");
std::cerr << "[Evas] [Engine] [WinCE DDraw] Can not lock surface" << std::endl;
goto release_surface;
}
@ -84,10 +92,19 @@ evas_software_wince_ddraw_init (HWND window)
priv->height = surface_desc.dwHeight;
priv->stride = surface_desc.lPitch / 2;
if ((priv->width != width) ||
(priv->height != height))
{
std::cerr << "[Evas] [Engine] [WinCE DDraw] Size mismatch" << std::endl;
std::cerr << "[Evas] [Engine] [WinCE DDraw] asked: " << width << "x" << height << std::endl;
std::cerr << "[Evas] [Engine] [WinCE DDraw] got : " << priv->width << "x" << priv->height << std::endl;
goto release_surface;
}
res = priv->surface->Unlock(NULL);
if (FAILED(res))
{
fprintf (stderr, "[Evas] [Engine] [WinCE DDraw] Can not unlock surface\n");
std::cerr << "[Evas] [Engine] [WinCE DDraw] Can not unlock surface" << std::endl;
goto release_surface;
}
@ -160,7 +177,7 @@ evas_software_wince_ddraw_output_buffer_paste(FB_Output_Buffer *fbob)
memset(&surface_desc, 0, sizeof(surface_desc));
surface_desc.dwSize = sizeof(surface_desc);
res = priv->surface->Lock(0, &surface_desc, DDLOCK_WAITNOTBUSY, 0);
res = priv->surface->Lock(NULL, &surface_desc, DDLOCK_WRITEONLY, NULL);
if (FAILED(res))
return;

View File

@ -40,8 +40,32 @@ struct Evas_Engine_WinCE_FB_Priv
void *buffer;
};
static int
_evas_software_wince_gxinfo_init(HDC dc, int *width, int *height, void **buffer)
{
GXDeviceInfo gxInfo = { 0 };
int result;
gxInfo.Version = 100;
result = ExtEscape(dc, GETGXINFO, 0, NULL, sizeof(gxInfo),
(char *) &gxInfo);
if (result <= 0)
{
fprintf (stderr, "[Evas] [Engine] [WinCE FB] ExtEscape() with GETGXINFO failed\n");
return 0;
}
*width = gxInfo.cyHeight;
*height = gxInfo.cxWidth;
*buffer = gxInfo.pvFrameBuffer;
return 1;
}
void *
evas_software_wince_fb_init (HWND window)
evas_software_wince_fb_init(HWND window,
int width,
int height)
{
WCHAR oemstr[100];
RawFrameBufferInfo rfbi;
@ -68,23 +92,23 @@ evas_software_wince_fb_init (HWND window)
(oemstr[13] == '3') &&
(oemstr[14] == '9')))
{
GXDeviceInfo gxInfo = { 0 };
int result;
gxInfo.Version = 100;
result = ExtEscape(dc, GETGXINFO, 0, NULL, sizeof(gxInfo),
(char *) &gxInfo);
if (result <= 0)
if (!_evas_software_wince_gxinfo_init(dc, &priv->width, &priv->height, &priv->buffer))
{
fprintf (stderr, "[Evas] [Engine] [WinCE FB] [Ipaq] ExtEscape() failed\n");
ReleaseDC(window, dc);
free(priv);
return NULL;
}
priv->width = gxInfo.cyHeight;
priv->height = gxInfo.cxWidth;
priv->buffer = gxInfo.pvFrameBuffer;
if ((priv->width != width) ||
(priv->height != height))
{
fprintf (stderr, "[Evas] [Engine] [WinCE FB] Size mismatch\n");
fprintf (stderr, "[Evas] [Engine] [WinCE FB] asked: %dx%d\n", width, height);
fprintf (stderr, "[Evas] [Engine] [WinCE FB] got : %dx%d\n", priv->width, priv->height);
ReleaseDC(window, dc);
free(priv);
return NULL;
}
ReleaseDC(window, dc);
@ -95,16 +119,34 @@ evas_software_wince_fb_init (HWND window)
(rfbi.wBPP != 16) ||
(rfbi.wFormat != 1))
{
fprintf (stderr, "[Evas] [Engine] [WinCE FB] ExtEscape() failed\n");
fprintf (stderr, "[Evas] [Engine] [WinCE FB] ExtEscape() with GETRAWFRAMEBUFFER failed\n");
fprintf (stderr, "[Evas] [Engine] [WinCE FB] trying ExtEscape() with GETGXINFO\n");
if (!_evas_software_wince_gxinfo_init(dc, &priv->width, &priv->height, &priv->buffer))
{
ReleaseDC(window, dc);
free(priv);
return NULL;
}
ReleaseDC(window, dc);
free(priv);
return NULL;
return priv;
}
priv->width = rfbi.cxPixels;
priv->height = rfbi.cyPixels;
priv->buffer = rfbi.pFramePointer;
if ((priv->width != width) ||
(priv->height != height))
{
fprintf (stderr, "[Evas] [Engine] [WinCE FB] Size mismatch\n");
fprintf (stderr, "[Evas] [Engine] [WinCE FB] asked: %dx%d\n", width, height);
fprintf (stderr, "[Evas] [Engine] [WinCE FB] got : %dx%d\n", priv->width, priv->height);
ReleaseDC(window, dc);
free(priv);
return NULL;
}
ReleaseDC(window, dc);
return priv;

View File

@ -85,9 +85,11 @@ struct Evas_Engine_WinCE_GAPI_Priv
};
void *
evas_software_wince_gapi_init (HWND window)
evas_software_wince_gapi_init(HWND window,
int width,
int height)
{
WCHAR oemstr[100];
WCHAR oemstr[100];
_GAPI_Display_Properties prop;
HMODULE gapi_lib;
Evas_Engine_WinCE_GAPI_Priv *priv;
@ -244,6 +246,15 @@ v | |
priv->buffer = NULL;
}
if ((priv->width != width) ||
(priv->height != height))
{
fprintf (stderr, "[Evas] [Engine] [WinCE GAPI] Size mismatch\n");
fprintf (stderr, "[Evas] [Engine] [WinCE GAPI] asked: %dx%d\n", width, height);
fprintf (stderr, "[Evas] [Engine] [WinCE GAPI] got : %dx%d\n", priv->width, priv->height);
goto close_display;
}
return priv;
close_display: