diff --git a/DDrawCompat/DDraw/DirectDrawClipper.cpp b/DDrawCompat/DDraw/DirectDrawClipper.cpp index 32b9f99..62ca0c2 100644 --- a/DDrawCompat/DDraw/DirectDrawClipper.cpp +++ b/DDrawCompat/DDraw/DirectDrawClipper.cpp @@ -53,11 +53,16 @@ namespace } DWORD rgnSize = GetRegionData(rgn, 0, nullptr); - std::vector rgnData(rgnSize); - GetRegionData(rgn, rgnSize, reinterpret_cast(rgnData.data())); + std::vector rgnDataBuf(std::max(rgnSize, sizeof(RGNDATA))); + RGNDATA* rgnData = reinterpret_cast(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.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); } } diff --git a/DDrawCompat/Gdi/WinProc.cpp b/DDrawCompat/Gdi/WinProc.cpp index e086305..393f0b7 100644 --- a/DDrawCompat/Gdi/WinProc.cpp +++ b/DDrawCompat/Gdi/WinProc.cpp @@ -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,