summaryrefslogtreecommitdiff
path: root/src/render/OpenGL.cpp
diff options
context:
space:
mode:
authoroutfoxxed <outfoxxed@outfoxxed.me>2025-01-23 13:57:33 -0800
committerGitHub <noreply@github.com>2025-01-23 22:57:33 +0100
commit465cf66df14c28427ba30580253be6e3908bd28c (patch)
tree93bc76546ffa329972863fd2716e8856debaeef8 /src/render/OpenGL.cpp
parent1a0a22ad038bbd51c4e1514868d6dcd505af0242 (diff)
protocols: add hyprland_surface_v1.set_visible_region implementation (#9120)
Diffstat (limited to 'src/render/OpenGL.cpp')
-rw-r--r--src/render/OpenGL.cpp17
1 files changed, 14 insertions, 3 deletions
diff --git a/src/render/OpenGL.cpp b/src/render/OpenGL.cpp
index ceb94c81..8ae667d2 100644
--- a/src/render/OpenGL.cpp
+++ b/src/render/OpenGL.cpp
@@ -1556,9 +1556,15 @@ void CHyprOpenGLImpl::renderTextureInternalWithDamage(SP<CTexture> tex, CBox* pB
glEnableVertexAttribArray(shader->posAttrib);
glEnableVertexAttribArray(shader->texAttrib);
- if (m_RenderData.clipBox.width != 0 && m_RenderData.clipBox.height != 0) {
- CRegion damageClip{m_RenderData.clipBox.x, m_RenderData.clipBox.y, m_RenderData.clipBox.width, m_RenderData.clipBox.height};
- damageClip.intersect(damage);
+ if (!m_RenderData.clipBox.empty() || !m_RenderData.clipRegion.empty()) {
+ CRegion damageClip = m_RenderData.clipBox;
+
+ if (!m_RenderData.clipRegion.empty()) {
+ if (m_RenderData.clipBox.empty())
+ damageClip = m_RenderData.clipRegion;
+ else
+ damageClip.intersect(m_RenderData.clipRegion);
+ }
if (!damageClip.empty()) {
for (auto const& RECT : damageClip.getRects()) {
@@ -2079,6 +2085,11 @@ void CHyprOpenGLImpl::renderTextureWithBlur(SP<CTexture> tex, CBox* pBox, float
CRegion texDamage{m_RenderData.damage};
texDamage.intersect(pBox->x, pBox->y, pBox->width, pBox->height);
+ // While renderTextureInternalWithDamage will clip the blur as well,
+ // clipping texDamage here allows blur generation to be optimized.
+ if (!m_RenderData.clipRegion.empty())
+ texDamage.intersect(m_RenderData.clipRegion);
+
if (texDamage.empty())
return;