diff --git a/src/effects/blendchanges/blendchanges.cpp b/src/effects/blendchanges/blendchanges.cpp index 21a4aa766c..8d420df429 100644 --- a/src/effects/blendchanges/blendchanges.cpp +++ b/src/effects/blendchanges/blendchanges.cpp @@ -16,7 +16,7 @@ namespace KWin { BlendChanges::BlendChanges() - : DeformEffect() + : OffscreenEffect() { QDBusConnection::sessionBus().registerObject(QStringLiteral("/org/kde/KWin/BlendChanges"), QStringLiteral("org.kde.KWin.BlendChanges"), @@ -67,11 +67,11 @@ void BlendChanges::drawWindow(EffectWindow *window, int mask, const QRegion ® } // then the old on top, it works better than changing both alphas with the current blend mode if (m_state != Off) { - DeformEffect::drawWindow(window, mask, region, data); + OffscreenEffect::drawWindow(window, mask, region, data); } } -void BlendChanges::deform(EffectWindow *window, int mask, WindowPaintData &data, WindowQuadList &quads) +void BlendChanges::apply(EffectWindow *window, int mask, WindowPaintData &data, WindowQuadList &quads) { Q_UNUSED(window) Q_UNUSED(mask) diff --git a/src/effects/blendchanges/blendchanges.h b/src/effects/blendchanges/blendchanges.h index 946035bfac..a55c1ac7db 100644 --- a/src/effects/blendchanges/blendchanges.h +++ b/src/effects/blendchanges/blendchanges.h @@ -8,13 +8,13 @@ */ #pragma once #include -#include +#include #include namespace KWin { -class BlendChanges : public DeformEffect +class BlendChanges : public OffscreenEffect { Q_OBJECT @@ -28,7 +28,7 @@ public: void prePaintScreen(ScreenPrePaintData &data, std::chrono::milliseconds presentTime) override; void postPaintScreen() override; void drawWindow(EffectWindow *window, int mask, const QRegion ®ion, WindowPaintData &data) override; - void deform(EffectWindow *window, int mask, WindowPaintData &data, WindowQuadList &quads) override; + void apply(EffectWindow *window, int mask, WindowPaintData &data, WindowQuadList &quads) override; bool isActive() const override; public Q_SLOTS: diff --git a/src/effects/fallapart/fallapart.cpp b/src/effects/fallapart/fallapart.cpp index daf58af713..c6e0db0794 100644 --- a/src/effects/fallapart/fallapart.cpp +++ b/src/effects/fallapart/fallapart.cpp @@ -20,7 +20,7 @@ namespace KWin bool FallApartEffect::supported() { - return DeformEffect::supported() && effects->animationsSupported(); + return OffscreenEffect::supported() && effects->animationsSupported(); } FallApartEffect::FallApartEffect() @@ -62,7 +62,7 @@ void FallApartEffect::prePaintWindow(EffectWindow *w, WindowPrePaintData &data, effects->prePaintWindow(w, data, presentTime); } -void FallApartEffect::deform(EffectWindow *w, int mask, WindowPaintData &data, WindowQuadList &quads) +void FallApartEffect::apply(EffectWindow *w, int mask, WindowPaintData &data, WindowQuadList &quads) { Q_UNUSED(w) Q_UNUSED(mask) diff --git a/src/effects/fallapart/fallapart.h b/src/effects/fallapart/fallapart.h index b26fb2ee95..485f18bd1d 100644 --- a/src/effects/fallapart/fallapart.h +++ b/src/effects/fallapart/fallapart.h @@ -10,7 +10,7 @@ #ifndef KWIN_FALLAPART_H #define KWIN_FALLAPART_H -#include +#include namespace KWin { @@ -23,7 +23,7 @@ struct FallApartAnimation qreal progress = 0; }; -class FallApartEffect : public DeformEffect +class FallApartEffect : public OffscreenEffect { Q_OBJECT Q_PROPERTY(int blockSize READ configuredBlockSize) @@ -49,7 +49,7 @@ public: static bool supported(); protected: - void deform(EffectWindow *w, int mask, WindowPaintData &data, WindowQuadList &quads) override; + void apply(EffectWindow *w, int mask, WindowPaintData &data, WindowQuadList &quads) override; public Q_SLOTS: void slotWindowClosed(KWin::EffectWindow *c); diff --git a/src/effects/magiclamp/magiclamp.cpp b/src/effects/magiclamp/magiclamp.cpp index 0c99fe118b..c1d66ac97f 100644 --- a/src/effects/magiclamp/magiclamp.cpp +++ b/src/effects/magiclamp/magiclamp.cpp @@ -27,7 +27,7 @@ MagicLampEffect::MagicLampEffect() bool MagicLampEffect::supported() { - return DeformEffect::supported() && effects->animationsSupported(); + return OffscreenEffect::supported() && effects->animationsSupported(); } void MagicLampEffect::reconfigure(ReconfigureFlags) @@ -69,7 +69,7 @@ void MagicLampEffect::prePaintWindow(EffectWindow *w, WindowPrePaintData &data, effects->prePaintWindow(w, data, presentTime); } -void MagicLampEffect::deform(EffectWindow *w, int mask, WindowPaintData &data, WindowQuadList &quads) +void MagicLampEffect::apply(EffectWindow *w, int mask, WindowPaintData &data, WindowQuadList &quads) { Q_UNUSED(mask) Q_UNUSED(data) diff --git a/src/effects/magiclamp/magiclamp.h b/src/effects/magiclamp/magiclamp.h index 152107019d..498b8953ed 100644 --- a/src/effects/magiclamp/magiclamp.h +++ b/src/effects/magiclamp/magiclamp.h @@ -10,7 +10,7 @@ #ifndef KWIN_MAGICLAMP_H #define KWIN_MAGICLAMP_H -#include +#include namespace KWin { @@ -21,7 +21,7 @@ struct MagicLampAnimation TimeLine timeLine; }; -class MagicLampEffect : public DeformEffect +class MagicLampEffect : public OffscreenEffect { Q_OBJECT @@ -42,7 +42,7 @@ public: static bool supported(); protected: - void deform(EffectWindow *window, int mask, WindowPaintData &data, WindowQuadList &quads) override; + void apply(EffectWindow *window, int mask, WindowPaintData &data, WindowQuadList &quads) override; public Q_SLOTS: void slotWindowDeleted(KWin::EffectWindow *w); diff --git a/src/effects/wobblywindows/wobblywindows.cpp b/src/effects/wobblywindows/wobblywindows.cpp index 511f56a8bd..23321ee2de 100644 --- a/src/effects/wobblywindows/wobblywindows.cpp +++ b/src/effects/wobblywindows/wobblywindows.cpp @@ -190,7 +190,7 @@ void WobblyWindowsEffect::reconfigure(ReconfigureFlags) bool WobblyWindowsEffect::supported() { - return DeformEffect::supported() && effects->animationsSupported(); + return OffscreenEffect::supported() && effects->animationsSupported(); } void WobblyWindowsEffect::setParameterSet(const ParameterSet &pset) @@ -267,7 +267,7 @@ void WobblyWindowsEffect::prePaintWindow(EffectWindow *w, WindowPrePaintData &da effects->prePaintWindow(w, data, presentTime); } -void WobblyWindowsEffect::deform(EffectWindow *w, int mask, WindowPaintData &data, WindowQuadList &quads) +void WobblyWindowsEffect::apply(EffectWindow *w, int mask, WindowPaintData &data, WindowQuadList &quads) { if (!(mask & PAINT_SCREEN_TRANSFORMED) && windows.contains(w)) { quads = quads.makeRegularGrid(m_xTesselation, m_yTesselation); diff --git a/src/effects/wobblywindows/wobblywindows.h b/src/effects/wobblywindows/wobblywindows.h index 2e7abb5121..26ef919d9e 100644 --- a/src/effects/wobblywindows/wobblywindows.h +++ b/src/effects/wobblywindows/wobblywindows.h @@ -11,7 +11,7 @@ #define KWIN_WOBBLYWINDOWS_H // Include with base class for effects. -#include +#include namespace KWin { @@ -21,7 +21,7 @@ struct ParameterSet; /** * Effect which wobble windows */ -class WobblyWindowsEffect : public DeformEffect +class WobblyWindowsEffect : public OffscreenEffect { Q_OBJECT Q_PROPERTY(qreal stiffness READ stiffness) @@ -129,7 +129,7 @@ public: } protected: - void deform(EffectWindow *w, int mask, WindowPaintData &data, WindowQuadList &quads) override; + void apply(EffectWindow *w, int mask, WindowPaintData &data, WindowQuadList &quads) override; public Q_SLOTS: void slotWindowStartUserMovedResized(KWin::EffectWindow *w); diff --git a/src/libkwineffects/CMakeLists.txt b/src/libkwineffects/CMakeLists.txt index cc1c7ffcb1..2924900234 100644 --- a/src/libkwineffects/CMakeLists.txt +++ b/src/libkwineffects/CMakeLists.txt @@ -12,8 +12,8 @@ ecm_setup_version(${PROJECT_VERSION} set(kwin_EFFECTSLIB_SRCS anidata.cpp kwinanimationeffect.cpp - kwindeformeffect.cpp kwineffects.cpp + kwinoffscreeneffect.cpp kwinoffscreenquickview.cpp kwinquickeffect.cpp logging.cpp @@ -70,13 +70,13 @@ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/kwineffects_export.h ${CMAKE_CURRENT_BINARY_DIR}/kwinglutils_export.h kwinanimationeffect.h - kwindeformeffect.h kwineffects.h kwinglobals.h kwinglplatform.h kwingltexture.h kwinglutils.h kwinglutils_funcs.h + kwinoffscreeneffect.h kwinoffscreenquickview.h kwinquickeffect.h DESTINATION ${KDE_INSTALL_INCLUDEDIR} COMPONENT Devel) diff --git a/src/libkwineffects/kwinanimationeffect.cpp b/src/libkwineffects/kwinanimationeffect.cpp index ebfd6e71da..fd6c8564d3 100644 --- a/src/libkwineffects/kwinanimationeffect.cpp +++ b/src/libkwineffects/kwinanimationeffect.cpp @@ -282,7 +282,7 @@ quint64 AnimationEffect::p_animate(EffectWindow *w, Attribute a, uint meta, int triggerRepaint(); } if (shader) { - DeformEffect::redirect(w); + OffscreenEffect::redirect(w); } return ret_id; } diff --git a/src/libkwineffects/kwinanimationeffect.h b/src/libkwineffects/kwinanimationeffect.h index c86f4591ab..4fb552f486 100644 --- a/src/libkwineffects/kwinanimationeffect.h +++ b/src/libkwineffects/kwinanimationeffect.h @@ -14,7 +14,7 @@ #include #include #include -#include +#include #include namespace KWin @@ -191,7 +191,7 @@ class AnimationEffectPrivate; * * @since 4.8 */ -class KWINEFFECTS_EXPORT AnimationEffect : public DeformEffect +class KWINEFFECTS_EXPORT AnimationEffect : public OffscreenEffect { Q_OBJECT diff --git a/src/libkwineffects/kwindeformeffect.cpp b/src/libkwineffects/kwinoffscreeneffect.cpp similarity index 79% rename from src/libkwineffects/kwindeformeffect.cpp rename to src/libkwineffects/kwinoffscreeneffect.cpp index aa9439ae6b..7e98160b2e 100644 --- a/src/libkwineffects/kwindeformeffect.cpp +++ b/src/libkwineffects/kwinoffscreeneffect.cpp @@ -4,14 +4,14 @@ SPDX-License-Identifier: GPL-2.0-or-later */ -#include "kwindeformeffect.h" +#include "kwinoffscreeneffect.h" #include "kwingltexture.h" #include "kwinglutils.h" namespace KWin { -struct DeformOffscreenData +struct OffscreenData { QScopedPointer texture; QScopedPointer fbo; @@ -19,49 +19,49 @@ struct DeformOffscreenData GLShader *shader = nullptr; }; -class DeformEffectPrivate +class OffscreenEffectPrivate { public: - QHash windows; + QHash windows; QMetaObject::Connection windowDamagedConnection; QMetaObject::Connection windowDeletedConnection; void paint(EffectWindow *window, GLTexture *texture, const QRegion ®ion, const WindowPaintData &data, const WindowQuadList &quads, GLShader *offscreenShader); - GLTexture *maybeRender(EffectWindow *window, DeformOffscreenData *offscreenData); + GLTexture *maybeRender(EffectWindow *window, OffscreenData *offscreenData); bool live = true; }; -DeformEffect::DeformEffect(QObject *parent) +OffscreenEffect::OffscreenEffect(QObject *parent) : Effect(parent) - , d(new DeformEffectPrivate) + , d(new OffscreenEffectPrivate) { } -DeformEffect::~DeformEffect() +OffscreenEffect::~OffscreenEffect() { qDeleteAll(d->windows); } -bool DeformEffect::supported() +bool OffscreenEffect::supported() { return effects->isOpenGLCompositing(); } -void DeformEffect::setLive(bool live) +void OffscreenEffect::setLive(bool live) { Q_ASSERT(d->windows.isEmpty()); d->live = live; } -void DeformEffect::redirect(EffectWindow *window) +void OffscreenEffect::redirect(EffectWindow *window) { - DeformOffscreenData *&offscreenData = d->windows[window]; + OffscreenData *&offscreenData = d->windows[window]; if (offscreenData) { return; } - offscreenData = new DeformOffscreenData; + offscreenData = new OffscreenData; if (d->windows.count() == 1) { setupConnections(); @@ -73,7 +73,7 @@ void DeformEffect::redirect(EffectWindow *window) } } -void DeformEffect::unredirect(EffectWindow *window) +void OffscreenEffect::unredirect(EffectWindow *window) { delete d->windows.take(window); if (d->windows.isEmpty()) { @@ -81,7 +81,7 @@ void DeformEffect::unredirect(EffectWindow *window) } } -void DeformEffect::deform(EffectWindow *window, int mask, WindowPaintData &data, WindowQuadList &quads) +void OffscreenEffect::apply(EffectWindow *window, int mask, WindowPaintData &data, WindowQuadList &quads) { Q_UNUSED(window) Q_UNUSED(mask) @@ -89,7 +89,7 @@ void DeformEffect::deform(EffectWindow *window, int mask, WindowPaintData &data, Q_UNUSED(quads) } -GLTexture *DeformEffectPrivate::maybeRender(EffectWindow *window, DeformOffscreenData *offscreenData) +GLTexture *OffscreenEffectPrivate::maybeRender(EffectWindow *window, OffscreenData *offscreenData) { const QRect geometry = window->expandedGeometry(); QSize textureSize = geometry.size(); @@ -130,7 +130,7 @@ GLTexture *DeformEffectPrivate::maybeRender(EffectWindow *window, DeformOffscree return offscreenData->texture.data(); } -void DeformEffectPrivate::paint(EffectWindow *window, GLTexture *texture, const QRegion ®ion, +void OffscreenEffectPrivate::paint(EffectWindow *window, GLTexture *texture, const QRegion ®ion, const WindowPaintData &data, const WindowQuadList &quads, GLShader *offscreenShader) { GLShader *shader = offscreenShader ? offscreenShader : ShaderManager::instance()->shader(ShaderTrait::MapTexture | ShaderTrait::Modulate | ShaderTrait::AdjustSaturation); @@ -187,9 +187,9 @@ void DeformEffectPrivate::paint(EffectWindow *window, GLTexture *texture, const vbo->unbindArrays(); } -void DeformEffect::drawWindow(EffectWindow *window, int mask, const QRegion ®ion, WindowPaintData &data) +void OffscreenEffect::drawWindow(EffectWindow *window, int mask, const QRegion ®ion, WindowPaintData &data) { - DeformOffscreenData *offscreenData = d->windows.value(window); + OffscreenData *offscreenData = d->windows.value(window); if (!offscreenData) { effects->drawWindow(window, mask, region, data); return; @@ -208,36 +208,36 @@ void DeformEffect::drawWindow(EffectWindow *window, int mask, const QRegion ® WindowQuadList quads; quads.append(quad); - deform(window, mask, data, quads); + apply(window, mask, data, quads); GLTexture *texture = d->maybeRender(window, offscreenData); d->paint(window, texture, region, data, quads, offscreenData->shader); } -void DeformEffect::handleWindowDamaged(EffectWindow *window) +void OffscreenEffect::handleWindowDamaged(EffectWindow *window) { - DeformOffscreenData *offscreenData = d->windows.value(window); + OffscreenData *offscreenData = d->windows.value(window); if (offscreenData) { offscreenData->isDirty = true; } } -void DeformEffect::handleWindowDeleted(EffectWindow *window) +void OffscreenEffect::handleWindowDeleted(EffectWindow *window) { unredirect(window); } -void DeformEffect::setupConnections() +void OffscreenEffect::setupConnections() { if (d->live) { d->windowDamagedConnection = - connect(effects, &EffectsHandler::windowDamaged, this, &DeformEffect::handleWindowDamaged); + connect(effects, &EffectsHandler::windowDamaged, this, &OffscreenEffect::handleWindowDamaged); } d->windowDeletedConnection = - connect(effects, &EffectsHandler::windowDeleted, this, &DeformEffect::handleWindowDeleted); + connect(effects, &EffectsHandler::windowDeleted, this, &OffscreenEffect::handleWindowDeleted); } -void DeformEffect::destroyConnections() +void OffscreenEffect::destroyConnections() { disconnect(d->windowDamagedConnection); disconnect(d->windowDeletedConnection); @@ -246,9 +246,9 @@ void DeformEffect::destroyConnections() d->windowDeletedConnection = {}; } -void DeformEffect::setShader(EffectWindow *window, GLShader *shader) +void OffscreenEffect::setShader(EffectWindow *window, GLShader *shader) { - DeformOffscreenData *offscreenData = d->windows.value(window); + OffscreenData *offscreenData = d->windows.value(window); if (offscreenData) { offscreenData->shader = shader; } diff --git a/src/libkwineffects/kwindeformeffect.h b/src/libkwineffects/kwinoffscreeneffect.h similarity index 68% rename from src/libkwineffects/kwindeformeffect.h rename to src/libkwineffects/kwinoffscreeneffect.h index 5ae5685fd5..9e0e8a0da8 100644 --- a/src/libkwineffects/kwindeformeffect.h +++ b/src/libkwineffects/kwinoffscreeneffect.h @@ -11,29 +11,28 @@ namespace KWin { -class DeformEffectPrivate; +class OffscreenEffectPrivate; /** - * The DeformEffect class is the base class for effects that paint deformed windows. + * The OffscreenEffect class is the base class for effects that paint deformed windows. * - * Under the hood, the DeformEffect will paint the window into an offscreen texture, - * which will be mapped onto transformed window quad grid later on. + * Under the hood, the OffscreenEffect will paint the window into an offscreen texture + * and the offscreen texture will be transformed afterwards. * * The redirect() function must be called when the effect wants to transform a window. * Once the effect is no longer interested in the window, the unredirect() function * must be called. * * If a window is redirected into offscreen texture, the deform() function will be - * called with the window quads that can be mutated by the effect. The effect can - * sub-divide, remove, or transform the window quads. + * called to transform the offscreen texture. */ -class KWINEFFECTS_EXPORT DeformEffect : public Effect +class KWINEFFECTS_EXPORT OffscreenEffect : public Effect { Q_OBJECT public: - explicit DeformEffect(QObject *parent = nullptr); - ~DeformEffect() override; + explicit OffscreenEffect(QObject *parent = nullptr); + ~OffscreenEffect() override; static bool supported(); @@ -59,9 +58,9 @@ protected: void unredirect(EffectWindow *window); /** - * Override this function to transform the window quad grid of the given window. + * Override this function to transform the window. */ - virtual void deform(EffectWindow *window, int mask, WindowPaintData &data, WindowQuadList &quads); + virtual void apply(EffectWindow *window, int mask, WindowPaintData &data, WindowQuadList &quads); /** * Allows to specify a @p shader to draw the redirected texture for @p window. @@ -78,7 +77,7 @@ private: void setupConnections(); void destroyConnections(); - QScopedPointer d; + QScopedPointer d; }; } // namespace KWin