renderer: proper full occlusion checks for back layer

This commit is contained in:
Vaxry 2023-11-26 15:24:24 +00:00
parent 408d96668d
commit 68e57b7ee3
3 changed files with 12 additions and 1 deletions

View file

@ -88,6 +88,11 @@ CRegion& CRegion::invert(pixman_box32_t* box) {
return *this; 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) { CRegion& CRegion::translate(const Vector2D& vec) {
pixman_region32_translate(&m_rRegion, vec.x, vec.y); pixman_region32_translate(&m_rRegion, vec.x, vec.y);
return *this; return *this;

View file

@ -47,6 +47,7 @@ class CRegion {
CRegion& translate(const Vector2D& vec); CRegion& translate(const Vector2D& vec);
CRegion& transform(const wl_output_transform t, double w, double h); CRegion& transform(const wl_output_transform t, double w, double h);
CRegion& invert(pixman_box32_t* box); CRegion& invert(pixman_box32_t* box);
CRegion& invert(const CBox& box);
CRegion& scale(float scale); CRegion& scale(float scale);
CBox getExtents(); CBox getExtents();
bool containsPoint(const Vector2D& vec) const; bool containsPoint(const Vector2D& vec) const;

View file

@ -2187,7 +2187,12 @@ bool CHyprRenderer::canSkipBackBufferClear(CMonitor* pMonitor) {
ls->geometry.height != pMonitor->vecSize.y) ls->geometry.height != pMonitor->vecSize.y)
continue; 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; continue;
return true; return true;