forked from enlightenment/efl
remove the explicit use of the DirectDraw interface by using the c++ API
SVN revision: 34153
This commit is contained in:
parent
ebd938e4b1
commit
3ba03eab45
|
@ -18,8 +18,8 @@ pkg_LTLIBRARIES = module.la
|
||||||
module_la_SOURCES = \
|
module_la_SOURCES = \
|
||||||
evas_engine.h \
|
evas_engine.h \
|
||||||
evas_engine.c \
|
evas_engine.c \
|
||||||
evas_ddraw_buffer.c \
|
evas_ddraw_buffer.cpp \
|
||||||
evas_ddraw_main.c
|
evas_ddraw_main.cpp
|
||||||
|
|
||||||
module_la_LIBADD = @ddraw_16_libs@ $(top_builddir)/src/lib/libevas.la
|
module_la_LIBADD = @ddraw_16_libs@ $(top_builddir)/src/lib/libevas.la
|
||||||
module_la_LDFLAGS = @create_shared_lib@ -module -avoid-version
|
module_la_LDFLAGS = @create_shared_lib@ -module -avoid-version
|
||||||
|
@ -33,6 +33,6 @@ endif
|
||||||
EXTRA_DIST = \
|
EXTRA_DIST = \
|
||||||
evas_engine.h \
|
evas_engine.h \
|
||||||
evas_engine.c \
|
evas_engine.c \
|
||||||
evas_ddraw_buffer.c \
|
evas_ddraw_buffer.cpp \
|
||||||
evas_ddraw_main.c \
|
evas_ddraw_main.cpp \
|
||||||
Evas_Engine_Software_16_DDraw.h
|
Evas_Engine_Software_16_DDraw.h
|
||||||
|
|
|
@ -11,10 +11,10 @@ evas_software_ddraw_output_buffer_new(HWND window,
|
||||||
int width,
|
int width,
|
||||||
int height)
|
int height)
|
||||||
{
|
{
|
||||||
DDSURFACEDESC2 surface_desc;
|
DDSURFACEDESC surface_desc;
|
||||||
DDraw_Output_Buffer *ddob;
|
DDraw_Output_Buffer *ddob;
|
||||||
|
|
||||||
ddob = calloc(1, sizeof(DDraw_Output_Buffer));
|
ddob = (DDraw_Output_Buffer *)calloc(1, sizeof(DDraw_Output_Buffer));
|
||||||
if (!ddob) return NULL;
|
if (!ddob) return NULL;
|
||||||
|
|
||||||
ddob->dd.window = window;
|
ddob->dd.window = window;
|
||||||
|
@ -29,22 +29,22 @@ evas_software_ddraw_output_buffer_new(HWND window,
|
||||||
ZeroMemory(&surface_desc, sizeof(surface_desc));
|
ZeroMemory(&surface_desc, sizeof(surface_desc));
|
||||||
surface_desc.dwSize = sizeof(surface_desc);
|
surface_desc.dwSize = sizeof(surface_desc);
|
||||||
|
|
||||||
if (FAILED(IDirectDrawSurface7_Lock(ddob->dd.surface_source, NULL,
|
if (FAILED(ddob->dd.surface_source->Lock(NULL,
|
||||||
&surface_desc,
|
&surface_desc,
|
||||||
DDLOCK_WAIT | DDLOCK_SURFACEMEMORYPTR,
|
DDLOCK_WAIT | DDLOCK_SURFACEMEMORYPTR,
|
||||||
NULL)))
|
NULL)))
|
||||||
{
|
{
|
||||||
free(ddob);
|
free(ddob);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
ddob->im.pixels = surface_desc.lpSurface;
|
ddob->im.pixels = (DATA16 *)surface_desc.lpSurface;
|
||||||
ddob->im.w = width;
|
ddob->im.w = width;
|
||||||
ddob->im.h = height;
|
ddob->im.h = height;
|
||||||
ddob->im.stride = width;
|
ddob->im.stride = width;
|
||||||
ddob->im.references = 1;
|
ddob->im.references = 1;
|
||||||
|
|
||||||
if (FAILED(IDirectDrawSurface7_Unlock(ddob->dd.surface_source, NULL)))
|
if (FAILED(ddob->dd.surface_source->Unlock(NULL)))
|
||||||
{
|
{
|
||||||
free(ddob);
|
free(ddob);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -62,17 +62,16 @@ evas_software_ddraw_output_buffer_free(DDraw_Output_Buffer *ddob, int sync)
|
||||||
void
|
void
|
||||||
evas_software_ddraw_output_buffer_paste(DDraw_Output_Buffer *ddob)
|
evas_software_ddraw_output_buffer_paste(DDraw_Output_Buffer *ddob)
|
||||||
{
|
{
|
||||||
RECT dst_rect;
|
RECT dst_rect;
|
||||||
RECT src_rect;
|
RECT src_rect;
|
||||||
POINT p;
|
POINT p;
|
||||||
|
|
||||||
SetRect(&src_rect, 0, 0, ddob->width, ddob->height);
|
SetRect(&src_rect, 0, 0, ddob->width, ddob->height);
|
||||||
|
|
||||||
if (FAILED(IDirectDrawSurface7_BltFast(ddob->dd.surface_back,
|
if (FAILED(ddob->dd.surface_back->BltFast(0, 0,
|
||||||
0, 0,
|
ddob->dd.surface_source,
|
||||||
ddob->dd.surface_source,
|
&src_rect,
|
||||||
&src_rect,
|
DDBLTFAST_NOCOLORKEY | DDBLTFAST_WAIT)))
|
||||||
DDBLTFAST_NOCOLORKEY | DDBLTFAST_WAIT)))
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
p.x = 0;
|
p.x = 0;
|
||||||
|
@ -80,7 +79,7 @@ evas_software_ddraw_output_buffer_paste(DDraw_Output_Buffer *ddob)
|
||||||
ClientToScreen(ddob->dd.window, &p);
|
ClientToScreen(ddob->dd.window, &p);
|
||||||
GetClientRect(ddob->dd.window, &dst_rect);
|
GetClientRect(ddob->dd.window, &dst_rect);
|
||||||
OffsetRect(&dst_rect, p.x, p.y);
|
OffsetRect(&dst_rect, p.x, p.y);
|
||||||
IDirectDrawSurface7_Blt(ddob->dd.surface_primary, &dst_rect,
|
ddob->dd.surface_primary->Blt(&dst_rect,
|
||||||
ddob->dd.surface_back, &src_rect,
|
ddob->dd.surface_back, &src_rect,
|
||||||
DDBLT_WAIT, NULL);
|
DDBLT_WAIT, NULL);
|
||||||
}
|
}
|
|
@ -4,17 +4,15 @@
|
||||||
void *
|
void *
|
||||||
evas_software_ddraw_lock(DDraw_Output_Buffer *ddob, int *ddraw_width, int *ddraw_height, int *ddraw_pitch, int *ddraw_depth)
|
evas_software_ddraw_lock(DDraw_Output_Buffer *ddob, int *ddraw_width, int *ddraw_height, int *ddraw_pitch, int *ddraw_depth)
|
||||||
{
|
{
|
||||||
DDSURFACEDESC2 surface_desc;
|
DDSURFACEDESC surface_desc;
|
||||||
DDSURFACEDESC *sd;
|
|
||||||
|
|
||||||
ZeroMemory(&surface_desc, sizeof(surface_desc));
|
ZeroMemory(&surface_desc, sizeof(surface_desc));
|
||||||
surface_desc.dwSize = sizeof(surface_desc);
|
surface_desc.dwSize = sizeof(surface_desc);
|
||||||
|
|
||||||
sd = (DDSURFACEDESC *)&surface_desc;
|
if (FAILED(ddob->dd.surface_back->Lock(NULL,
|
||||||
if (FAILED(IDirectDrawSurface7_Lock(ddob->dd.surface_back, NULL,
|
&surface_desc,
|
||||||
sd,
|
DDLOCK_WAIT | DDLOCK_SURFACEMEMORYPTR | DDLOCK_WRITEONLY,
|
||||||
DDLOCK_WAIT | DDLOCK_SURFACEMEMORYPTR,
|
NULL)))
|
||||||
NULL)))
|
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
*ddraw_width = surface_desc.dwWidth;
|
*ddraw_width = surface_desc.dwWidth;
|
||||||
|
@ -32,7 +30,7 @@ evas_software_ddraw_unlock_and_flip(DDraw_Output_Buffer *ddob)
|
||||||
RECT src_rect;
|
RECT src_rect;
|
||||||
POINT p;
|
POINT p;
|
||||||
|
|
||||||
if (FAILED(IDirectDrawSurface7_Unlock(ddob->dd.surface_back, NULL)))
|
if (FAILED(ddob->dd.surface_back->Unlock(NULL)))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* we figure out where on the primary surface our window lives */
|
/* we figure out where on the primary surface our window lives */
|
||||||
|
@ -44,22 +42,17 @@ evas_software_ddraw_unlock_and_flip(DDraw_Output_Buffer *ddob)
|
||||||
SetRect(&src_rect, 0, 0, ddob->width, ddob->height);
|
SetRect(&src_rect, 0, 0, ddob->width, ddob->height);
|
||||||
|
|
||||||
/* nothing to do if the function fails, so we don't check the result */
|
/* nothing to do if the function fails, so we don't check the result */
|
||||||
IDirectDrawSurface7_BltFast(ddob->dd.surface_primary, 0, 0,
|
ddob->dd.surface_primary->BltFast(0, 0,
|
||||||
ddob->dd.surface_back, &dst_rect,
|
ddob->dd.surface_back, &dst_rect,
|
||||||
DDBLTFAST_WAIT || DDBLTFAST_NOCOLORKEY);
|
DDBLTFAST_WAIT || DDBLTFAST_NOCOLORKEY);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
evas_software_ddraw_surface_resize(DDraw_Output_Buffer *ddob)
|
evas_software_ddraw_surface_resize(DDraw_Output_Buffer *ddob)
|
||||||
{
|
{
|
||||||
DDSURFACEDESC2 surface_desc;
|
DDSURFACEDESC surface_desc;
|
||||||
DDSURFACEDESC2 *sd;
|
|
||||||
|
|
||||||
if (!ddob)
|
ddob->dd.surface_back->Release();
|
||||||
printf (" AIE AIE pas de ddob\n");
|
|
||||||
if (!ddob->dd.surface_back)
|
|
||||||
printf (" AIE AIE pas de surface_back\n");
|
|
||||||
IDirectDrawSurface7_Release(ddob->dd.surface_back);
|
|
||||||
memset (&surface_desc, 0, sizeof (surface_desc));
|
memset (&surface_desc, 0, sizeof (surface_desc));
|
||||||
surface_desc.dwSize = sizeof (surface_desc);
|
surface_desc.dwSize = sizeof (surface_desc);
|
||||||
/* FIXME: that code does not compile. Must know why */
|
/* FIXME: that code does not compile. Must know why */
|
||||||
|
@ -73,11 +66,6 @@ evas_software_ddraw_surface_resize(DDraw_Output_Buffer *ddob)
|
||||||
surface_desc.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN;
|
surface_desc.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN;
|
||||||
surface_desc.dwWidth = ddob->width;
|
surface_desc.dwWidth = ddob->width;
|
||||||
surface_desc.dwHeight = ddob->height;
|
surface_desc.dwHeight = ddob->height;
|
||||||
/* Hack to cleanly remove a warning */
|
ddob->dd.object->CreateSurface(&surface_desc, &ddob->dd.surface_back, NULL);
|
||||||
sd = &surface_desc;
|
|
||||||
IDirectDraw7_CreateSurface(ddob->dd.object,
|
|
||||||
(DDSURFACEDESC *)sd,
|
|
||||||
&ddob->dd.surface_back,
|
|
||||||
NULL);
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
|
@ -28,6 +28,12 @@ struct _DDraw_Output_Buffer
|
||||||
};
|
};
|
||||||
|
|
||||||
/****/
|
/****/
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
DDraw_Output_Buffer *evas_software_ddraw_output_buffer_new (HWND window,
|
DDraw_Output_Buffer *evas_software_ddraw_output_buffer_new (HWND window,
|
||||||
LPDIRECTDRAW object,
|
LPDIRECTDRAW object,
|
||||||
LPDIRECTDRAWSURFACE surface_primary,
|
LPDIRECTDRAWSURFACE surface_primary,
|
||||||
|
@ -45,4 +51,9 @@ void evas_software_ddraw_unlock_and_flip(DDraw_Output_Buffer *ddob);
|
||||||
|
|
||||||
void evas_software_ddraw_surface_resize(DDraw_Output_Buffer *ddob);
|
void evas_software_ddraw_surface_resize(DDraw_Output_Buffer *ddob);
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif /* __EVAS_ENGINE_H__ */
|
#endif /* __EVAS_ENGINE_H__ */
|
||||||
|
|
Loading…
Reference in New Issue