diff --git a/effects/screenshot/screenshot.cpp b/effects/screenshot/screenshot.cpp index 14eaf7e0bf..8633c28e5a 100644 --- a/effects/screenshot/screenshot.cpp +++ b/effects/screenshot/screenshot.cpp @@ -128,9 +128,13 @@ void ScreenShotEffect::postPaintScreen() glClearColor(0.0, 0.0, 0.0, 0.0); glClear(GL_COLOR_BUFFER_BIT); glClearColor(0.0, 0.0, 0.0, 1.0); - setMatrix(offscreenTexture->width(), offscreenTexture->height()); + + QMatrix4x4 projection; + projection.ortho(QRect(0, 0, offscreenTexture->width(), offscreenTexture->height())); + d.setProjectionMatrix(projection); + effects->drawWindow(m_scheduledScreenshot, mask, infiniteRegion(), d); - restoreMatrix(); + // copy content from framebuffer into image img = QImage(QSize(width, height), QImage::Format_ARGB32); glReadnPixels(0, 0, width, height, GL_RGBA, GL_UNSIGNED_BYTE, img.byteCount(), (GLvoid*)img.bits()); @@ -174,30 +178,6 @@ void ScreenShotEffect::postPaintScreen() } } -static QMatrix4x4 s_origProjection; -static QMatrix4x4 s_origModelview; - -void ScreenShotEffect::setMatrix(int width, int height) -{ - QMatrix4x4 projection; - QMatrix4x4 identity; - projection.ortho(QRect(0, 0, width, height)); - ShaderBinder binder(ShaderManager::GenericShader); - GLShader *shader = binder.shader(); - s_origProjection = shader->getUniformMatrix4x4("projection"); - s_origModelview = shader->getUniformMatrix4x4("modelview"); - shader->setUniform(GLShader::ProjectionMatrix, projection); - shader->setUniform(GLShader::ModelViewMatrix, identity); -} - -void ScreenShotEffect::restoreMatrix() -{ - ShaderBinder binder(ShaderManager::GenericShader); - GLShader *shader = binder.shader(); - shader->setUniform(GLShader::ProjectionMatrix, s_origProjection); - shader->setUniform(GLShader::ModelViewMatrix, s_origModelview); -} - void ScreenShotEffect::screenshotWindowUnderCursor(int mask) { m_type = (ScreenShotType)mask; diff --git a/effects/screenshot/screenshot.h b/effects/screenshot/screenshot.h index eed72a54ba..dcb6149e21 100644 --- a/effects/screenshot/screenshot.h +++ b/effects/screenshot/screenshot.h @@ -84,8 +84,6 @@ private Q_SLOTS: private: void grabPointerImage(QImage& snapshot, int offsetx, int offsety); QString blitScreenshot(const QRect &geometry); - void setMatrix(int width, int height); - void restoreMatrix(); EffectWindow *m_scheduledScreenshot; ScreenShotType m_type; };