render/decoration: cache input extents as well

This commit is contained in:
Vaxry 2026-04-04 19:07:39 +01:00 committed by Vaxry
parent d170a627b5
commit 9b05dc1b4c
2 changed files with 12 additions and 14 deletions

View file

@ -358,21 +358,18 @@ SBoxExtents CDecorationPositioner::computeWindowDecorationExtents(PHLWINDOWREF p
}
SBoxExtents CDecorationPositioner::getWindowDecorationExtents(PHLWINDOWREF pWindow, bool inputOnly) {
// inputOnly is rare (input handling), skip the cache for it
if (inputOnly)
return computeWindowDecorationExtents(pWindow, true);
const auto WIT = std::ranges::find_if(m_windowDatas, [&](const auto& other) { return other.first.lock() == pWindow; });
if (WIT == m_windowDatas.end())
return computeWindowDecorationExtents(pWindow, false);
return computeWindowDecorationExtents(pWindow, inputOnly);
auto& wd = WIT->second;
if (wd.needsDamageExtents) {
wd.decorationExtents = computeWindowDecorationExtents(pWindow, false);
wd.needsDamageExtents = false;
wd.decorationExtents = computeWindowDecorationExtents(pWindow, false);
wd.decorationInputExtents = computeWindowDecorationExtents(pWindow, true);
wd.needsDamageExtents = false;
}
return wd.decorationExtents;
return inputOnly ? wd.decorationInputExtents : wd.decorationExtents;
}
CBox CDecorationPositioner::getBoxWithIncludedDecos(PHLWINDOW pWindow) {

View file

@ -80,12 +80,13 @@ class CDecorationPositioner {
};
struct SWindowData {
Vector2D lastWindowSize = {};
SBoxExtents reserved = {};
SBoxExtents extents = {};
SBoxExtents decorationExtents = {};
bool needsRecalc = false;
bool needsDamageExtents = true;
Vector2D lastWindowSize = {};
SBoxExtents reserved = {};
SBoxExtents extents = {};
SBoxExtents decorationExtents = {};
SBoxExtents decorationInputExtents = {};
bool needsRecalc = false;
bool needsDamageExtents = true;
};
std::map<PHLWINDOWREF, SWindowData> m_windowDatas;