[kwineffects] Pass screen projection matrix to EffectFrame

Exposes the current screen projection matrix in the render pass of
the EffectFrame, so that effects can make use of it.
This commit is contained in:
Martin Gräßlin 2015-12-03 09:50:40 +01:00
parent ef7f7b0179
commit 2e7bc0df87
4 changed files with 32 additions and 0 deletions

View file

@ -1930,6 +1930,7 @@ void EffectFrameImpl::render(QRegion region, double opacity, double frameOpacity
return; // Nothing to display return; // Nothing to display
} }
m_shader = NULL; m_shader = NULL;
setScreenProjectionMatrix(static_cast<EffectsHandlerImpl*>(effects)->scene()->screenProjectionMatrix());
effects->paintEffectFrame(this, region, opacity, frameOpacity); effects->paintEffectFrame(this, region, opacity, frameOpacity);
} }

View file

@ -226,6 +226,10 @@ public:
KWayland::Server::Display *waylandDisplay() const override; KWayland::Server::Display *waylandDisplay() const override;
Scene *scene() const {
return m_scene;
}
public Q_SLOTS: public Q_SLOTS:
void slotCurrentTabAboutToChange(EffectWindow* from, EffectWindow* to); void slotCurrentTabAboutToChange(EffectWindow* from, EffectWindow* to);
void slotTabAdded(EffectWindow* from, EffectWindow* to); void slotTabAdded(EffectWindow* from, EffectWindow* to);

View file

@ -1788,6 +1788,7 @@ public:
bool crossFading; bool crossFading;
qreal crossFadeProgress; qreal crossFadeProgress;
QMatrix4x4 screenProjectionMatrix;
}; };
EffectFramePrivate::EffectFramePrivate() EffectFramePrivate::EffectFramePrivate()
@ -1833,6 +1834,16 @@ void EffectFrame::enableCrossFade(bool enable)
d->crossFading = enable; d->crossFading = enable;
} }
QMatrix4x4 EffectFrame::screenProjectionMatrix() const
{
return d->screenProjectionMatrix;
}
void EffectFrame::setScreenProjectionMatrix(const QMatrix4x4 &spm)
{
d->screenProjectionMatrix = spm;
}
} // namespace } // namespace
#include "kwineffects.moc" #include "kwineffects.moc"

View file

@ -2937,6 +2937,22 @@ public:
**/ **/
qreal crossFadeProgress() const; 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: private:
EffectFramePrivate* const d; EffectFramePrivate* const d;
}; };