From 26cbc67385d95ba621fe0a125a5b121ffdd09335 Mon Sep 17 00:00:00 2001 From: Vaxry <43317083+vaxerski@users.noreply.github.com> Date: Sun, 21 Sep 2025 19:27:56 +0200 Subject: renderer: fix uv calculations once and for all (#11770) fixes synchronization of ackd sizes, fixes wrong xdg stuff --- src/render/pass/SurfacePassElement.cpp | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) (limited to 'src/render/pass/SurfacePassElement.cpp') 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(outputX) + m_data.pos.x + m_data.localPos.x, sc(outputY) + m_data.pos.y + m_data.localPos.y, - std::max(sc(m_data.surface->m_current.size.x), 2.F), std::max(sc(m_data.surface->m_current.size.y), 2.F)}; + + const auto SURFSIZE = m_data.surface->m_current.size; + + windowBox = {sc(outputX) + m_data.pos.x + m_data.localPos.x, sc(outputY) + m_data.pos.y + m_data.localPos.y, std::max(sc(SURFSIZE.x), 2.F), + std::max(sc(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; + } } } -- cgit v1.2.3