diff options
| author | vaxerski <vaxry@vaxry.net> | 2024-02-20 15:21:30 +0000 |
|---|---|---|
| committer | vaxerski <vaxry@vaxry.net> | 2024-02-20 15:21:30 +0000 |
| commit | 7ea37c9dc93b990dc756de45687c125290a74afb (patch) | |
| tree | 97d50922236b63dea09180e368e5dbaf73bedbff /src/helpers/WLSurface.cpp | |
| parent | 86be75dd97b5633b8c0aa6bdcb3346fa871a8480 (diff) | |
surface: fix damage calcs with a viewport src
Diffstat (limited to 'src/helpers/WLSurface.cpp')
| -rw-r--r-- | src/helpers/WLSurface.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/helpers/WLSurface.cpp b/src/helpers/WLSurface.cpp index 2aa36267..ea34fbd4 100644 --- a/src/helpers/WLSurface.cpp +++ b/src/helpers/WLSurface.cpp @@ -60,7 +60,16 @@ CRegion CWLSurface::logicalDamage() const { const auto VPSIZE = getViewporterCorrectedSize(); const auto CORRECTVEC = correctSmallVec(); - damage.scale({VPSIZE.x / m_pWLRSurface->current.buffer_width, VPSIZE.y / m_pWLRSurface->current.buffer_height}); + if (m_pWLRSurface->current.viewport.has_src) { + damage.intersect(CBox{std::floor(m_pWLRSurface->current.viewport.src.x), std::floor(m_pWLRSurface->current.viewport.src.y), + std::ceil(m_pWLRSurface->current.viewport.src.width), std::ceil(m_pWLRSurface->current.viewport.src.height)}); + } + + const auto SCALEDSRCSIZE = m_pWLRSurface->current.viewport.has_src ? + Vector2D{m_pWLRSurface->current.viewport.src.width, m_pWLRSurface->current.viewport.src.height} * m_pWLRSurface->current.scale : + Vector2D{m_pWLRSurface->current.buffer_width, m_pWLRSurface->current.buffer_height}; + + damage.scale({VPSIZE.x / SCALEDSRCSIZE.x, VPSIZE.y / SCALEDSRCSIZE.y}); damage.translate(CORRECTVEC); return damage; |
