allow preblur for opaque surfaces if alpha not 1

This commit is contained in:
vaxerski 2023-01-23 13:55:11 +00:00
parent c074f260a1
commit 2a5ae435e1

View file

@ -460,7 +460,7 @@ void CHyprOpenGLImpl::renderTextureInternalWithDamage(const CTexture& tex, wlr_b
bool allowCustomUV, bool allowDim) {
RASSERT(m_RenderData.pMonitor, "Tried to render texture without begin()!");
RASSERT((tex.m_iTexID > 0), "Attempted to draw NULL texture!");
alpha = std::clamp(alpha, 0.f, 1.f);
if (!pixman_region32_not_empty(m_RenderData.pDamage))
@ -733,17 +733,18 @@ void CHyprOpenGLImpl::preRender(CMonitor* pMonitor) {
if (pWindow->m_sAdditionalConfigData.forceNoBlur)
return false;
const auto PSURFACE = g_pXWaylandManager->getWindowSurface(pWindow);
const auto PSURFACE = g_pXWaylandManager->getWindowSurface(pWindow);
if (PSURFACE->opaque)
return false;
pixman_region32_t inverseOpaque;
pixman_region32_init(&inverseOpaque);
const auto PWORKSPACE = g_pCompositor->getWorkspaceByID(pWindow->m_iWorkspaceID);
const float A = pWindow->m_fAlpha.fl() * pWindow->m_fActiveInactiveAlpha.fl() * PWORKSPACE->m_fAlpha.fl();
if (A >= 1.f) {
if (PSURFACE->opaque)
return false;
pixman_region32_t inverseOpaque;
pixman_region32_init(&inverseOpaque);
pixman_box32_t surfbox = {0, 0, PSURFACE->current.width, PSURFACE->current.height};
pixman_region32_copy(&inverseOpaque, &PSURFACE->current.opaque);
pixman_region32_inverse(&inverseOpaque, &inverseOpaque, &surfbox);
@ -753,9 +754,9 @@ void CHyprOpenGLImpl::preRender(CMonitor* pMonitor) {
pixman_region32_fini(&inverseOpaque);
return false;
}
}
pixman_region32_fini(&inverseOpaque);
pixman_region32_fini(&inverseOpaque);
}
return true;
};