Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit e455e349 authored by Bhushan Shah's avatar Bhushan Shah 📱

effects: attempt to screenshot on OpenGL ES 2.0 instead of failing

Summary:
Current code path was attempting to use both framebuffer blit and
glReadPixels on OpenGL ES, instead change the code to use framebuffer
blit and glGetTexImage on OpenGL and glReadPixels on the OpenGLES as it
doesn't have glGetTexImage available.

Test Plan: tested on Nexus 5X.

Reviewers: #kwin, davidedmundson, graesslin

Reviewed By: #kwin, graesslin

Subscribers: kwin

Tags: #kwin

Maniphest Tasks: T10011

Differential Revision: https://phabricator.kde.org/D16802
parent 21aee588
......@@ -548,22 +548,18 @@ QImage ScreenShotEffect::blitScreenshot(const QRect &geometry)
QImage img;
if (effects->isOpenGLCompositing())
{
if (!GLRenderTarget::blitSupported()) {
qCDebug(KWINEFFECTS) << "Framebuffer Blit not supported";
return img;
}
GLTexture tex(GL_RGBA8, geometry.width(), geometry.height());
GLRenderTarget target(tex);
target.blitFromFramebuffer(geometry);
// copy content from framebuffer into image
tex.bind();
img = QImage(geometry.size(), QImage::Format_ARGB32);
if (GLPlatform::instance()->isGLES()) {
glReadPixels(0, 0, img.width(), img.height(), GL_RGBA, GL_UNSIGNED_BYTE, (GLvoid*)img.bits());
} else {
if (GLRenderTarget::blitSupported() && !GLPlatform::instance()->isGLES()) {
GLTexture tex(GL_RGBA8, geometry.width(), geometry.height());
GLRenderTarget target(tex);
target.blitFromFramebuffer(geometry);
// copy content from framebuffer into image
tex.bind();
glGetTexImage(GL_TEXTURE_2D, 0, GL_RGBA, GL_UNSIGNED_BYTE, (GLvoid*)img.bits());
tex.unbind();
} else {
glReadPixels(0, 0, img.width(), img.height(), GL_RGBA, GL_UNSIGNED_BYTE, (GLvoid*)img.bits());
}
tex.unbind();
ScreenShotEffect::convertFromGLImage(img, geometry.width(), geometry.height());
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment