diff options
author | staz <[email protected]> | 2023-03-21 19:01:24 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2023-03-21 19:01:24 +0000 |
commit | 5ce91bb0fd4fe8eb09f1a728e3b84cc1ff4244eb (patch) | |
tree | f3a4f778a3aaede5c3d190df5e2fb6f156ea6e84 | |
parent | adf5d8a114362a5d32013e95f254b85be048dbdb (diff) | |
download | Hyprland-5ce91bb0fd4fe8eb09f1a728e3b84cc1ff4244eb.tar.gz Hyprland-5ce91bb0fd4fe8eb09f1a728e3b84cc1ff4244eb.zip |
Added overflow check for blur radius (#1847)
* internal: added overflow check for blur radius
---------
Co-authored-by: vaxerski <[email protected]>
-rw-r--r-- | src/events/Monitors.cpp | 3 | ||||
-rw-r--r-- | src/render/OpenGL.cpp | 2 |
2 files changed, 3 insertions, 2 deletions
diff --git a/src/events/Monitors.cpp b/src/events/Monitors.cpp index 0412f43e..0ea64e67 100644 --- a/src/events/Monitors.cpp +++ b/src/events/Monitors.cpp @@ -241,7 +241,8 @@ void Events::listener_monitorFrame(void* owner, void* data) { // TODO: can this be optimized? static auto* const PBLURSIZE = &g_pConfigManager->getConfigValuePtr("decoration:blur_size")->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 wlr_region_expand(&damage, &damage, BLURRADIUS); // expand for proper blurring diff --git a/src/render/OpenGL.cpp b/src/render/OpenGL.cpp index ea36b2da..a646ed07 100644 --- a/src/render/OpenGL.cpp +++ b/src/render/OpenGL.cpp @@ -651,7 +651,7 @@ CFramebuffer* CHyprOpenGLImpl::blurMainFramebufferWithDamage(float a, wlr_box* p pixman_region32_copy(&damage, originalDamage); wlr_region_transform(&damage, &damage, wlr_output_transform_invert(m_RenderData.pMonitor->transform), m_RenderData.pMonitor->vecTransformedSize.x, 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 const auto PMIRRORFB = &m_RenderData.pCurrentMonData->mirrorFB; |