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.
This commit is contained in:
Martin Gräßlin 2011-03-15 20:38:37 +01:00
parent 82b8f8d2fc
commit 6e7e1c530b
4 changed files with 1 additions and 35 deletions

View file

@ -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()

View file

@ -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) {

View file

@ -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);

View file

@ -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;
};