From 24dfdd70c0c472148820d352838dfc5687651ba9 Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Wed, 15 Jun 2022 12:43:39 +0300 Subject: [PATCH] effects: Drop WindowPaintData::modelViewMatrix() It's unused and it conflicts in a way with PaintData::translation(), PaintData::rotationAngle() and PaintData::scale(). --- src/libkwineffects/kwineffects.cpp | 17 ----------------- src/libkwineffects/kwineffects.h | 22 +--------------------- src/scenes/opengl/scene_opengl.cpp | 20 +++++--------------- src/scenes/opengl/scene_opengl.h | 2 +- 4 files changed, 7 insertions(+), 54 deletions(-) diff --git a/src/libkwineffects/kwineffects.cpp b/src/libkwineffects/kwineffects.cpp index c34b91fcfc..ffcdb6e00d 100644 --- a/src/libkwineffects/kwineffects.cpp +++ b/src/libkwineffects/kwineffects.cpp @@ -217,7 +217,6 @@ public: int screen; qreal crossFadeProgress; QMatrix4x4 pMatrix; - QMatrix4x4 mvMatrix; QMatrix4x4 screenProjectionMatrix; }; @@ -257,7 +256,6 @@ WindowPaintData::WindowPaintData(const WindowPaintData &other) setScreen(other.screen()); setCrossFadeProgress(other.crossFadeProgress()); setProjectionMatrix(other.projectionMatrix()); - setModelViewMatrix(other.modelViewMatrix()); d->screenProjectionMatrix = other.d->screenProjectionMatrix; } @@ -349,21 +347,6 @@ QMatrix4x4 &WindowPaintData::rprojectionMatrix() return d->pMatrix; } -void WindowPaintData::setModelViewMatrix(const QMatrix4x4 &matrix) -{ - d->mvMatrix = matrix; -} - -QMatrix4x4 WindowPaintData::modelViewMatrix() const -{ - return d->mvMatrix; -} - -QMatrix4x4 &WindowPaintData::rmodelViewMatrix() -{ - return d->mvMatrix; -} - WindowPaintData &WindowPaintData::operator*=(qreal scale) { this->setXScale(this->xScale() * scale); diff --git a/src/libkwineffects/kwineffects.h b/src/libkwineffects/kwineffects.h index c4a81f0ac5..f46e812897 100644 --- a/src/libkwineffects/kwineffects.h +++ b/src/libkwineffects/kwineffects.h @@ -2545,7 +2545,7 @@ public: */ virtual bool isCriticalNotification() const = 0; /** - * Returns whether the window is a window used for applet popups. + * Returns whether the window is a window used for applet popups. */ virtual bool isAppletPopup() const = 0; /** @@ -3274,26 +3274,6 @@ public: */ QMatrix4x4 &rprojectionMatrix(); - /** - * Sets the model-view matrix that will be used when painting the window. - * - * The default model-view matrix can be overridden by setting this matrix - * to a non-identity matrix. - */ - void setModelViewMatrix(const QMatrix4x4 &matrix); - - /** - * Returns the current model-view matrix. - * - * The default value for this matrix is the identity matrix. - */ - QMatrix4x4 modelViewMatrix() const; - - /** - * Returns a reference to the model-view matrix. - */ - QMatrix4x4 &rmodelViewMatrix(); - /** * Returns The projection matrix as used by the current screen painting pass * including screen transformations. diff --git a/src/scenes/opengl/scene_opengl.cpp b/src/scenes/opengl/scene_opengl.cpp index 1a85786412..50c49774ff 100644 --- a/src/scenes/opengl/scene_opengl.cpp +++ b/src/scenes/opengl/scene_opengl.cpp @@ -444,10 +444,9 @@ void SceneOpenGL::createRenderNode(Item *item, RenderContext *context) context->opacityStack.pop(); } -QMatrix4x4 SceneOpenGL::modelViewProjectionMatrix(int mask, const WindowPaintData &data) const +QMatrix4x4 SceneOpenGL::modelViewProjectionMatrix(const WindowPaintData &data) const { const QMatrix4x4 pMatrix = data.projectionMatrix(); - const QMatrix4x4 mvMatrix = data.modelViewMatrix(); // An effect may want to override the default projection matrix in some cases, // such as when it is rendering a window on a render target that doesn't have @@ -455,17 +454,9 @@ QMatrix4x4 SceneOpenGL::modelViewProjectionMatrix(int mask, const WindowPaintDat // // Note that the screen transformation is not applied here. if (!pMatrix.isIdentity()) { - return pMatrix * mvMatrix; + return pMatrix; } - - // If an effect has specified a model-view matrix, we multiply that matrix - // with the default projection matrix. If the effect hasn't specified a - // model-view matrix, mvMatrix will be the identity matrix. - if (mask & Scene::PAINT_SCREEN_TRANSFORMED) { - return screenProjectionMatrix() * mvMatrix; - } - - return renderTargetProjectionMatrix() * mvMatrix; + return m_screenProjectionMatrix; } static QMatrix4x4 transformForPaintData(int mask, const WindowPaintData &data) @@ -589,7 +580,7 @@ void SceneOpenGL::render(Item *item, int mask, const QRegion ®ion, const Wind scissorRegion = mapToRenderTarget(region); } - const QMatrix4x4 modelViewProjection = modelViewProjectionMatrix(mask, data); + const QMatrix4x4 projectionMatrix = modelViewProjectionMatrix(data); for (int i = 0; i < renderContext.renderNodes.count(); i++) { const RenderNode &renderNode = renderContext.renderNodes[i]; if (renderNode.vertexCount == 0) { @@ -598,8 +589,7 @@ void SceneOpenGL::render(Item *item, int mask, const QRegion ®ion, const Wind setBlendEnabled(renderNode.hasAlpha || renderNode.opacity < 1.0); - shader->setUniform(GLShader::ModelViewProjectionMatrix, - modelViewProjection * renderNode.transformMatrix); + shader->setUniform(GLShader::ModelViewProjectionMatrix, projectionMatrix * renderNode.transformMatrix); if (opacity != renderNode.opacity) { shader->setUniform(GLShader::ModulationConstant, modulate(renderNode.opacity, data.brightness())); diff --git a/src/scenes/opengl/scene_opengl.h b/src/scenes/opengl/scene_opengl.h index 8e83dddf4c..672c41ec13 100644 --- a/src/scenes/opengl/scene_opengl.h +++ b/src/scenes/opengl/scene_opengl.h @@ -90,7 +90,7 @@ protected: private: void doPaintBackground(const QVector &vertices); - QMatrix4x4 modelViewProjectionMatrix(int mask, const WindowPaintData &data) const; + QMatrix4x4 modelViewProjectionMatrix(const WindowPaintData &data) const; QVector4D modulate(float opacity, float brightness) const; void setBlendEnabled(bool enabled); void createRenderNode(Item *item, RenderContext *context);