diff options
| author | Vaxry <vaxry@vaxry.net> | 2023-11-26 15:24:24 +0000 |
|---|---|---|
| committer | Vaxry <vaxry@vaxry.net> | 2023-11-26 15:24:24 +0000 |
| commit | 68e57b7ee36f015d99988f38cb3a8b83c23ae7c3 (patch) | |
| tree | 379a2ae858f2cf44dc177a7abd1a2e823347ad55 /src | |
| parent | 408d96668d57fdd1a713e56f1d40a9befd51bd4a (diff) | |
renderer: proper full occlusion checks for back layer
Diffstat (limited to 'src')
| -rw-r--r-- | src/helpers/Region.cpp | 5 | ||||
| -rw-r--r-- | src/helpers/Region.hpp | 1 | ||||
| -rw-r--r-- | src/render/Renderer.cpp | 7 |
3 files changed, 12 insertions, 1 deletions
diff --git a/src/helpers/Region.cpp b/src/helpers/Region.cpp index df7de442..8f180416 100644 --- a/src/helpers/Region.cpp +++ b/src/helpers/Region.cpp @@ -88,6 +88,11 @@ CRegion& CRegion::invert(pixman_box32_t* box) { return *this; } +CRegion& CRegion::invert(const CBox& box) { + pixman_box32 pixmanBox = {box.x, box.y, box.w + box.x, box.h + box.y}; + return this->invert(&pixmanBox); +} + CRegion& CRegion::translate(const Vector2D& vec) { pixman_region32_translate(&m_rRegion, vec.x, vec.y); return *this; diff --git a/src/helpers/Region.hpp b/src/helpers/Region.hpp index 7554aa58..972a2ba7 100644 --- a/src/helpers/Region.hpp +++ b/src/helpers/Region.hpp @@ -47,6 +47,7 @@ class CRegion { CRegion& translate(const Vector2D& vec); CRegion& transform(const wl_output_transform t, double w, double h); CRegion& invert(pixman_box32_t* box); + CRegion& invert(const CBox& box); CRegion& scale(float scale); CBox getExtents(); bool containsPoint(const Vector2D& vec) const; diff --git a/src/render/Renderer.cpp b/src/render/Renderer.cpp index 770ca16a..e058f1c7 100644 --- a/src/render/Renderer.cpp +++ b/src/render/Renderer.cpp @@ -2187,7 +2187,12 @@ bool CHyprRenderer::canSkipBackBufferClear(CMonitor* pMonitor) { ls->geometry.height != pMonitor->vecSize.y) continue; - if (!ls->layerSurface->surface->opaque) + // TODO: cache maybe? + CRegion opaque = &ls->layerSurface->surface->opaque_region; + CBox lsbox = {0, 0, ls->layerSurface->surface->current.buffer_width, ls->layerSurface->surface->current.buffer_height}; + opaque.invert(lsbox); + + if (!opaque.empty()) continue; return true; |
