renderer: fix fractional scale artifacts (#12287)

This commit is contained in:
bea4dev 2025-11-17 06:17:05 +09:00 committed by GitHub
parent 0770494ddf
commit 7910bc42af
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1134,8 +1134,12 @@ void CHyprRenderer::calculateUVForSurface(PHLWINDOW pWindow, SP<CWLSurfaceResour
if (projSize != Vector2D{} && fixMisalignedFSV1) {
// instead of nearest_neighbor (we will repeat / skip)
// just cut off / expand surface
const Vector2D PIXELASUV = Vector2D{1, 1} / pSurface->m_current.bufferSize;
const Vector2D MISALIGNMENT = pSurface->m_current.bufferSize - projSize;
const Vector2D PIXELASUV = Vector2D{1, 1} / pSurface->m_current.bufferSize;
const auto& BUFFER_SIZE = pSurface->m_current.bufferSize;
// compute MISALIGN from the adjusted UV coordinates.
const Vector2D MISALIGNMENT = (uvBR - uvTL) * BUFFER_SIZE - projSize;
if (MISALIGNMENT != Vector2D{})
uvBR -= MISALIGNMENT * PIXELASUV;
} else {