mirror of
https://github.com/isledecomp/isle-portable.git
synced 2025-09-22 11:31:57 -04:00
Use DDBLT_COLORFILL to clear screen (#505)
This commit is contained in:
parent
0191be7461
commit
3868071fb8
@ -519,35 +519,25 @@ BOOL MxDirectDraw::DDCreateSurfaces()
|
|||||||
void MxDirectDraw::ClearBackBuffers()
|
void MxDirectDraw::ClearBackBuffers()
|
||||||
{
|
{
|
||||||
HRESULT result;
|
HRESULT result;
|
||||||
byte* line;
|
DDBLTFX ddbltfx;
|
||||||
DDSURFACEDESC ddsd;
|
|
||||||
int count = m_bFlipSurfaces ? 2 : 1;
|
int count = m_bFlipSurfaces ? 2 : 1;
|
||||||
int value = 0;
|
|
||||||
|
|
||||||
for (int i = 0; i < count; i++) {
|
for (int i = 0; i < count; i++) {
|
||||||
memset(&ddsd, 0, sizeof(ddsd));
|
memset(&ddbltfx, 0, sizeof(ddbltfx));
|
||||||
ddsd.dwSize = sizeof(ddsd);
|
ddbltfx.dwSize = sizeof(ddbltfx);
|
||||||
|
ddbltfx.dwFillColor = 0;
|
||||||
|
|
||||||
result = m_pBackBuffer->Lock(NULL, &ddsd, DDLOCK_WAIT | DDLOCK_WRITEONLY, NULL);
|
result = m_pBackBuffer->Blt(NULL, NULL, NULL, DDBLT_COLORFILL | DDBLT_WAIT, &ddbltfx);
|
||||||
if (result == DDERR_SURFACELOST) {
|
if (result == DDERR_SURFACELOST) {
|
||||||
m_pBackBuffer->Restore();
|
m_pBackBuffer->Restore();
|
||||||
result = m_pBackBuffer->Lock(NULL, &ddsd, DDLOCK_WAIT | DDLOCK_WRITEONLY, NULL);
|
result = m_pBackBuffer->Blt(NULL, NULL, NULL, DDBLT_COLORFILL | DDBLT_WAIT, &ddbltfx);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (result != DD_OK) {
|
if (result != DD_OK) {
|
||||||
// lock failed
|
// blt failed
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// clear backBuffer
|
|
||||||
line = (byte*) ddsd.lpSurface;
|
|
||||||
for (int j = ddsd.dwHeight; j--;) {
|
|
||||||
memset(line, value, ddsd.dwWidth);
|
|
||||||
line += ddsd.lPitch;
|
|
||||||
}
|
|
||||||
|
|
||||||
m_pBackBuffer->Unlock(ddsd.lpSurface);
|
|
||||||
|
|
||||||
if (m_bFlipSurfaces) {
|
if (m_bFlipSurfaces) {
|
||||||
m_pFrontBuffer->Flip(NULL, DDFLIP_WAIT);
|
m_pFrontBuffer->Flip(NULL, DDFLIP_WAIT);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user