protocols: add hyprland_surface_v1.set_visible_region implementation (#9120)

This commit is contained in:
outfoxxed
2025-01-23 13:57:33 -08:00
committed by GitHub
parent 1a0a22ad03
commit 465cf66df1
9 changed files with 96 additions and 8 deletions

View File

@@ -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;