diff --git a/effects.cpp b/effects.cpp index ebb7520bc5..ead8dedb68 100644 --- a/effects.cpp +++ b/effects.cpp @@ -1930,6 +1930,7 @@ void EffectFrameImpl::render(QRegion region, double opacity, double frameOpacity return; // Nothing to display } m_shader = NULL; + setScreenProjectionMatrix(static_cast(effects)->scene()->screenProjectionMatrix()); effects->paintEffectFrame(this, region, opacity, frameOpacity); } diff --git a/effects.h b/effects.h index 1d0652a872..dfe6f12b07 100644 --- a/effects.h +++ b/effects.h @@ -226,6 +226,10 @@ public: KWayland::Server::Display *waylandDisplay() const override; + Scene *scene() const { + return m_scene; + } + public Q_SLOTS: void slotCurrentTabAboutToChange(EffectWindow* from, EffectWindow* to); void slotTabAdded(EffectWindow* from, EffectWindow* to); diff --git a/libkwineffects/kwineffects.cpp b/libkwineffects/kwineffects.cpp index 0581dc4c17..b767f66712 100644 --- a/libkwineffects/kwineffects.cpp +++ b/libkwineffects/kwineffects.cpp @@ -1788,6 +1788,7 @@ public: bool crossFading; qreal crossFadeProgress; + QMatrix4x4 screenProjectionMatrix; }; EffectFramePrivate::EffectFramePrivate() @@ -1833,6 +1834,16 @@ void EffectFrame::enableCrossFade(bool enable) d->crossFading = enable; } +QMatrix4x4 EffectFrame::screenProjectionMatrix() const +{ + return d->screenProjectionMatrix; +} + +void EffectFrame::setScreenProjectionMatrix(const QMatrix4x4 &spm) +{ + d->screenProjectionMatrix = spm; +} + } // namespace #include "kwineffects.moc" diff --git a/libkwineffects/kwineffects.h b/libkwineffects/kwineffects.h index 5f72822ac0..4350e2b1c8 100644 --- a/libkwineffects/kwineffects.h +++ b/libkwineffects/kwineffects.h @@ -2937,6 +2937,22 @@ public: **/ qreal crossFadeProgress() const; + /** + * Returns The projection matrix as used by the current screen painting pass + * including screen transformations. + * + * This matrix is only valid during a rendering pass started by render. + * + * @since 5.6 + * @see render + * @see EffectsHandler::paintEffectFrame + * @see Effect::paintEffectFrame + **/ + QMatrix4x4 screenProjectionMatrix() const; + +protected: + void setScreenProjectionMatrix(const QMatrix4x4 &projection); + private: EffectFramePrivate* const d; };