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()
|
bool beginGdiRendering()
|
||||||
{
|
{
|
||||||
if (!RealPrimarySurface::isFullScreen())
|
if (!isEmulationEnabled())
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -233,11 +233,24 @@ namespace CompatGdi
|
|||||||
|
|
||||||
void invalidate(const RECT* rect)
|
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)
|
void updatePalette(DWORD startingEntry, DWORD count)
|
||||||
{
|
{
|
||||||
|
if (!isEmulationEnabled())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Compat::ScopedCriticalSection gdiLock(g_gdiCriticalSection);
|
Compat::ScopedCriticalSection gdiLock(g_gdiCriticalSection);
|
||||||
CompatGdiDcCache::clear();
|
CompatGdiDcCache::clear();
|
||||||
|
|
||||||
|
@ -12,6 +12,7 @@ namespace CompatGdi
|
|||||||
void hookWndProc(LPCSTR className, WNDPROC &oldWndProc, WNDPROC newWndProc);
|
void hookWndProc(LPCSTR className, WNDPROC &oldWndProc, WNDPROC newWndProc);
|
||||||
void installHooks();
|
void installHooks();
|
||||||
void invalidate(const RECT* rect);
|
void invalidate(const RECT* rect);
|
||||||
|
bool isEmulationEnabled();
|
||||||
void updatePalette(DWORD startingEntry, DWORD count);
|
void updatePalette(DWORD startingEntry, DWORD count);
|
||||||
|
|
||||||
extern CRITICAL_SECTION g_gdiCriticalSection;
|
extern CRITICAL_SECTION g_gdiCriticalSection;
|
||||||
|
@ -5,7 +5,6 @@
|
|||||||
#include "CompatGdiDcFunctions.h"
|
#include "CompatGdiDcFunctions.h"
|
||||||
#include "DDrawLog.h"
|
#include "DDrawLog.h"
|
||||||
#include "Hook.h"
|
#include "Hook.h"
|
||||||
#include "RealPrimarySurface.h"
|
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
@ -77,9 +76,9 @@ namespace
|
|||||||
{
|
{
|
||||||
Compat::Log() << "Skipping redirection since there is no display DC argument";
|
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
|
else
|
||||||
{
|
{
|
||||||
|
@ -58,6 +58,9 @@ namespace CompatGdiScrollFunctions
|
|||||||
|
|
||||||
void updateScrolledWindow(HWND hwnd)
|
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)
|
void onActivate(HWND hwnd)
|
||||||
{
|
{
|
||||||
|
if (!CompatGdi::isEmulationEnabled())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
RECT windowRect = {};
|
RECT windowRect = {};
|
||||||
GetWindowRect(hwnd, &windowRect);
|
GetWindowRect(hwnd, &windowRect);
|
||||||
RECT clientRect = {};
|
RECT clientRect = {};
|
||||||
@ -139,6 +144,11 @@ namespace
|
|||||||
|
|
||||||
void onMenuSelect()
|
void onMenuSelect()
|
||||||
{
|
{
|
||||||
|
if (!CompatGdi::isEmulationEnabled())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
HWND menuWindow = FindWindow(reinterpret_cast<LPCSTR>(0x8000), nullptr);
|
HWND menuWindow = FindWindow(reinterpret_cast<LPCSTR>(0x8000), nullptr);
|
||||||
while (menuWindow)
|
while (menuWindow)
|
||||||
{
|
{
|
||||||
@ -159,8 +169,11 @@ namespace
|
|||||||
|
|
||||||
if (IsWindowVisible(hwnd))
|
if (IsWindowVisible(hwnd))
|
||||||
{
|
{
|
||||||
GetWindowRect(hwnd, it != g_prevWindowRect.end() ? &it->second : &g_prevWindowRect[hwnd]);
|
if (CompatGdi::isEmulationEnabled())
|
||||||
RedrawWindow(hwnd, nullptr, nullptr, RDW_ERASE | RDW_FRAME | RDW_INVALIDATE | RDW_ALLCHILDREN);
|
{
|
||||||
|
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())
|
else if (it != g_prevWindowRect.end())
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user