mirror of
https://github.com/reactos/reactos.git
synced 2025-08-07 03:33:02 +00:00
Clean up NtGdiDdCreateDirectDrawObject and confirm it working.
1. Fix create hdc when it is NULL that is need to get ms windows xp d3dx.dll working in ReactOS, if some want try it. svn path=/trunk/; revision=23073
This commit is contained in:
parent
d16a694b91
commit
fc29d1edf0
1 changed files with 19 additions and 22 deletions
|
@ -12,6 +12,7 @@
|
||||||
|
|
||||||
#define NDEBUG
|
#define NDEBUG
|
||||||
#include <debug.h>
|
#include <debug.h>
|
||||||
|
GDIDEVICE IntGetPrimarySurface(VOID);
|
||||||
|
|
||||||
/* swtich this off to get rid of all dx debug msg */
|
/* swtich this off to get rid of all dx debug msg */
|
||||||
#define DX_DEBUG
|
#define DX_DEBUG
|
||||||
|
@ -19,6 +20,8 @@
|
||||||
#define DdHandleTable GdiHandleTable
|
#define DdHandleTable GdiHandleTable
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/************************************************************************/
|
/************************************************************************/
|
||||||
/* DIRECT DRAW OBJECT */
|
/* DIRECT DRAW OBJECT */
|
||||||
/************************************************************************/
|
/************************************************************************/
|
||||||
|
@ -55,9 +58,8 @@ HANDLE STDCALL NtGdiDdCreateDirectDrawObject(
|
||||||
BOOL success;
|
BOOL success;
|
||||||
HANDLE hDirectDraw;
|
HANDLE hDirectDraw;
|
||||||
PDD_DIRECTDRAW pDirectDraw;
|
PDD_DIRECTDRAW pDirectDraw;
|
||||||
#ifdef DX_DEBUG
|
|
||||||
DPRINT1("NtGdiDdCreateDirectDrawObject\n");
|
DPRINT1("NtGdiDdCreateDirectDrawObject\n");
|
||||||
#endif
|
|
||||||
|
|
||||||
RtlZeroMemory(&callbacks, sizeof(DD_CALLBACKS));
|
RtlZeroMemory(&callbacks, sizeof(DD_CALLBACKS));
|
||||||
callbacks.dwSize = sizeof(DD_CALLBACKS);
|
callbacks.dwSize = sizeof(DD_CALLBACKS);
|
||||||
|
@ -70,29 +72,30 @@ HANDLE STDCALL NtGdiDdCreateDirectDrawObject(
|
||||||
/* we need create it, if in that case */
|
/* we need create it, if in that case */
|
||||||
if (hdc == NULL)
|
if (hdc == NULL)
|
||||||
{
|
{
|
||||||
|
DPRINT1("FIXME hdc is NULL \n");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
pDC = DC_LockDc(hdc);
|
pDC = DC_LockDc(hdc);
|
||||||
if (!pDC)
|
if (!pDC)
|
||||||
return NULL;
|
|
||||||
|
|
||||||
if (!pDC->DriverFunctions.EnableDirectDraw)
|
|
||||||
{
|
{
|
||||||
// Driver doesn't support DirectDraw
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pDC->DriverFunctions.EnableDirectDraw == NULL)
|
||||||
|
{
|
||||||
|
/* Driver doesn't support DirectDraw */
|
||||||
DC_UnlockDc(pDC);
|
DC_UnlockDc(pDC);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
success = pDC->DriverFunctions.EnableDirectDraw(
|
success = pDC->DriverFunctions.EnableDirectDraw(
|
||||||
pDC->PDev, &callbacks, &surface_callbacks, &palette_callbacks);
|
pDC->PDev, &callbacks, &surface_callbacks, &palette_callbacks);
|
||||||
|
|
||||||
if (!success)
|
if (!success)
|
||||||
{
|
{
|
||||||
#ifdef DX_DEBUG
|
|
||||||
DPRINT1("DirectDraw creation failed\n");
|
DPRINT1("DirectDraw creation failed\n");
|
||||||
#endif
|
/* DirectDraw creation failed */
|
||||||
// DirectDraw creation failed
|
|
||||||
DC_UnlockDc(pDC);
|
DC_UnlockDc(pDC);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -101,9 +104,6 @@ HANDLE STDCALL NtGdiDdCreateDirectDrawObject(
|
||||||
if (!hDirectDraw)
|
if (!hDirectDraw)
|
||||||
{
|
{
|
||||||
/* No more memmory */
|
/* No more memmory */
|
||||||
#ifdef DX_DEBUG
|
|
||||||
DPRINT1("No more memmory\n");
|
|
||||||
#endif
|
|
||||||
DC_UnlockDc(pDC);
|
DC_UnlockDc(pDC);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -112,14 +112,10 @@ HANDLE STDCALL NtGdiDdCreateDirectDrawObject(
|
||||||
if (!pDirectDraw)
|
if (!pDirectDraw)
|
||||||
{
|
{
|
||||||
/* invalid handle */
|
/* invalid handle */
|
||||||
#ifdef DX_DEBUG
|
|
||||||
DPRINT1("invalid handle\n");
|
|
||||||
#endif
|
|
||||||
DC_UnlockDc(pDC);
|
DC_UnlockDc(pDC);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
pDirectDraw->Global.dhpdev = pDC->PDev;
|
pDirectDraw->Global.dhpdev = pDC->PDev;
|
||||||
pDirectDraw->Local.lpGbl = &pDirectDraw->Global;
|
pDirectDraw->Local.lpGbl = &pDirectDraw->Global;
|
||||||
|
|
||||||
|
@ -133,11 +129,12 @@ HANDLE STDCALL NtGdiDdCreateDirectDrawObject(
|
||||||
RtlMoveMemory(&pDirectDraw->Surf, &surface_callbacks, sizeof(DD_SURFACECALLBACKS));
|
RtlMoveMemory(&pDirectDraw->Surf, &surface_callbacks, sizeof(DD_SURFACECALLBACKS));
|
||||||
|
|
||||||
/* DD_PALETTECALLBACKS setup*/
|
/* DD_PALETTECALLBACKS setup*/
|
||||||
RtlMoveMemory(&pDirectDraw->Pal, &surface_callbacks, sizeof(DD_PALETTECALLBACKS));
|
RtlMoveMemory(&pDirectDraw->Pal, &palette_callbacks, sizeof(DD_PALETTECALLBACKS));
|
||||||
|
|
||||||
GDIOBJ_UnlockObjByPtr(DdHandleTable, pDirectDraw);
|
GDIOBJ_UnlockObjByPtr(DdHandleTable, pDirectDraw);
|
||||||
DC_UnlockDc(pDC);
|
DC_UnlockDc(pDC);
|
||||||
|
|
||||||
|
DPRINT1("DirectDraw return handler\n");
|
||||||
return hDirectDraw;
|
return hDirectDraw;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue