mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-07 17:46:00 +01:00
clean up blur code and fix minor issues
This commit is contained in:
parent
12df799572
commit
3dd06b674a
1 changed files with 26 additions and 26 deletions
|
@ -705,24 +705,26 @@ void CHyprOpenGLImpl::preWindowPass() {
|
||||||
if (pWindow->m_sAdditionalConfigData.forceNoBlur)
|
if (pWindow->m_sAdditionalConfigData.forceNoBlur)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (g_pXWaylandManager->getWindowSurface(pWindow)->opaque)
|
const auto PSURFACE = g_pXWaylandManager->getWindowSurface(pWindow);
|
||||||
|
|
||||||
|
if (PSURFACE->opaque)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
pixman_region32_t inverseOpaque;
|
pixman_region32_t inverseOpaque;
|
||||||
pixman_region32_init(&inverseOpaque);
|
pixman_region32_init(&inverseOpaque);
|
||||||
if (a == 255.f) {
|
const auto PWORKSPACE = g_pCompositor->getWorkspaceByID(pWindow->m_iWorkspaceID);
|
||||||
pixman_box32_t monbox = {0, 0, m_RenderData.pMonitor->vecTransformedSize.x, m_RenderData.pMonitor->vecTransformedSize.y};
|
const float A = pWindow->m_fAlpha.fl() * pWindow->m_fActiveInactiveAlpha.fl() * PWORKSPACE->m_fAlpha.fl() / 255.f;
|
||||||
pixman_region32_copy(&inverseOpaque, &pSurface->current.opaque);
|
|
||||||
pixman_region32_translate(&inverseOpaque, pBox->x, pBox->y);
|
|
||||||
pixman_region32_inverse(&inverseOpaque, &inverseOpaque, &monbox);
|
|
||||||
pixman_region32_intersect(&inverseOpaque, &damage, &inverseOpaque);
|
|
||||||
} else {
|
|
||||||
pixman_region32_copy(&inverseOpaque, &damage);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!pixman_region32_not_empty(&inverseOpaque)) {
|
if (A >= 255.f) {
|
||||||
pixman_region32_fini(&inverseOpaque);
|
pixman_box32_t surfbox = {0, 0, PSURFACE->current.width, PSURFACE->current.height};
|
||||||
return false;
|
pixman_region32_copy(&inverseOpaque, &PSURFACE->current.opaque);
|
||||||
|
pixman_region32_inverse(&inverseOpaque, &inverseOpaque, &surfbox);
|
||||||
|
pixman_region32_intersect_rect(&inverseOpaque, &inverseOpaque, 0, 0, PSURFACE->current.width, PSURFACE->current.height);
|
||||||
|
|
||||||
|
if (!pixman_region32_not_empty(&inverseOpaque)) {
|
||||||
|
pixman_region32_fini(&inverseOpaque);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pixman_region32_fini(&inverseOpaque);
|
pixman_region32_fini(&inverseOpaque);
|
||||||
|
@ -773,23 +775,21 @@ void CHyprOpenGLImpl::renderTextureWithBlur(const CTexture& tex, wlr_box* pBox,
|
||||||
// amazing hack: the surface has an opaque region!
|
// amazing hack: the surface has an opaque region!
|
||||||
pixman_region32_t inverseOpaque;
|
pixman_region32_t inverseOpaque;
|
||||||
pixman_region32_init(&inverseOpaque);
|
pixman_region32_init(&inverseOpaque);
|
||||||
if (a == 255.f) {
|
if (a >= 255.f) {
|
||||||
pixman_box32_t monbox = {0, 0, m_RenderData.pMonitor->vecTransformedSize.x, m_RenderData.pMonitor->vecTransformedSize.y};
|
pixman_box32_t surfbox = {0, 0, pSurface->current.width, pSurface->current.height};
|
||||||
pixman_region32_copy(&inverseOpaque, &pSurface->current.opaque);
|
pixman_region32_copy(&inverseOpaque, &pSurface->current.opaque);
|
||||||
pixman_region32_translate(&inverseOpaque, pBox->x, pBox->y);
|
pixman_region32_inverse(&inverseOpaque, &inverseOpaque, &surfbox);
|
||||||
pixman_region32_inverse(&inverseOpaque, &inverseOpaque, &monbox);
|
pixman_region32_intersect_rect(&inverseOpaque, &inverseOpaque, 0, 0, pSurface->current.width, pSurface->current.height);
|
||||||
pixman_region32_intersect(&inverseOpaque, &damage, &inverseOpaque);
|
|
||||||
} else {
|
|
||||||
pixman_region32_copy(&inverseOpaque, &damage);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!pixman_region32_not_empty(&inverseOpaque)) {
|
if (!pixman_region32_not_empty(&inverseOpaque)) {
|
||||||
renderTexture(tex, pBox, a, round, false, true); // reject blurring a fully opaque window
|
pixman_region32_fini(&inverseOpaque);
|
||||||
pixman_region32_fini(&inverseOpaque);
|
renderTexture(tex, pBox, a, round, false, true);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
pixman_region32_fini(&inverseOpaque);
|
||||||
|
|
||||||
// vvv TODO: layered blur fbs?
|
// vvv TODO: layered blur fbs?
|
||||||
const bool USENEWOPTIMIZE = (*PBLURNEWOPTIMIZE && m_pCurrentWindow && !m_pCurrentWindow->m_bIsFloating && m_RenderData.pCurrentMonData->blurFB.m_cTex.m_iTexID && !g_pCompositor->isWorkspaceSpecial(m_pCurrentWindow->m_iWorkspaceID));
|
const bool USENEWOPTIMIZE = (*PBLURNEWOPTIMIZE && m_pCurrentWindow && !m_pCurrentWindow->m_bIsFloating && m_RenderData.pCurrentMonData->blurFB.m_cTex.m_iTexID && !g_pCompositor->isWorkspaceSpecial(m_pCurrentWindow->m_iWorkspaceID));
|
||||||
|
|
||||||
const auto POUTFB = USENEWOPTIMIZE ? &m_RenderData.pCurrentMonData->blurFB : blurMainFramebufferWithDamage(a, pBox, &inverseOpaque);
|
const auto POUTFB = USENEWOPTIMIZE ? &m_RenderData.pCurrentMonData->blurFB : blurMainFramebufferWithDamage(a, pBox, &inverseOpaque);
|
||||||
|
|
Loading…
Reference in a new issue