aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Edmundson <[email protected]>2017-03-06 00:39:26 +0000
committerDavid Edmundson <[email protected]>2017-04-28 10:23:13 +0100
commit71600d0a027d4588328a71db4059842a594d4460 (patch)
tree7515c3fb3379f5175e9ac6bb85e7332c083600c5
parent24c9194f4c95d61a0f9df6de673d79f28aa6aee6 (diff)
Take into account scaling in blitFromFrameBuffer
Summary: This method already translates to s_virtualScreenGeometry as the source co-ordinates are in compostior space we should take scaling into account here too. This method already supports resizing if source and target sizes do not match. Calling funcitons can either double the size of the target if they want native resolution or leave as-is if they want the result in standard DPI. This implements scaling in the screenshot, magnifier and simple blur effect. Test Plan: Tested screenshot effect using spectacle. I hit an (unrelated, was reproducible on master) crash whilst using this, so it is not fully tested Ran magnifier effect manually Reviewers: #plasma Subscribers: plasma-devel, kwin, #kwin Tags: #kwin Differential Revision: https://phabricator.kde.org/D4951
-rw-r--r--libkwineffects/kwinglutils.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/libkwineffects/kwinglutils.cpp b/libkwineffects/kwinglutils.cpp
index 36f219c..b7514e1 100644
--- a/libkwineffects/kwinglutils.cpp
+++ b/libkwineffects/kwinglutils.cpp
@@ -1240,8 +1240,10 @@ void GLRenderTarget::blitFromFramebuffer(const QRect &source, const QRect &desti
const QRect s = source.isNull() ? s_virtualScreenGeometry : source;
const QRect d = destination.isNull() ? QRect(0, 0, mTexture.width(), mTexture.height()) : destination;
- glBlitFramebuffer(s.x() - s_virtualScreenGeometry.x(), s_virtualScreenGeometry.height() - s_virtualScreenGeometry.y() - s.y() - s.height(),
- s.x() - s_virtualScreenGeometry.x() + s.width(), s_virtualScreenGeometry.height() - s_virtualScreenGeometry.y() - s.y(),
+ glBlitFramebuffer((s.x() - s_virtualScreenGeometry.x()) * s_virtualScreenScale,
+ (s_virtualScreenGeometry.height() - s_virtualScreenGeometry.y() - s.y() - s.height()) * s_virtualScreenScale,
+ (s.x() - s_virtualScreenGeometry.x() + s.width()) * s_virtualScreenScale,
+ (s_virtualScreenGeometry.height() - s_virtualScreenGeometry.y() - s.y()) * s_virtualScreenScale,
d.x(), mTexture.height() - d.y() - d.height(), d.x() + d.width(), mTexture.height() - d.y(),
GL_COLOR_BUFFER_BIT, filter);
GLRenderTarget::popRenderTarget();