From ac16bef409a758fa2071c552bc36c0aa6e31af7f Mon Sep 17 00:00:00 2001 From: Aleix Pol Date: Thu, 29 Jul 2021 17:42:29 +0200 Subject: [PATCH] screenshot: Reuse GLTexture::toImage Cleans the code a bit. It also makes use of the more performant Qt::Format_RGBA8888_Premultiplied, which is nice to come by. --- src/effects/screenshot/screenshot.cpp | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/effects/screenshot/screenshot.cpp b/src/effects/screenshot/screenshot.cpp index 20933d7cfc..3357172e5a 100644 --- a/src/effects/screenshot/screenshot.cpp +++ b/src/effects/screenshot/screenshot.cpp @@ -361,15 +361,10 @@ QImage ScreenShotEffect::blitScreenshot(const QRect &geometry, qreal devicePixel const QSize nativeSize = geometry.size() * devicePixelRatio; if (GLRenderTarget::blitSupported() && !GLPlatform::instance()->isGLES()) { - image = QImage(nativeSize.width(), nativeSize.height(), QImage::Format_ARGB32); GLTexture texture(GL_RGBA8, nativeSize.width(), nativeSize.height()); GLRenderTarget target(texture); target.blitFromFramebuffer(geometry); - // copy content from framebuffer into image - texture.bind(); - glGetTexImage(GL_TEXTURE_2D, 0, GL_RGBA, GL_UNSIGNED_BYTE, - static_cast(image.bits())); - texture.unbind(); + image = texture.toImage(); } else { image = QImage(nativeSize.width(), nativeSize.height(), QImage::Format_ARGB32); glReadPixels(0, 0, nativeSize.width(), nativeSize.height(), GL_RGBA,