diff --git a/libkwineffects/kwineffects.cpp b/libkwineffects/kwineffects.cpp
index 56a4305977..e3c4c7682a 100644
--- a/libkwineffects/kwineffects.cpp
+++ b/libkwineffects/kwineffects.cpp
@@ -418,13 +418,30 @@ WindowPaintData &WindowPaintData::operator+=(const QVector3D &translation)
return *this;
}
+class ScreenPaintData::Private
+{
+public:
+ QMatrix4x4 projectionMatrix;
+};
+
ScreenPaintData::ScreenPaintData()
: PaintData()
+ , d(new Private())
{
}
+ScreenPaintData::ScreenPaintData(const QMatrix4x4 &projectionMatrix)
+ : PaintData()
+ , d(new Private())
+{
+ d->projectionMatrix = projectionMatrix;
+}
+
+ScreenPaintData::~ScreenPaintData() = default;
+
ScreenPaintData::ScreenPaintData(const ScreenPaintData &other)
: PaintData()
+ , d(new Private())
{
translate(other.translation());
setXScale(other.xScale());
@@ -433,6 +450,7 @@ ScreenPaintData::ScreenPaintData(const ScreenPaintData &other)
setRotationOrigin(other.rotationOrigin());
setRotationAxis(other.rotationAxis());
setRotationAngle(other.rotationAngle());
+ d->projectionMatrix = other.d->projectionMatrix;
}
ScreenPaintData &ScreenPaintData::operator=(const ScreenPaintData &rhs)
@@ -446,6 +464,7 @@ ScreenPaintData &ScreenPaintData::operator=(const ScreenPaintData &rhs)
setRotationOrigin(rhs.rotationOrigin());
setRotationAxis(rhs.rotationAxis());
setRotationAngle(rhs.rotationAngle());
+ d->projectionMatrix = rhs.d->projectionMatrix;
return *this;
}
@@ -493,6 +512,11 @@ ScreenPaintData &ScreenPaintData::operator+=(const QVector3D &translation)
return *this;
}
+QMatrix4x4 ScreenPaintData::projectionMatrix() const
+{
+ return d->projectionMatrix;
+}
+
//****************************************
// Effect
//****************************************
diff --git a/libkwineffects/kwineffects.h b/libkwineffects/kwineffects.h
index 068b48b185..7fb7440b85 100644
--- a/libkwineffects/kwineffects.h
+++ b/libkwineffects/kwineffects.h
@@ -40,6 +40,7 @@ along with this program. If not, see .
#include
#include
#include
+#include
#include
@@ -2419,7 +2420,9 @@ class KWINEFFECTS_EXPORT ScreenPaintData : public PaintData
{
public:
ScreenPaintData();
+ ScreenPaintData(const QMatrix4x4 &projectionMatrix);
ScreenPaintData(const ScreenPaintData &other);
+ virtual ~ScreenPaintData();
/**
* Scales the screen by @p scale factor.
* Multiplies all three components by the given factor.
@@ -2462,6 +2465,16 @@ public:
**/
ScreenPaintData& operator+=(const QVector3D &translation);
ScreenPaintData& operator=(const ScreenPaintData &rhs);
+
+ /**
+ * The projection matrix used by the scene for the current rendering pass.
+ * On non-OpenGL compositors it's set to Identity matrix.
+ * @since 5.6
+ **/
+ QMatrix4x4 projectionMatrix() const;
+private:
+ class Private;
+ QScopedPointer d;
};
class KWINEFFECTS_EXPORT ScreenPrePaintData
diff --git a/scene.cpp b/scene.cpp
index ad5ca6d929..41845fc607 100644
--- a/scene.cpp
+++ b/scene.cpp
@@ -106,7 +106,7 @@ Scene::~Scene()
// returns mask and possibly modified region
void Scene::paintScreen(int* mask, const QRegion &damage, const QRegion &repaint,
- QRegion *updateRegion, QRegion *validRegion)
+ QRegion *updateRegion, QRegion *validRegion, const QMatrix4x4 &projection)
{
const QSize &screenSize = screens()->size();
const QRegion displayRegion(0, 0, screenSize.width(), screenSize.height());
@@ -146,7 +146,7 @@ void Scene::paintScreen(int* mask, const QRegion &damage, const QRegion &repaint
paintBackground(region);
}
- ScreenPaintData data;
+ ScreenPaintData data(projection);
effects->paintScreen(*mask, region, data);
foreach (Window *w, stacking_order) {
diff --git a/scene.h b/scene.h
index 9c947d980d..b238f6c632 100644
--- a/scene.h
+++ b/scene.h
@@ -26,6 +26,7 @@ along with this program. If not, see .
#include "kwineffects.h"
#include
+#include
class QOpenGLFramebufferObject;
@@ -158,7 +159,7 @@ protected:
void clearStackingOrder();
// shared implementation, starts painting the screen
void paintScreen(int *mask, const QRegion &damage, const QRegion &repaint,
- QRegion *updateRegion, QRegion *validRegion);
+ QRegion *updateRegion, QRegion *validRegion, const QMatrix4x4 &projection = QMatrix4x4());
friend class EffectsHandlerImpl;
// called after all effects had their paintScreen() called
void finalPaintScreen(int mask, QRegion region, ScreenPaintData& data);
diff --git a/scene_opengl.cpp b/scene_opengl.cpp
index 1363c33c75..e4baa755b3 100644
--- a/scene_opengl.cpp
+++ b/scene_opengl.cpp
@@ -728,7 +728,7 @@ qint64 SceneOpenGL::paint(QRegion damage, ToplevelList toplevels)
int mask = 0;
updateProjectionMatrix();
- paintScreen(&mask, damage.intersected(geo), repaint, &update, &valid); // call generic implementation
+ paintScreen(&mask, damage.intersected(geo), repaint, &update, &valid, projectionMatrix()); // call generic implementation
GLVertexBuffer::streamingBuffer()->endOfFrame();
@@ -748,7 +748,7 @@ qint64 SceneOpenGL::paint(QRegion damage, ToplevelList toplevels)
int mask = 0;
updateProjectionMatrix();
- paintScreen(&mask, damage, repaint, &updateRegion, &validRegion); // call generic implementation
+ paintScreen(&mask, damage, repaint, &updateRegion, &validRegion, projectionMatrix()); // call generic implementation
if (!GLPlatform::instance()->isGLES()) {
const QSize &screenSize = screens()->size();