opengl: improve render fn arg clarity (#11286)

This commit is contained in:
Vaxry 2025-07-31 16:23:09 +02:00 committed by GitHub
parent 3e35797b18
commit a907ecd4ff
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 269 additions and 168 deletions

View file

@ -189,18 +189,19 @@ void CHyprDropShadowDecoration::render(PHLMONITOR pMonitor, float const& a) {
// build the matte
// 10-bit formats have dogshit alpha channels, so we have to use the matte to its fullest.
// first, clear region of interest with black (fully transparent)
g_pHyprOpenGL->renderRect(fullBox, CHyprColor(0, 0, 0, 1), 0);
g_pHyprOpenGL->renderRect(fullBox, CHyprColor(0, 0, 0, 1), {.round = 0});
// render white shadow with the alpha of the shadow color (otherwise we clear with alpha later and shit it to 2 bit)
drawShadowInternal(fullBox, ROUNDING * pMonitor->m_scale, ROUNDINGPOWER, *PSHADOWSIZE * pMonitor->m_scale, CHyprColor(1, 1, 1, PWINDOW->m_realShadowColor->value().a), a);
// render black window box ("clip")
g_pHyprOpenGL->renderRect(windowBox, CHyprColor(0, 0, 0, 1.0), (ROUNDING + 1 /* This fixes small pixel gaps. */) * pMonitor->m_scale, ROUNDINGPOWER);
g_pHyprOpenGL->renderRect(windowBox, CHyprColor(0, 0, 0, 1.0),
{.round = (ROUNDING + 1 /* This fixes small pixel gaps. */) * pMonitor->m_scale, .roundingPower = ROUNDINGPOWER});
alphaSwapFB.bind();
// alpha swap just has the shadow color. It will be the "texture" to render.
g_pHyprOpenGL->renderRect(fullBox, PWINDOW->m_realShadowColor->value().stripA(), 0);
g_pHyprOpenGL->renderRect(fullBox, PWINDOW->m_realShadowColor->value().stripA(), {.round = 0});
LASTFB->bind();
@ -237,7 +238,7 @@ void CHyprDropShadowDecoration::drawShadowInternal(const CBox& box, int round, f
color.a *= a;
if (*PSHADOWSHARP)
g_pHyprOpenGL->renderRect(box, color, round, roundingPower);
g_pHyprOpenGL->renderRect(box, color, {.round = round, .roundingPower = roundingPower});
else
g_pHyprOpenGL->renderRoundedShadow(box, round, roundingPower, range, color, 1.F);
}