aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorvaxerski <[email protected]>2023-11-16 11:42:53 +0000
committervaxerski <[email protected]>2023-11-16 11:42:53 +0000
commit28ef18a92112d57a425839a1993a1191af2fb6f3 (patch)
treeae78338886d5205ea0ce6368004770250a93f09c
parent91d6be1f09a0c0eaf585e88d315a7e56cac315a3 (diff)
downloadHyprland-28ef18a92112d57a425839a1993a1191af2fb6f3.tar.gz
Hyprland-28ef18a92112d57a425839a1993a1191af2fb6f3.zip
shadow: avoid using glClear and don't draw behind window if ignore_window
fixes #3860
-rw-r--r--src/render/decorations/CHyprDropShadowDecoration.cpp13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/render/decorations/CHyprDropShadowDecoration.cpp b/src/render/decorations/CHyprDropShadowDecoration.cpp
index c992a4d8..7138dc20 100644
--- a/src/render/decorations/CHyprDropShadowDecoration.cpp
+++ b/src/render/decorations/CHyprDropShadowDecoration.cpp
@@ -126,12 +126,17 @@ void CHyprDropShadowDecoration::draw(CMonitor* pMonitor, float a, const Vector2D
if (windowBox.width < 1 || windowBox.height < 1)
return; // prevent assert failed
+ CRegion saveDamage = g_pHyprOpenGL->m_RenderData.damage;
+
+ g_pHyprOpenGL->m_RenderData.damage = fullBox;
+ g_pHyprOpenGL->m_RenderData.damage.subtract(windowBox.expand(-ROUNDING * pMonitor->scale)).intersect(saveDamage);
+
alphaFB.bind();
// build the matte
// 10-bit formats have dogshit alpha channels, so we have to use the matte to its fullest.
- // first, clear with black (fully transparent)
- g_pHyprOpenGL->clear(CColor(0, 0, 0, 1));
+ // first, clear region of interest with black (fully transparent)
+ g_pHyprOpenGL->renderRect(&fullBox, CColor(0, 0, 0, 1), 0);
// render white shadow with the alpha of the shadow color (otherwise we clear with alpha later and shit it to 2 bit)
g_pHyprOpenGL->renderRoundedShadow(&fullBox, ROUNDING * pMonitor->scale, *PSHADOWSIZE * pMonitor->scale, CColor(1, 1, 1, m_pWindow->m_cRealShadowColor.col().a), a);
@@ -142,7 +147,7 @@ void CHyprDropShadowDecoration::draw(CMonitor* pMonitor, float a, const Vector2D
alphaSwapFB.bind();
// alpha swap just has the shadow color. It will be the "texture" to render.
- g_pHyprOpenGL->clear(m_pWindow->m_cRealShadowColor.col().stripA());
+ g_pHyprOpenGL->renderRect(&fullBox, m_pWindow->m_cRealShadowColor.col().stripA(), 0);
LASTFB->bind();
@@ -150,6 +155,8 @@ void CHyprDropShadowDecoration::draw(CMonitor* pMonitor, float a, const Vector2D
g_pHyprOpenGL->setMonitorTransformEnabled(false);
g_pHyprOpenGL->renderTextureMatte(alphaSwapFB.m_cTex, &monbox, alphaFB);
g_pHyprOpenGL->setMonitorTransformEnabled(true);
+
+ g_pHyprOpenGL->m_RenderData.damage = saveDamage;
} else {
g_pHyprOpenGL->renderRoundedShadow(&fullBox, ROUNDING * pMonitor->scale, *PSHADOWSIZE * pMonitor->scale, a);
}