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.
This commit is contained in:
parent
1473466ef7
commit
ac16bef409
1 changed files with 1 additions and 6 deletions
|
@ -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<GLvoid *>(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,
|
||||
|
|
Loading…
Reference in a new issue