mirror of
https://github.com/narzoul/DDrawCompat
synced 2024-12-30 08:55:36 +01:00
Removed unnecessary GDI redraws when GDI emulation is disabled
This commit is contained in:
parent
e774564467
commit
111719eaf7
@ -130,7 +130,7 @@ namespace CompatGdi
|
||||
|
||||
bool beginGdiRendering()
|
||||
{
|
||||
if (!RealPrimarySurface::isFullScreen())
|
||||
if (!isEmulationEnabled())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@ -233,11 +233,24 @@ namespace CompatGdi
|
||||
|
||||
void invalidate(const RECT* rect)
|
||||
{
|
||||
EnumWindows(&invalidateWindow, reinterpret_cast<LPARAM>(rect));
|
||||
if (isEmulationEnabled())
|
||||
{
|
||||
EnumWindows(&invalidateWindow, reinterpret_cast<LPARAM>(rect));
|
||||
}
|
||||
}
|
||||
|
||||
bool isEmulationEnabled()
|
||||
{
|
||||
return RealPrimarySurface::isFullScreen();
|
||||
}
|
||||
|
||||
void updatePalette(DWORD startingEntry, DWORD count)
|
||||
{
|
||||
if (!isEmulationEnabled())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Compat::ScopedCriticalSection gdiLock(g_gdiCriticalSection);
|
||||
CompatGdiDcCache::clear();
|
||||
|
||||
|
@ -12,6 +12,7 @@ namespace CompatGdi
|
||||
void hookWndProc(LPCSTR className, WNDPROC &oldWndProc, WNDPROC newWndProc);
|
||||
void installHooks();
|
||||
void invalidate(const RECT* rect);
|
||||
bool isEmulationEnabled();
|
||||
void updatePalette(DWORD startingEntry, DWORD count);
|
||||
|
||||
extern CRITICAL_SECTION g_gdiCriticalSection;
|
||||
|
@ -5,7 +5,6 @@
|
||||
#include "CompatGdiDcFunctions.h"
|
||||
#include "DDrawLog.h"
|
||||
#include "Hook.h"
|
||||
#include "RealPrimarySurface.h"
|
||||
|
||||
namespace
|
||||
{
|
||||
@ -77,9 +76,9 @@ namespace
|
||||
{
|
||||
Compat::Log() << "Skipping redirection since there is no display DC argument";
|
||||
}
|
||||
else if (!RealPrimarySurface::isFullScreen())
|
||||
else if (!CompatGdi::isEmulationEnabled())
|
||||
{
|
||||
Compat::Log() << "Skipping redirection due to windowed mode";
|
||||
Compat::Log() << "Skipping redirection since GDI emulation is disabled";
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -58,6 +58,9 @@ namespace CompatGdiScrollFunctions
|
||||
|
||||
void updateScrolledWindow(HWND hwnd)
|
||||
{
|
||||
RedrawWindow(hwnd, nullptr, nullptr, RDW_ERASE | RDW_FRAME | RDW_INVALIDATE | RDW_NOCHILDREN);
|
||||
if (CompatGdi::isEmulationEnabled())
|
||||
{
|
||||
RedrawWindow(hwnd, nullptr, nullptr, RDW_ERASE | RDW_FRAME | RDW_INVALIDATE | RDW_NOCHILDREN);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -121,6 +121,11 @@ namespace
|
||||
|
||||
void onActivate(HWND hwnd)
|
||||
{
|
||||
if (!CompatGdi::isEmulationEnabled())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
RECT windowRect = {};
|
||||
GetWindowRect(hwnd, &windowRect);
|
||||
RECT clientRect = {};
|
||||
@ -139,6 +144,11 @@ namespace
|
||||
|
||||
void onMenuSelect()
|
||||
{
|
||||
if (!CompatGdi::isEmulationEnabled())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
HWND menuWindow = FindWindow(reinterpret_cast<LPCSTR>(0x8000), nullptr);
|
||||
while (menuWindow)
|
||||
{
|
||||
@ -159,8 +169,11 @@ namespace
|
||||
|
||||
if (IsWindowVisible(hwnd))
|
||||
{
|
||||
GetWindowRect(hwnd, it != g_prevWindowRect.end() ? &it->second : &g_prevWindowRect[hwnd]);
|
||||
RedrawWindow(hwnd, nullptr, nullptr, RDW_ERASE | RDW_FRAME | RDW_INVALIDATE | RDW_ALLCHILDREN);
|
||||
if (CompatGdi::isEmulationEnabled())
|
||||
{
|
||||
GetWindowRect(hwnd, it != g_prevWindowRect.end() ? &it->second : &g_prevWindowRect[hwnd]);
|
||||
RedrawWindow(hwnd, nullptr, nullptr, RDW_ERASE | RDW_FRAME | RDW_INVALIDATE | RDW_ALLCHILDREN);
|
||||
}
|
||||
}
|
||||
else if (it != g_prevWindowRect.end())
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user