mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-08 13:25:58 +01:00
Added overflow check for blur radius (#1847)
* internal: added overflow check for blur radius --------- Co-authored-by: vaxerski <43317083+vaxerski@users.noreply.github.com>
This commit is contained in:
parent
adf5d8a114
commit
5ce91bb0fd
2 changed files with 3 additions and 2 deletions
|
@ -241,7 +241,8 @@ void Events::listener_monitorFrame(void* owner, void* data) {
|
||||||
// TODO: can this be optimized?
|
// TODO: can this be optimized?
|
||||||
static auto* const PBLURSIZE = &g_pConfigManager->getConfigValuePtr("decoration:blur_size")->intValue;
|
static auto* const PBLURSIZE = &g_pConfigManager->getConfigValuePtr("decoration:blur_size")->intValue;
|
||||||
static auto* const PBLURPASSES = &g_pConfigManager->getConfigValuePtr("decoration:blur_passes")->intValue;
|
static auto* const PBLURPASSES = &g_pConfigManager->getConfigValuePtr("decoration:blur_passes")->intValue;
|
||||||
const auto BLURRADIUS = *PBLURSIZE * pow(2, *PBLURPASSES); // is this 2^pass? I don't know but it works... I think.
|
const auto BLURRADIUS =
|
||||||
|
*PBLURPASSES > 10 ? pow(2, 15) : std::clamp(*PBLURSIZE, (int64_t)1, (int64_t)40) * pow(2, *PBLURPASSES); // is this 2^pass? I don't know but it works... I think.
|
||||||
|
|
||||||
// now, prep the damage, get the extended damage region
|
// now, prep the damage, get the extended damage region
|
||||||
wlr_region_expand(&damage, &damage, BLURRADIUS); // expand for proper blurring
|
wlr_region_expand(&damage, &damage, BLURRADIUS); // expand for proper blurring
|
||||||
|
|
|
@ -651,7 +651,7 @@ CFramebuffer* CHyprOpenGLImpl::blurMainFramebufferWithDamage(float a, wlr_box* p
|
||||||
pixman_region32_copy(&damage, originalDamage);
|
pixman_region32_copy(&damage, originalDamage);
|
||||||
wlr_region_transform(&damage, &damage, wlr_output_transform_invert(m_RenderData.pMonitor->transform), m_RenderData.pMonitor->vecTransformedSize.x,
|
wlr_region_transform(&damage, &damage, wlr_output_transform_invert(m_RenderData.pMonitor->transform), m_RenderData.pMonitor->vecTransformedSize.x,
|
||||||
m_RenderData.pMonitor->vecTransformedSize.y);
|
m_RenderData.pMonitor->vecTransformedSize.y);
|
||||||
wlr_region_expand(&damage, &damage, pow(2, *PBLURPASSES) * *PBLURSIZE);
|
wlr_region_expand(&damage, &damage, *PBLURPASSES > 10 ? pow(2, 15) : std::clamp(*PBLURSIZE, (int64_t)1, (int64_t)40) * pow(2, *PBLURPASSES));
|
||||||
|
|
||||||
// helper
|
// helper
|
||||||
const auto PMIRRORFB = &m_RenderData.pCurrentMonData->mirrorFB;
|
const auto PMIRRORFB = &m_RenderData.pCurrentMonData->mirrorFB;
|
||||||
|
|
Loading…
Reference in a new issue