crossfade for resize effect

REVIEW: 111383
This commit is contained in:
Thomas Lübking 2013-07-03 17:14:25 +02:00
parent ebfd3f58d8
commit c2219f973b
2 changed files with 12 additions and 8 deletions

View file

@ -37,7 +37,8 @@ namespace KWin
KWIN_EFFECT(resize, ResizeEffect) KWIN_EFFECT(resize, ResizeEffect)
ResizeEffect::ResizeEffect() ResizeEffect::ResizeEffect()
: m_active(false) : AnimationEffect()
, m_active(false)
, m_resizeWindow(0) , m_resizeWindow(0)
{ {
reconfigure(ReconfigureAll); reconfigure(ReconfigureAll);
@ -55,14 +56,14 @@ void ResizeEffect::prePaintScreen(ScreenPrePaintData& data, int time)
if (m_active) { if (m_active) {
data.mask |= PAINT_SCREEN_WITH_TRANSFORMED_WINDOWS; data.mask |= PAINT_SCREEN_WITH_TRANSFORMED_WINDOWS;
} }
effects->prePaintScreen(data, time); AnimationEffect::prePaintScreen(data, time);
} }
void ResizeEffect::prePaintWindow(EffectWindow* w, WindowPrePaintData& data, int time) void ResizeEffect::prePaintWindow(EffectWindow* w, WindowPrePaintData& data, int time)
{ {
if (m_active && w == m_resizeWindow) if (m_active && w == m_resizeWindow)
data.mask |= PAINT_WINDOW_TRANSFORMED; data.mask |= PAINT_WINDOW_TRANSFORMED;
effects->prePaintWindow(w, data, time); AnimationEffect::prePaintWindow(w, data, time);
} }
void ResizeEffect::paintWindow(EffectWindow* w, int mask, QRegion region, WindowPaintData& data) void ResizeEffect::paintWindow(EffectWindow* w, int mask, QRegion region, WindowPaintData& data)
@ -118,8 +119,9 @@ void ResizeEffect::paintWindow(EffectWindow* w, int mask, QRegion region, Window
} }
#endif #endif
} }
} else } else {
effects->paintWindow(w, mask, region, data); AnimationEffect::paintWindow(w, mask, region, data);
}
} }
void ResizeEffect::reconfigure(ReconfigureFlags) void ResizeEffect::reconfigure(ReconfigureFlags)
@ -148,6 +150,8 @@ void ResizeEffect::slotWindowFinishUserMovedResized(EffectWindow *w)
if (m_active && w == m_resizeWindow) { if (m_active && w == m_resizeWindow) {
m_active = false; m_active = false;
m_resizeWindow = NULL; m_resizeWindow = NULL;
if (m_features & TextureScale)
animate(w, CrossFadePrevious, 0, 150, FPx2(1.0));
effects->addRepaintFull(); effects->addRepaintFull();
} }
} }

View file

@ -21,13 +21,13 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef KWIN_RESIZE_H #ifndef KWIN_RESIZE_H
#define KWIN_RESIZE_H #define KWIN_RESIZE_H
#include <kwineffects.h> #include <kwinanimationeffect.h>
namespace KWin namespace KWin
{ {
class ResizeEffect class ResizeEffect
: public Effect : public AnimationEffect
{ {
Q_OBJECT Q_OBJECT
Q_PROPERTY(bool textureScale READ isTextureScale) Q_PROPERTY(bool textureScale READ isTextureScale)
@ -38,7 +38,7 @@ public:
virtual inline bool provides(Effect::Feature ef) { virtual inline bool provides(Effect::Feature ef) {
return ef == Effect::Resize; return ef == Effect::Resize;
} }
inline bool isActive() const { return m_active; } inline bool isActive() const { return m_active || AnimationEffect::isActive(); }
virtual void prePaintScreen(ScreenPrePaintData& data, int time); virtual void prePaintScreen(ScreenPrePaintData& data, int time);
virtual void prePaintWindow(EffectWindow* w, WindowPrePaintData& data, int time); virtual void prePaintWindow(EffectWindow* w, WindowPrePaintData& data, int time);
virtual void paintWindow(EffectWindow* w, int mask, QRegion region, WindowPaintData& data); virtual void paintWindow(EffectWindow* w, int mask, QRegion region, WindowPaintData& data);