mirror of
https://github.com/hyprwm/Hyprland.git
synced 2025-08-01 20:51:58 -07:00
shadow: alpha treatment improvements
This commit is contained in:
@@ -5,7 +5,7 @@
|
|||||||
class CColor {
|
class CColor {
|
||||||
public:
|
public:
|
||||||
CColor();
|
CColor();
|
||||||
CColor(float, float, float, float);
|
CColor(float r, float g, float b, float a);
|
||||||
CColor(uint64_t);
|
CColor(uint64_t);
|
||||||
|
|
||||||
float r = 0, g = 0, b = 0, a = 1.f;
|
float r = 0, g = 0, b = 0, a = 1.f;
|
||||||
@@ -27,4 +27,8 @@ class CColor {
|
|||||||
bool operator==(const CColor& c2) const {
|
bool operator==(const CColor& c2) const {
|
||||||
return r == c2.r && g == c2.g && b == c2.b && a == c2.a;
|
return r == c2.r && g == c2.g && b == c2.b && a == c2.a;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CColor stripA() const {
|
||||||
|
return {r, g, b, 1};
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
@@ -150,8 +150,8 @@ void CHyprDropShadowDecoration::draw(CMonitor* pMonitor, float a, const Vector2D
|
|||||||
// first, clear with black (fully transparent)
|
// first, clear with black (fully transparent)
|
||||||
g_pHyprOpenGL->clear(CColor(0, 0, 0, 1));
|
g_pHyprOpenGL->clear(CColor(0, 0, 0, 1));
|
||||||
|
|
||||||
// render white shadow
|
// 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, 1), a);
|
g_pHyprOpenGL->renderRoundedShadow(&fullBox, ROUNDING * pMonitor->scale, *PSHADOWSIZE * pMonitor->scale, CColor(1, 1, 1, m_pWindow->m_cRealShadowColor.col().a), a);
|
||||||
|
|
||||||
// render black window box ("clip")
|
// render black window box ("clip")
|
||||||
g_pHyprOpenGL->renderRect(&windowBox, CColor(0, 0, 0, 1.0), ROUNDING * pMonitor->scale);
|
g_pHyprOpenGL->renderRect(&windowBox, CColor(0, 0, 0, 1.0), ROUNDING * pMonitor->scale);
|
||||||
@@ -159,7 +159,7 @@ void CHyprDropShadowDecoration::draw(CMonitor* pMonitor, float a, const Vector2D
|
|||||||
alphaSwapFB.bind();
|
alphaSwapFB.bind();
|
||||||
|
|
||||||
// alpha swap just has the shadow color. It will be the "texture" to render.
|
// alpha swap just has the shadow color. It will be the "texture" to render.
|
||||||
g_pHyprOpenGL->clear(m_pWindow->m_cRealShadowColor.col());
|
g_pHyprOpenGL->clear(m_pWindow->m_cRealShadowColor.col().stripA());
|
||||||
|
|
||||||
LASTFB->bind();
|
LASTFB->bind();
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user