From f791eb8fa7902b51561003b0df19dc20096c70f2 Mon Sep 17 00:00:00 2001 From: Arjen Hiemstra Date: Thu, 4 Aug 2022 15:33:07 +0200 Subject: [PATCH] screenshot: Account for render target scale when rendering --- src/effects/screenshot/screenshot.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/effects/screenshot/screenshot.cpp b/src/effects/screenshot/screenshot.cpp index c07502c388..f724a7d4e9 100644 --- a/src/effects/screenshot/screenshot.cpp +++ b/src/effects/screenshot/screenshot.cpp @@ -257,7 +257,7 @@ void ScreenShotEffect::takeScreenShot(ScreenShotWindowData *screenshot) glClearColor(0.0, 0.0, 0.0, 1.0); QMatrix4x4 projection; - projection.ortho(QRect(0, 0, geometry.width(), geometry.height())); + projection.ortho(QRect(0, 0, geometry.width() * devicePixelRatio, geometry.height() * devicePixelRatio)); d.setProjectionMatrix(projection); effects->drawWindow(window, mask, infiniteRegion(), d); @@ -358,7 +358,7 @@ QImage ScreenShotEffect::blitScreenshot(const QRect &geometry, qreal devicePixel image = QImage(nativeSize.width(), nativeSize.height(), QImage::Format_ARGB32); GLTexture texture(GL_RGBA8, nativeSize.width(), nativeSize.height()); GLFramebuffer target(&texture); - target.blitFromFramebuffer(effects->mapToRenderTarget(geometry)); + target.blitFromFramebuffer(effects->mapToRenderTarget(QRectF(geometry)).toRect()); // copy content from framebuffer into image texture.bind(); glGetTexImage(GL_TEXTURE_2D, 0, GL_RGBA, GL_UNSIGNED_BYTE,