mirror of
https://github.com/isledecomp/isle-portable.git
synced 2025-09-24 04:26:55 -04:00
Yet another clearscreen ported to use COLORFILL (#508)
This commit is contained in:
parent
1ae9933bd5
commit
e2eda71883
@ -172,7 +172,7 @@ BOOL MxDirect3D::D3DSetMode()
|
|||||||
|
|
||||||
DDBLTFX ddBltFx = {};
|
DDBLTFX ddBltFx = {};
|
||||||
ddBltFx.dwSize = sizeof(DDBLTFX);
|
ddBltFx.dwSize = sizeof(DDBLTFX);
|
||||||
ddBltFx.dwFillColor = 0;
|
ddBltFx.dwFillColor = 0xFF000000;
|
||||||
|
|
||||||
if (backBuffer->Blt(NULL, NULL, NULL, DDBLT_WAIT | DDBLT_COLORFILL, &ddBltFx) != DD_OK) {
|
if (backBuffer->Blt(NULL, NULL, NULL, DDBLT_WAIT | DDBLT_COLORFILL, &ddBltFx) != DD_OK) {
|
||||||
SDL_Log("MxDirect3D::D3DSetMode() color fill failed\n");
|
SDL_Log("MxDirect3D::D3DSetMode() color fill failed\n");
|
||||||
|
@ -519,14 +519,12 @@ BOOL MxDirectDraw::DDCreateSurfaces()
|
|||||||
void MxDirectDraw::ClearBackBuffers()
|
void MxDirectDraw::ClearBackBuffers()
|
||||||
{
|
{
|
||||||
HRESULT result;
|
HRESULT result;
|
||||||
DDBLTFX ddbltfx;
|
DDBLTFX ddbltfx = {};
|
||||||
|
ddbltfx.dwSize = sizeof(DDBLTFX);
|
||||||
|
ddbltfx.dwFillColor = 0xFF000000;
|
||||||
int count = m_bFlipSurfaces ? 2 : 1;
|
int count = m_bFlipSurfaces ? 2 : 1;
|
||||||
|
|
||||||
for (int i = 0; i < count; i++) {
|
for (int i = 0; i < count; i++) {
|
||||||
memset(&ddbltfx, 0, sizeof(ddbltfx));
|
|
||||||
ddbltfx.dwSize = sizeof(ddbltfx);
|
|
||||||
ddbltfx.dwFillColor = 0;
|
|
||||||
|
|
||||||
result = m_pBackBuffer->Blt(NULL, NULL, NULL, DDBLT_COLORFILL | DDBLT_WAIT, &ddbltfx);
|
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();
|
||||||
|
@ -72,7 +72,7 @@ void MxDisplaySurface::ClearScreen()
|
|||||||
|
|
||||||
DDBLTFX ddBltFx = {};
|
DDBLTFX ddBltFx = {};
|
||||||
ddBltFx.dwSize = sizeof(DDBLTFX);
|
ddBltFx.dwSize = sizeof(DDBLTFX);
|
||||||
ddBltFx.dwFillColor = 0;
|
ddBltFx.dwFillColor = 0xFF000000;
|
||||||
|
|
||||||
for (MxS32 i = 0; i < backBuffers; i++) {
|
for (MxS32 i = 0; i < backBuffers; i++) {
|
||||||
if (m_ddSurface2->Blt(NULL, NULL, NULL, DDBLT_COLORFILL | DDBLT_WAIT, &ddBltFx) == DDERR_SURFACELOST) {
|
if (m_ddSurface2->Blt(NULL, NULL, NULL, DDBLT_COLORFILL | DDBLT_WAIT, &ddBltFx) == DDERR_SURFACELOST) {
|
||||||
@ -779,21 +779,11 @@ void MxDisplaySurface::Display(MxS32 p_left, MxS32 p_top, MxS32 p_left2, MxS32 p
|
|||||||
if (g_unk0x1010215c < 2) {
|
if (g_unk0x1010215c < 2) {
|
||||||
g_unk0x1010215c++;
|
g_unk0x1010215c++;
|
||||||
|
|
||||||
DDSURFACEDESC ddsd;
|
DDBLTFX ddbltfx = {};
|
||||||
memset(&ddsd, 0, sizeof(ddsd));
|
ddbltfx.dwSize = sizeof(ddbltfx);
|
||||||
ddsd.dwSize = sizeof(ddsd);
|
ddbltfx.dwFillColor = 0xFF000000;
|
||||||
if (m_ddSurface2->Lock(NULL, &ddsd, DDLOCK_WAIT | DDLOCK_WRITEONLY, NULL) == DD_OK) {
|
|
||||||
MxU8* surface = (MxU8*) ddsd.lpSurface;
|
|
||||||
MxS32 height = m_videoParam.GetRect().GetHeight();
|
|
||||||
|
|
||||||
for (MxU32 i = 0; i < ddsd.dwHeight; i++) {
|
if (m_ddSurface2->Blt(NULL, NULL, NULL, DDBLT_COLORFILL | DDBLT_WAIT, &ddbltfx) != DD_OK) {
|
||||||
memset(surface, 0, ddsd.lPitch);
|
|
||||||
surface += ddsd.lPitch;
|
|
||||||
}
|
|
||||||
|
|
||||||
m_ddSurface2->Unlock(ddsd.lpSurface);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "MxDisplaySurface::Display error\n");
|
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "MxDisplaySurface::Display error\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -812,7 +802,7 @@ void MxDisplaySurface::Display(MxS32 p_left, MxS32 p_top, MxS32 p_left2, MxS32 p
|
|||||||
DDBLTFX data;
|
DDBLTFX data;
|
||||||
memset(&data, 0, sizeof(data));
|
memset(&data, 0, sizeof(data));
|
||||||
data.dwSize = sizeof(data);
|
data.dwSize = sizeof(data);
|
||||||
data.dwDDFX = 8;
|
data.dwDDFX = DDBLTFX_NOTEARING;
|
||||||
|
|
||||||
if (m_ddSurface1->Blt((LPRECT) &b, m_ddSurface2, (LPRECT) &a, DDBLT_NONE, &data) == DDERR_SURFACELOST) {
|
if (m_ddSurface1->Blt((LPRECT) &b, m_ddSurface2, (LPRECT) &a, DDBLT_NONE, &data) == DDERR_SURFACELOST) {
|
||||||
m_ddSurface1->Restore();
|
m_ddSurface1->Restore();
|
||||||
|
@ -246,9 +246,13 @@ struct DDSCAPS {
|
|||||||
};
|
};
|
||||||
typedef struct DDSCAPS* LPDDSCAPS;
|
typedef struct DDSCAPS* LPDDSCAPS;
|
||||||
|
|
||||||
|
#define DDBLTFX_NOTEARING DDBLTFXFlags::NOTEARING
|
||||||
|
enum class DDBLTFXFlags : uint8_t {
|
||||||
|
NOTEARING = 1 << 3,
|
||||||
|
};
|
||||||
struct DDBLTFX {
|
struct DDBLTFX {
|
||||||
DWORD dwSize;
|
DWORD dwSize;
|
||||||
DWORD dwDDFX;
|
DDBLTFXFlags dwDDFX;
|
||||||
DWORD dwROP;
|
DWORD dwROP;
|
||||||
DWORD dwFillColor;
|
DWORD dwFillColor;
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user