diff options
| author | Vaxry <43317083+vaxerski@users.noreply.github.com> | 2025-09-21 19:27:56 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-09-21 19:27:56 +0200 |
| commit | 26cbc67385d95ba621fe0a125a5b121ffdd09335 (patch) | |
| tree | 2aa7c05ce78ab4ea55e8df81f1c99553509b37b1 /src/render/pass | |
| parent | 41dad381770300fe1015ad8cdd1f370a8fd4e5d5 (diff) | |
renderer: fix uv calculations once and for all (#11770)
fixes synchronization of ackd sizes, fixes wrong xdg stuff
Diffstat (limited to 'src/render/pass')
| -rw-r--r-- | src/render/pass/SurfacePassElement.cpp | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/src/render/pass/SurfacePassElement.cpp b/src/render/pass/SurfacePassElement.cpp index 7dd423bd..47ace789 100644 --- a/src/render/pass/SurfacePassElement.cpp +++ b/src/render/pass/SurfacePassElement.cpp @@ -174,27 +174,33 @@ CBox CSurfacePassElement::getTexBox() { // center the surface if it's smaller than the viewport we assign it if (PSURFACE && !PSURFACE->m_fillIgnoreSmall && PSURFACE->small() /* guarantees PWINDOW */) { - const auto CORRECT = PSURFACE->correctSmallVec(); - const auto SIZE = PSURFACE->getViewporterCorrectedSize(); + const auto CORRECT = PSURFACE->correctSmallVec(); + const auto SIZE = PSURFACE->getViewporterCorrectedSize(); + const auto REPORTED = PWINDOW->getReportedSize(); if (!INTERACTIVERESIZEINPROGRESS) { windowBox.translate(CORRECT); - windowBox.width = SIZE.x * (PWINDOW->m_realSize->value().x / PWINDOW->m_reportedSize.x); - windowBox.height = SIZE.y * (PWINDOW->m_realSize->value().y / PWINDOW->m_reportedSize.y); + windowBox.width = SIZE.x * (PWINDOW->m_realSize->value().x / REPORTED.x); + windowBox.height = SIZE.y * (PWINDOW->m_realSize->value().y / REPORTED.y); } else { windowBox.width = SIZE.x; windowBox.height = SIZE.y; } } - } else { // here we clamp to 2, these might be some tiny specks - windowBox = {sc<int>(outputX) + m_data.pos.x + m_data.localPos.x, sc<int>(outputY) + m_data.pos.y + m_data.localPos.y, - std::max(sc<float>(m_data.surface->m_current.size.x), 2.F), std::max(sc<float>(m_data.surface->m_current.size.y), 2.F)}; + + const auto SURFSIZE = m_data.surface->m_current.size; + + windowBox = {sc<int>(outputX) + m_data.pos.x + m_data.localPos.x, sc<int>(outputY) + m_data.pos.y + m_data.localPos.y, std::max(sc<float>(SURFSIZE.x), 2.F), + std::max(sc<float>(SURFSIZE.y), 2.F)}; if (m_data.pWindow && m_data.pWindow->m_realSize->isBeingAnimated() && m_data.surface && !m_data.mainSurface && m_data.squishOversized /* subsurface */) { // adjust subsurfaces to the window - windowBox.width = (windowBox.width / m_data.pWindow->m_reportedSize.x) * m_data.pWindow->m_realSize->value().x; - windowBox.height = (windowBox.height / m_data.pWindow->m_reportedSize.y) * m_data.pWindow->m_realSize->value().y; + const auto REPORTED = m_data.pWindow->getReportedSize(); + if (REPORTED.x != 0 && REPORTED.y != 0) { + windowBox.width = (windowBox.width / REPORTED.x) * m_data.pWindow->m_realSize->value().x; + windowBox.height = (windowBox.height / REPORTED.y) * m_data.pWindow->m_realSize->value().y; + } } } |
