mirror of
https://github.com/narzoul/DDrawCompat
synced 2024-12-30 08:55:36 +01:00
Fixed blitting with a window clipper when the window region is empty
Fixes invisible menu buttons after alt-tabbing in Red Alert 2 (issue #262).
This commit is contained in:
parent
bc88dd2e92
commit
f36a255ac9
@ -53,11 +53,16 @@ namespace
|
||||
}
|
||||
|
||||
DWORD rgnSize = GetRegionData(rgn, 0, nullptr);
|
||||
std::vector<unsigned char> rgnData(rgnSize);
|
||||
GetRegionData(rgn, rgnSize, reinterpret_cast<RGNDATA*>(rgnData.data()));
|
||||
std::vector<unsigned char> rgnDataBuf(std::max<DWORD>(rgnSize, sizeof(RGNDATA)));
|
||||
RGNDATA* rgnData = reinterpret_cast<RGNDATA*>(rgnDataBuf.data());
|
||||
GetRegionData(rgn, rgnSize, rgnData);
|
||||
if (0 == rgnData->rdh.nCount)
|
||||
{
|
||||
rgnData->rdh.nCount = 1;
|
||||
}
|
||||
|
||||
clipper->SetHWnd(&clipper, 0, nullptr);
|
||||
clipper->SetClipList(&clipper, rgnData.empty() ? nullptr : reinterpret_cast<RGNDATA*>(rgnData.data()), 0);
|
||||
clipper->SetClipList(&clipper, rgnData, 0);
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE GetHWnd(IDirectDrawClipper* This, HWND* lphWnd)
|
||||
@ -199,13 +204,9 @@ namespace DDraw
|
||||
|
||||
void update()
|
||||
{
|
||||
if (g_isInvalidated)
|
||||
for (auto& clipperData : g_clipperData)
|
||||
{
|
||||
g_isInvalidated = false;
|
||||
for (auto& clipperData : g_clipperData)
|
||||
{
|
||||
updateWindowClipList(*clipperData.first, clipperData.second);
|
||||
}
|
||||
updateWindowClipList(*clipperData.first, clipperData.second);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -372,7 +372,8 @@ namespace
|
||||
|
||||
int WINAPI getRandomRgn(HDC hdc, HRGN hrgn, INT i)
|
||||
{
|
||||
return Gdi::Window::getRandomRgn(hdc, hrgn, i);
|
||||
LOG_FUNC("GetRandomRgn", hdc, hrgn, i);
|
||||
return LOG_RESULT(Gdi::Window::getRandomRgn(hdc, hrgn, i));
|
||||
}
|
||||
|
||||
LONG getWindowLong(HWND hWnd, int nIndex,
|
||||
|
Loading…
x
Reference in New Issue
Block a user