screenshot: Account for render target scale when rendering

This commit is contained in:
Arjen Hiemstra 2022-08-04 15:33:07 +02:00
parent 239bbf93f4
commit f791eb8fa7

View file

@ -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,