mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-02 18:05:59 +01:00
surface: fix damage calcs with a viewport src
This commit is contained in:
parent
86be75dd97
commit
7ea37c9dc9
1 changed files with 10 additions and 1 deletions
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue