From 4a8b13ea4f8e5111390471c9212d10d4d032e837 Mon Sep 17 00:00:00 2001 From: Vaxry Date: Fri, 21 Jun 2024 19:25:34 +0200 Subject: [PATCH] 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 --- src/render/Renderer.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/render/Renderer.cpp b/src/render/Renderer.cpp index b783ab81..4fc751ff 100644 --- a/src/render/Renderer.cpp +++ b/src/render/Renderer.cpp @@ -2451,9 +2451,14 @@ void CHyprRenderer::setOccludedForMainWorkspace(CRegion& region, PHLWORKSPACE pW } 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("decoration:blur:enabled"); + static auto PBLURSIZE = CConfigValue("decoration:blur:size"); + static auto PBLURPASSES = CConfigValue("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) { 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}; - box.scale(PMONITOR->scale); + box.scale(PMONITOR->scale).expand(-BLURRADIUS); + g_pHyprOpenGL->m_RenderData.renderModif.applyToBox(box); rg.add(box);