aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Edmundson <[email protected]>2017-03-06 00:38:37 +0000
committerDavid Edmundson <[email protected]>2017-04-28 10:23:13 +0100
commit9ce5832e11bcecd125c2ef2cc200a586bdacb12e (patch)
tree46af82e5f780b3a0a2ded4c22016f28274ede798
parent86b7189b8f2bde65d1439709ed9149a429bbe1cb (diff)
Store GLRenderTarget::scale
Summary: GLRenderTarget already stores the translation from global compositor space to the render target co-ordinates, we also need a scale factor for the exact same reasons. Test Plan: Used in various effects after this patch and it works there. Reviewers: #plasma Subscribers: plasma-devel, kwin, #kwin Tags: #kwin Differential Revision: https://phabricator.kde.org/D4948
-rw-r--r--libkwineffects/kwinglutils.cpp1
-rw-r--r--libkwineffects/kwinglutils.h16
-rw-r--r--scene_opengl.cpp2
3 files changed, 19 insertions, 0 deletions
diff --git a/libkwineffects/kwinglutils.cpp b/libkwineffects/kwinglutils.cpp
index 06a49de..36f219c 100644
--- a/libkwineffects/kwinglutils.cpp
+++ b/libkwineffects/kwinglutils.cpp
@@ -1037,6 +1037,7 @@ bool GLRenderTarget::s_blitSupported = false;
QStack<GLRenderTarget*> GLRenderTarget::s_renderTargets = QStack<GLRenderTarget*>();
QSize GLRenderTarget::s_virtualScreenSize;
QRect GLRenderTarget::s_virtualScreenGeometry;
+qreal GLRenderTarget::s_virtualScreenScale = 1.0;
void GLRenderTarget::initStatic()
{
diff --git a/libkwineffects/kwinglutils.h b/libkwineffects/kwinglutils.h
index 95bf5c5..9d19355 100644
--- a/libkwineffects/kwinglutils.h
+++ b/libkwineffects/kwinglutils.h
@@ -505,6 +505,21 @@ public:
return s_virtualScreenGeometry;
}
+ /**
+ * The scale of the OpenGL window currently being rendered to
+ *
+ * @returns the ratio between the virtual geometry space the rendering
+ * system uses and the target
+ * @since 5.10
+ */
+ static void setVirtualScreenScale(qreal scale) {
+ s_virtualScreenScale = scale;
+ }
+
+ static qreal virtualScreenScale() {
+ return s_virtualScreenScale;
+ }
+
protected:
void initFBO();
@@ -518,6 +533,7 @@ private:
static QStack<GLRenderTarget*> s_renderTargets;
static QSize s_virtualScreenSize;
static QRect s_virtualScreenGeometry;
+ static qreal s_virtualScreenScale;
GLTexture mTexture;
bool mValid;
diff --git a/scene_opengl.cpp b/scene_opengl.cpp
index 8ebebae..22debbd 100644
--- a/scene_opengl.cpp
+++ b/scene_opengl.cpp
@@ -700,6 +700,7 @@ qint64 SceneOpenGL::paint(QRegion damage, ToplevelList toplevels)
QRegion repaint = m_backend->prepareRenderingForScreen(i);
GLVertexBuffer::setVirtualScreenGeometry(geo);
GLRenderTarget::setVirtualScreenGeometry(geo);
+ GLRenderTarget::setVirtualScreenScale(screens()->scale(i));
const GLenum status = glGetGraphicsResetStatus();
if (status != GL_NO_ERROR) {
@@ -728,6 +729,7 @@ qint64 SceneOpenGL::paint(QRegion damage, ToplevelList toplevels)
}
GLVertexBuffer::setVirtualScreenGeometry(screens()->geometry());
GLRenderTarget::setVirtualScreenGeometry(screens()->geometry());
+ GLRenderTarget::setVirtualScreenScale(1);
int mask = 0;
updateProjectionMatrix();