From 6ce267897017de39a82173baa9121c08de1cdbf8 Mon Sep 17 00:00:00 2001 From: vaxerski <43317083+vaxerski@users.noreply.github.com> Date: Wed, 29 Jun 2022 22:26:34 +0200 Subject: [PATCH] fix snapshot scaling issue --- src/render/OpenGL.cpp | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/render/OpenGL.cpp b/src/render/OpenGL.cpp index 75336f5a..be9e19b2 100644 --- a/src/render/OpenGL.cpp +++ b/src/render/OpenGL.cpp @@ -813,18 +813,13 @@ void CHyprOpenGLImpl::renderSnapshot(CWindow** pWindow) { wlr_box windowBox; // some mafs to figure out the correct box - Vector2D scaleXY = Vector2D((PWINDOW->m_vRealSize.vec().x / PWINDOW->m_vOriginalClosedSize.x), (PWINDOW->m_vRealSize.vec().y / PWINDOW->m_vOriginalClosedSize.y)); + Vector2D scaleXY = Vector2D((PMONITOR->scale * PWINDOW->m_vRealSize.vec().x / PWINDOW->m_vOriginalClosedSize.x), (PMONITOR->scale * PWINDOW->m_vRealSize.vec().y / PWINDOW->m_vOriginalClosedSize.y)); windowBox.width = PMONITOR->vecPixelSize.x * scaleXY.x; windowBox.height = PMONITOR->vecPixelSize.y * scaleXY.y; windowBox.x = (PWINDOW->m_vRealPosition.vec().x * PMONITOR->scale - PMONITOR->vecPosition.x) - ((PWINDOW->m_vOriginalClosedPos.x - PMONITOR->vecPosition.x) * scaleXY.x); windowBox.y = (PWINDOW->m_vRealPosition.vec().y * PMONITOR->scale - PMONITOR->vecPosition.y) - ((PWINDOW->m_vOriginalClosedPos.y - PMONITOR->vecPosition.y) * scaleXY.y); - if (scaleXY != Vector2D(1, 1) && PMONITOR->scale != 1) { // TODO: this is completely wrong but I suck at math. - windowBox.width /= PMONITOR->scale; - windowBox.height /= PMONITOR->scale; - } - pixman_region32_t fakeDamage; pixman_region32_init_rect(&fakeDamage, 0, 0, PMONITOR->vecPixelSize.x, PMONITOR->vecPixelSize.y);