diff options
| author | Vaxry <vaxry@vaxry.net> | 2023-11-09 22:11:42 +0000 |
|---|---|---|
| committer | Vaxry <vaxry@vaxry.net> | 2023-11-09 22:11:54 +0000 |
| commit | 14195835ef1dd25e10b0d873ec75c004b238ccba (patch) | |
| tree | b7803f0d73d8d0aab85c0d7642437ae1d6f75473 /src/render/decorations/CHyprDropShadowDecoration.cpp | |
| parent | 11432f69b929b8f74d7b0a2b327cef1da2462535 (diff) | |
opengl: switch to black-and-white for alpha mattes
also fixes shadows on 10b
Diffstat (limited to 'src/render/decorations/CHyprDropShadowDecoration.cpp')
| -rw-r--r-- | src/render/decorations/CHyprDropShadowDecoration.cpp | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/src/render/decorations/CHyprDropShadowDecoration.cpp b/src/render/decorations/CHyprDropShadowDecoration.cpp index 5341dec9..68a82c3a 100644 --- a/src/render/decorations/CHyprDropShadowDecoration.cpp +++ b/src/render/decorations/CHyprDropShadowDecoration.cpp @@ -140,19 +140,26 @@ void CHyprDropShadowDecoration::draw(CMonitor* pMonitor, float a, const Vector2D windowBox.addExtents(SWindowDecorationExtents{m_eLastExtents * pMonitor->scale}.floor()).round(); - if (windowBox.width < 1 || windowBox.height < 1) { + if (windowBox.width < 1 || windowBox.height < 1) return; // prevent assert failed - } alphaFB.bind(); - g_pHyprOpenGL->clear(CColor(0, 0, 0, 0)); - g_pHyprOpenGL->renderRect(&windowBox, CColor(1.0, 1.0, 1.0, 1.0), ROUNDING * pMonitor->scale); + // 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)); + + // render white shadow + g_pHyprOpenGL->renderRoundedShadow(&fullBox, ROUNDING * pMonitor->scale, *PSHADOWSIZE * pMonitor->scale, CColor(1, 1, 1, 1), a); + + // render black window box ("clip") + g_pHyprOpenGL->renderRect(&windowBox, CColor(0, 0, 0, 1.0), ROUNDING * pMonitor->scale); alphaSwapFB.bind(); - g_pHyprOpenGL->clear(CColor(0, 0, 0, 0)); - g_pHyprOpenGL->renderRoundedShadow(&fullBox, ROUNDING * pMonitor->scale, *PSHADOWSIZE * pMonitor->scale, a); + // alpha swap just has the shadow color. It will be the "texture" to render. + g_pHyprOpenGL->clear(m_pWindow->m_cRealShadowColor.col()); LASTFB->bind(); |
