summaryrefslogtreecommitdiff
path: root/src/helpers/WLSurface.cpp
diff options
context:
space:
mode:
authorvaxerski <vaxry@vaxry.net>2024-02-19 11:24:54 +0000
committervaxerski <vaxry@vaxry.net>2024-02-19 11:24:54 +0000
commite4790e3f8e8f3693d924c3d8fc9012e3ab7bbf8f (patch)
tree45d88aee67b0529d3d7c11e875bbb6f7653bb06d /src/helpers/WLSurface.cpp
parent69a4f08dbee6dc08d1e2ce498ce80ab20844e4f3 (diff)
surface: fix invalid damage tracking in damageSurface
ref #4744
Diffstat (limited to 'src/helpers/WLSurface.cpp')
-rw-r--r--src/helpers/WLSurface.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/helpers/WLSurface.cpp b/src/helpers/WLSurface.cpp
index 3528a72d..99771d0d 100644
--- a/src/helpers/WLSurface.cpp
+++ b/src/helpers/WLSurface.cpp
@@ -52,6 +52,20 @@ Vector2D CWLSurface::getViewporterCorrectedSize() const {
Vector2D{m_pWLRSurface->current.buffer_width, m_pWLRSurface->current.buffer_height};
}
+CRegion CWLSurface::logicalDamage() const {
+ CRegion damage{&m_pWLRSurface->buffer_damage};
+ damage.transform(m_pWLRSurface->current.transform, m_pWLRSurface->current.buffer_width, m_pWLRSurface->current.buffer_height);
+ damage.scale(1.0 / m_pWLRSurface->current.scale);
+
+ const auto VPSIZE = getViewporterCorrectedSize() / m_pWLRSurface->current.scale;
+ const auto CORRECTVEC = correctSmallVec();
+
+ damage.scale({VPSIZE.x / m_pWLRSurface->current.width, VPSIZE.y / m_pWLRSurface->current.height});
+ damage.translate(CORRECTVEC);
+
+ return damage;
+}
+
void CWLSurface::destroy() {
if (!m_pWLRSurface)
return;