summaryrefslogtreecommitdiff
path: root/src/render/Renderer.cpp
diff options
context:
space:
mode:
authorbea4dev <34712108+bea4dev@users.noreply.github.com>2025-11-17 06:17:05 +0900
committerGitHub <noreply@github.com>2025-11-16 21:17:05 +0000
commit7910bc42afeeb142305c0dd99b3a42ac73039f85 (patch)
treeb0ecb4c56e58d7239d39118b3780847f86086915 /src/render/Renderer.cpp
parent0770494ddfa95fccdae4d7676445c130268a6a1a (diff)
renderer: fix fractional scale artifacts (#12287)
Diffstat (limited to 'src/render/Renderer.cpp')
-rw-r--r--src/render/Renderer.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/render/Renderer.cpp b/src/render/Renderer.cpp
index 9a2410f3..b115bab9 100644
--- a/src/render/Renderer.cpp
+++ b/src/render/Renderer.cpp
@@ -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 {