Revert "screenshot: Reuse GLTexture::toImage"

This reverts commit ac16bef409.

It causes crashes and color channels seem to be swapped.

GLTexture::toImage() needs more work before it can be used in the
screenshot effect, or maybe dropped.
This commit is contained in:
Vlad Zahorodnii 2021-08-16 12:28:40 +03:00
parent 46980c0bb4
commit 4af9674f17

View file

@ -361,10 +361,15 @@ 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);
image = texture.toImage();
// 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();
} else {
image = QImage(nativeSize.width(), nativeSize.height(), QImage::Format_ARGB32);
glReadPixels(0, 0, nativeSize.width(), nativeSize.height(), GL_RGBA,