mirror of
https://github.com/isledecomp/isle-portable.git
synced 2025-09-22 11:31:57 -04:00
Use DDBLT_COLORFILL to clear screen on start (#487)
This commit is contained in:
parent
822e037d40
commit
d74e6ab401
@ -170,39 +170,16 @@ BOOL MxDirect3D::D3DSetMode()
|
|||||||
LPDIRECTDRAWSURFACE frontBuffer = FrontBuffer();
|
LPDIRECTDRAWSURFACE frontBuffer = FrontBuffer();
|
||||||
LPDIRECTDRAWSURFACE backBuffer = BackBuffer();
|
LPDIRECTDRAWSURFACE backBuffer = BackBuffer();
|
||||||
|
|
||||||
DDSURFACEDESC desc;
|
DDBLTFX ddBltFx = {};
|
||||||
memset(&desc, 0, sizeof(desc));
|
ddBltFx.dwSize = sizeof(DDBLTFX);
|
||||||
desc.dwSize = sizeof(desc);
|
ddBltFx.dwFillColor = 0;
|
||||||
|
|
||||||
if (backBuffer->Lock(NULL, &desc, DDLOCK_WAIT | DDLOCK_WRITEONLY, NULL) == DD_OK) {
|
if (backBuffer->Blt(NULL, NULL, NULL, DDBLT_WAIT | DDBLT_COLORFILL, &ddBltFx) != DD_OK) {
|
||||||
unsigned char* surface = (unsigned char*) desc.lpSurface;
|
SDL_Log("MxDirect3D::D3DSetMode() color fill failed\n");
|
||||||
|
|
||||||
for (int i = 0; i < mode.height; i++) {
|
|
||||||
memset(surface, 0, desc.lPitch);
|
|
||||||
surface += desc.lPitch;
|
|
||||||
}
|
|
||||||
|
|
||||||
backBuffer->Unlock(desc.lpSurface);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
SDL_Log("MxDirect3D::D3DSetMode() back lock failed\n");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IsFullScreen()) {
|
if (IsFullScreen()) {
|
||||||
memset(&desc, 0, sizeof(desc));
|
if (frontBuffer->Blt(NULL, NULL, NULL, DDBLT_WAIT | DDBLT_COLORFILL, &ddBltFx) != DD_OK) {
|
||||||
desc.dwSize = sizeof(desc);
|
|
||||||
|
|
||||||
if (frontBuffer->Lock(NULL, &desc, DDLOCK_WAIT | DDLOCK_WRITEONLY, NULL) == DD_OK) {
|
|
||||||
unsigned char* surface = (unsigned char*) desc.lpSurface;
|
|
||||||
|
|
||||||
for (int i = 0; i < mode.height; i++) {
|
|
||||||
memset(surface, 0, desc.lPitch);
|
|
||||||
surface += desc.lPitch;
|
|
||||||
}
|
|
||||||
|
|
||||||
frontBuffer->Unlock(desc.lpSurface);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
SDL_Log("MxDirect3D::D3DSetMode() front lock failed\n");
|
SDL_Log("MxDirect3D::D3DSetMode() front lock failed\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -64,8 +64,6 @@ void MxDisplaySurface::ClearScreen()
|
|||||||
MxS32 width = m_videoParam.GetRect().GetWidth();
|
MxS32 width = m_videoParam.GetRect().GetWidth();
|
||||||
MxS32 height = m_videoParam.GetRect().GetHeight();
|
MxS32 height = m_videoParam.GetRect().GetHeight();
|
||||||
|
|
||||||
RECT rc = {0, 0, width, height};
|
|
||||||
|
|
||||||
memset(&desc, 0, sizeof(desc));
|
memset(&desc, 0, sizeof(desc));
|
||||||
desc.dwSize = sizeof(desc);
|
desc.dwSize = sizeof(desc);
|
||||||
if (m_ddSurface2->GetSurfaceDesc(&desc) != DD_OK) {
|
if (m_ddSurface2->GetSurfaceDesc(&desc) != DD_OK) {
|
||||||
@ -77,9 +75,9 @@ void MxDisplaySurface::ClearScreen()
|
|||||||
ddBltFx.dwFillColor = 0;
|
ddBltFx.dwFillColor = 0;
|
||||||
|
|
||||||
for (MxS32 i = 0; i < backBuffers; i++) {
|
for (MxS32 i = 0; i < backBuffers; i++) {
|
||||||
if (m_ddSurface2->Blt(&rc, NULL, NULL, DDBLT_COLORFILL | DDBLT_WAIT, &ddBltFx) == DDERR_SURFACELOST) {
|
if (m_ddSurface2->Blt(NULL, NULL, NULL, DDBLT_COLORFILL | DDBLT_WAIT, &ddBltFx) == DDERR_SURFACELOST) {
|
||||||
m_ddSurface2->Restore();
|
m_ddSurface2->Restore();
|
||||||
m_ddSurface2->Blt(&rc, NULL, NULL, DDBLT_COLORFILL | DDBLT_WAIT, &ddBltFx);
|
m_ddSurface2->Blt(NULL, NULL, NULL, DDBLT_COLORFILL | DDBLT_WAIT, &ddBltFx);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_videoParam.Flags().GetFlipSurfaces()) {
|
if (m_videoParam.Flags().GetFlipSurfaces()) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user