renderer: shrink occlusion rect if blur is used

if we are blurring, we cannot be sure whether the occluded region won't be included in the expanded damage. If it is, we'd get dark shimmers.

fixes #6547
This commit is contained in:
Vaxry 2024-06-21 19:25:34 +02:00
parent 8cf2ca1966
commit 4a8b13ea4f

View file

@ -2451,9 +2451,14 @@ void CHyprRenderer::setOccludedForMainWorkspace(CRegion& region, PHLWORKSPACE pW
} }
void CHyprRenderer::setOccludedForBackLayers(CRegion& region, PHLWORKSPACE pWorkspace) { void CHyprRenderer::setOccludedForBackLayers(CRegion& region, PHLWORKSPACE pWorkspace) {
CRegion rg; CRegion rg;
const auto PMONITOR = g_pCompositor->getMonitorFromID(pWorkspace->m_iMonitorID); const auto PMONITOR = g_pCompositor->getMonitorFromID(pWorkspace->m_iMonitorID);
static auto PBLUR = CConfigValue<Hyprlang::INT>("decoration:blur:enabled");
static auto PBLURSIZE = CConfigValue<Hyprlang::INT>("decoration:blur:size");
static auto PBLURPASSES = CConfigValue<Hyprlang::INT>("decoration:blur:passes");
const auto BLURRADIUS = *PBLUR ? (*PBLURPASSES > 10 ? pow(2, 15) : std::clamp(*PBLURSIZE, (int64_t)1, (int64_t)40) * pow(2, *PBLURPASSES)) : 0;
for (auto& w : g_pCompositor->m_vWindows) { for (auto& w : g_pCompositor->m_vWindows) {
if (!w->m_bIsMapped || w->isHidden() || w->m_pWorkspace != pWorkspace) if (!w->m_bIsMapped || w->isHidden() || w->m_pWorkspace != pWorkspace)
@ -2468,7 +2473,8 @@ void CHyprRenderer::setOccludedForBackLayers(CRegion& region, PHLWORKSPACE pWork
CBox box = {POS.x, POS.y, SIZE.x, SIZE.y}; CBox box = {POS.x, POS.y, SIZE.x, SIZE.y};
box.scale(PMONITOR->scale); box.scale(PMONITOR->scale).expand(-BLURRADIUS);
g_pHyprOpenGL->m_RenderData.renderModif.applyToBox(box); g_pHyprOpenGL->m_RenderData.renderModif.applyToBox(box);
rg.add(box); rg.add(box);