mirror of
https://github.com/hyprwm/Hyprland.git
synced 2025-08-27 09:53:47 -07:00
@@ -1118,7 +1118,7 @@ void CHyprRenderer::calculateUVForSurface(PHLWINDOW pWindow, SP<CWLSurfaceResour
|
||||
if (!SCALE_UNAWARE && (EXPECTED_SIZE.x < projSize.x || EXPECTED_SIZE.y < projSize.y)) {
|
||||
// this will not work with shm AFAIK, idk why.
|
||||
// NOTE: this math is wrong if we have a source... or geom updates later, but I don't think we can do much
|
||||
const auto FIX = projSize / EXPECTED_SIZE;
|
||||
const auto FIX = (projSize / EXPECTED_SIZE).clamp(Vector2D{1, 1}, Vector2D{1000000, 1000000});
|
||||
uvBR = uvBR * FIX;
|
||||
}
|
||||
}
|
||||
@@ -1137,26 +1137,29 @@ void CHyprRenderer::calculateUVForSurface(PHLWINDOW pWindow, SP<CWLSurfaceResour
|
||||
|
||||
CBox geom = pWindow->m_xdgSurface->m_current.geometry;
|
||||
|
||||
// ignore X and Y, adjust uv
|
||||
if (geom.x != 0 || geom.y != 0 || geom.width > projSizeUnscaled.x || geom.height > projSizeUnscaled.y) {
|
||||
// Adjust UV based on the xdg_surface geometry
|
||||
if (geom.x != 0 || geom.y != 0 || geom.w != 0 || geom.h != 0) {
|
||||
const auto XPERC = (double)geom.x / (double)pSurface->m_current.size.x;
|
||||
const auto YPERC = (double)geom.y / (double)pSurface->m_current.size.y;
|
||||
const auto WPERC = (double)(geom.x + geom.width) / (double)pSurface->m_current.size.x;
|
||||
const auto HPERC = (double)(geom.y + geom.height) / (double)pSurface->m_current.size.y;
|
||||
const auto WPERC = (double)(geom.x + geom.w ? geom.w : pSurface->m_current.size.x) / (double)pSurface->m_current.size.x;
|
||||
const auto HPERC = (double)(geom.y + geom.h ? geom.h : pSurface->m_current.size.y) / (double)pSurface->m_current.size.y;
|
||||
|
||||
const auto TOADDTL = Vector2D(XPERC * (uvBR.x - uvTL.x), YPERC * (uvBR.y - uvTL.y));
|
||||
uvBR = uvBR - Vector2D((1.0 - WPERC) * (uvBR.x - uvTL.x), (1.0 - HPERC) * (uvBR.y - uvTL.y));
|
||||
uvTL = uvTL + TOADDTL;
|
||||
}
|
||||
|
||||
// Adjust UV based on our animation progress
|
||||
if (pSurface->m_current.size.x > projSizeUnscaled.x || pSurface->m_current.size.y > projSizeUnscaled.y) {
|
||||
auto maxSize = projSizeUnscaled;
|
||||
|
||||
if (pWindow->m_wlSurface->small() && !pWindow->m_wlSurface->m_fillIgnoreSmall)
|
||||
maxSize = pWindow->m_wlSurface->getViewporterCorrectedSize();
|
||||
|
||||
if (geom.width > maxSize.x)
|
||||
uvBR.x = uvBR.x * (maxSize.x / geom.width);
|
||||
if (geom.height > maxSize.y)
|
||||
uvBR.y = uvBR.y * (maxSize.y / geom.height);
|
||||
if (pSurface->m_current.size.x > maxSize.x)
|
||||
uvBR.x = uvBR.x * (maxSize.x / pSurface->m_current.size.x);
|
||||
if (pSurface->m_current.size.y > maxSize.y)
|
||||
uvBR.y = uvBR.y * (maxSize.y / pSurface->m_current.size.y);
|
||||
}
|
||||
|
||||
g_pHyprOpenGL->m_renderData.primarySurfaceUVTopLeft = uvTL;
|
||||
|
Reference in New Issue
Block a user