effects/screenshot: fix the screenshot on GLES
We want to multiply the width/height by scale weather or not we are
using GLES or not, otherwise this will only provide part of screen when
used with e.g fullscreen screenshot.
(cherry picked from commit 5e6c81eea0
)
icc-effect-5.20.5
parent
00570eb741
commit
7b4925f761
|
@ -694,15 +694,12 @@ QImage ScreenShotEffect::blitScreenshot(const QRect &geometry, const qreal scale
|
||||||
QImage img;
|
QImage img;
|
||||||
if (effects->isOpenGLCompositing())
|
if (effects->isOpenGLCompositing())
|
||||||
{
|
{
|
||||||
int width = geometry.width();
|
const QSize nativeSize = geometry.size() * scale;
|
||||||
int height = geometry.height();
|
|
||||||
if (GLRenderTarget::blitSupported() && !GLPlatform::instance()->isGLES()) {
|
if (GLRenderTarget::blitSupported() && !GLPlatform::instance()->isGLES()) {
|
||||||
|
|
||||||
width = static_cast<int>(width * scale);
|
img = QImage(nativeSize.width(), nativeSize.height(), QImage::Format_ARGB32);
|
||||||
height = static_cast<int>(height * scale);
|
GLTexture tex(GL_RGBA8, nativeSize.width(), nativeSize.height());
|
||||||
|
|
||||||
img = QImage(width, height, QImage::Format_ARGB32);
|
|
||||||
GLTexture tex(GL_RGBA8, width, height);
|
|
||||||
GLRenderTarget target(tex);
|
GLRenderTarget target(tex);
|
||||||
target.blitFromFramebuffer(geometry);
|
target.blitFromFramebuffer(geometry);
|
||||||
// copy content from framebuffer into image
|
// copy content from framebuffer into image
|
||||||
|
@ -710,10 +707,10 @@ QImage ScreenShotEffect::blitScreenshot(const QRect &geometry, const qreal scale
|
||||||
glGetTexImage(GL_TEXTURE_2D, 0, GL_RGBA, GL_UNSIGNED_BYTE, static_cast<GLvoid*>(img.bits()));
|
glGetTexImage(GL_TEXTURE_2D, 0, GL_RGBA, GL_UNSIGNED_BYTE, static_cast<GLvoid*>(img.bits()));
|
||||||
tex.unbind();
|
tex.unbind();
|
||||||
} else {
|
} else {
|
||||||
img = QImage(width, height, QImage::Format_ARGB32);
|
img = QImage(nativeSize.width(), nativeSize.height(), QImage::Format_ARGB32);
|
||||||
glReadPixels(0, 0, width, height, GL_RGBA, GL_UNSIGNED_BYTE, (GLvoid*)img.bits());
|
glReadPixels(0, 0, nativeSize.width(), nativeSize.height(), GL_RGBA, GL_UNSIGNED_BYTE, (GLvoid*)img.bits());
|
||||||
}
|
}
|
||||||
ScreenShotEffect::convertFromGLImage(img, width, height);
|
ScreenShotEffect::convertFromGLImage(img, nativeSize.width(), nativeSize.height());
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef KWIN_HAVE_XRENDER_COMPOSITING
|
#ifdef KWIN_HAVE_XRENDER_COMPOSITING
|
||||||
|
|
Loading…
Reference in New Issue