From 6e7e1c530b69af36a0fffb48b4190ccab921c9f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Tue, 15 Mar 2011 20:38:37 +0100 Subject: [PATCH] Remove transformWindowDamage effects hook It is not used by any effect, so we save one complete go through all effects pass on each window damage. The functionality which could be provided by this hook can also be implemented using the window damaged signal. --- composite.cpp | 7 +------ effects.cpp | 3 --- libkwineffects/kwineffects.cpp | 16 ---------------- libkwineffects/kwineffects.h | 10 ---------- 4 files changed, 1 insertion(+), 35 deletions(-) diff --git a/composite.cpp b/composite.cpp index e6fb408099..fca240de6a 100644 --- a/composite.cpp +++ b/composite.cpp @@ -403,8 +403,6 @@ void Workspace::performCompositing() foreach (Toplevel * c, windows) { // This could be possibly optimized WRT obscuring, but that'd need being already // past prePaint() phase - probably not worth it. - // TODO I think effects->transformWindowDamage() doesn't need to be called here, - // pre-paint will extend painted window areas as necessary. repaints_region |= c->repaints().translated(c->pos()); repaints_region |= c->decorationPendingRegion(); c->resetRepaints(c->decorationRect()); @@ -899,10 +897,7 @@ void Toplevel::addWorkspaceRepaint(const QRect& r2) { if (!compositing()) return; - if (effectWindow() == NULL) // TODO - this can happen during window destruction - return workspace()->addRepaint(r2); - QRect r = effects->transformWindowDamage(effectWindow(), r2); - workspace()->addRepaint(r); + workspace()->addRepaint(r2); } bool Toplevel::updateUnredirectedState() diff --git a/effects.cpp b/effects.cpp index 6dd84efc9f..719f47c2a1 100644 --- a/effects.cpp +++ b/effects.cpp @@ -300,7 +300,6 @@ void EffectsHandlerImpl::startPaint() assert(current_paint_window == 0); assert(current_draw_window == 0); assert(current_build_quads == 0); - assert(current_transform == 0); } void EffectsHandlerImpl::slotClientMaximized(KWin::Client *c, KDecorationDefines::MaximizeMode maxMode) @@ -1010,7 +1009,6 @@ bool EffectsHandlerImpl::loadEffect(const QString& name) assert(current_paint_window == 0); assert(current_draw_window == 0); assert(current_build_quads == 0); - assert(current_transform == 0); if (!name.startsWith(QLatin1String("kwin4_effect_"))) kWarning(1212) << "Effect names usually have kwin4_effect_ prefix" ; @@ -1105,7 +1103,6 @@ void EffectsHandlerImpl::unloadEffect(const QString& name) assert(current_paint_window == 0); assert(current_draw_window == 0); assert(current_build_quads == 0); - assert(current_transform == 0); for (QMap< int, EffectPair >::iterator it = effect_order.begin(); it != effect_order.end(); ++it) { if (it.value().first == name) { diff --git a/libkwineffects/kwineffects.cpp b/libkwineffects/kwineffects.cpp index 524f80f895..427bf76291 100644 --- a/libkwineffects/kwineffects.cpp +++ b/libkwineffects/kwineffects.cpp @@ -182,11 +182,6 @@ void Effect::buildQuads(EffectWindow* w, WindowQuadList& quadList) effects->buildQuads(w, quadList); } -QRect Effect::transformWindowDamage(EffectWindow* w, const QRect& r) -{ - return effects->transformWindowDamage(w, r); -} - void Effect::setPositionTransformations(WindowPaintData& data, QRect& region, EffectWindow* w, const QRect& r, Qt::AspectRatioMode aspect) { @@ -239,7 +234,6 @@ EffectsHandler::EffectsHandler(CompositingType type) , current_paint_window(0) , current_draw_window(0) , current_build_quads(0) - , current_transform(0) , compositing_type(type) { if (compositing_type == NoCompositing) @@ -253,16 +247,6 @@ EffectsHandler::~EffectsHandler() assert(loaded_effects.count() == 0); } -QRect EffectsHandler::transformWindowDamage(EffectWindow* w, const QRect& r) -{ - if (current_transform < loaded_effects.size()) { - QRect rr = loaded_effects[current_transform++].second->transformWindowDamage(w, r); - --current_transform; - return rr; - } else - return r; -} - Window EffectsHandler::createInputWindow(Effect* e, const QRect& r, const QCursor& cursor) { return createInputWindow(e, r.x(), r.y(), r.width(), r.height(), cursor); diff --git a/libkwineffects/kwineffects.h b/libkwineffects/kwineffects.h index 9660d67fe9..ccba49bf80 100644 --- a/libkwineffects/kwineffects.h +++ b/libkwineffects/kwineffects.h @@ -431,14 +431,6 @@ public: **/ virtual void buildQuads(EffectWindow* w, WindowQuadList& quadList); - /** - * This function is used e.g. by the shadow effect which adds area around windows - * that needs to be painted as well - e.g. when a window is hidden and the workspace needs - * to be repainted at that area, shadow's transformWindowDamage() adds the shadow area - * to it, so that it is repainted as well. - **/ - virtual QRect transformWindowDamage(EffectWindow* w, const QRect& r); - virtual void windowInputMouseEvent(Window w, QEvent* e); virtual void grabbedKeyboardEvent(QKeyEvent* e); @@ -557,7 +549,6 @@ public: virtual void paintEffectFrame(EffectFrame* frame, QRegion region, double opacity, double frameOpacity) = 0; virtual void drawWindow(EffectWindow* w, int mask, QRegion region, WindowPaintData& data) = 0; virtual void buildQuads(EffectWindow* w, WindowQuadList& quadList) = 0; - virtual QRect transformWindowDamage(EffectWindow* w, const QRect& r); // Functions for handling input - e.g. when an Expose-like effect is shown, an input window // covering the whole screen is created and all mouse events will be intercepted by it. // The effect's windowInputMouseEvent() will get called with such events. @@ -983,7 +974,6 @@ protected: int current_paint_window; int current_draw_window; int current_build_quads; - int current_transform; CompositingType compositing_type; };