Previous shadow damage commit didn't catch 100% of the events. Lets just
do it the old way but taking into account the decoration shadow sizes. svn path=/trunk/KDE/kdebase/workspace/; revision=896765
This commit is contained in:
parent
af139a5a13
commit
763d9d8c6f
2 changed files with 19 additions and 22 deletions
|
@ -192,12 +192,13 @@ void ShadowEffect::updateShadowColor()
|
|||
shadowColor = conf.readEntry( "Color", schemeShadowColor() );
|
||||
}
|
||||
|
||||
QRect ShadowEffect::shadowRectangle( EffectWindow* w ) const
|
||||
QRect ShadowEffect::shadowRectangle( EffectWindow* w, const QRect& windowRectangle ) const
|
||||
{
|
||||
QRectF shadowRect;
|
||||
bool shadowDefined = false;
|
||||
if( effects->hasDecorationShadows() )
|
||||
{
|
||||
{ // TODO: This function is called for EVERY damage, we need to cache this
|
||||
// (But how? Decoration shadow can change shape if it wanted to)
|
||||
if( w->hasDecoration() && !forceDecorated )
|
||||
{ // Decorated windows must be normal windows
|
||||
foreach( const QRect &r, w->shadowQuads( ShadowBorderedActive ))
|
||||
|
@ -225,17 +226,16 @@ QRect ShadowEffect::shadowRectangle( EffectWindow* w ) const
|
|||
}
|
||||
if( !shadowDefined )
|
||||
{
|
||||
int width = qMax( shadowFuzzyness * 2, w->width() + 2 * shadowSize );
|
||||
int height = qMax( shadowFuzzyness * 2, w->height() + 2 * shadowSize );
|
||||
int x1, y1, x2, y2;
|
||||
// top-left
|
||||
x1 = shadowXOffset - shadowSize + 0 - shadowFuzzyness;
|
||||
y1 = shadowYOffset - shadowSize + 0 - shadowFuzzyness;
|
||||
x2 = shadowXOffset - shadowSize + width + shadowFuzzyness;
|
||||
y2 = shadowYOffset - shadowSize + height + shadowFuzzyness;
|
||||
return QRect( x1 + w->x(), y1 + w->y(), x2 - x1, y2 - y1 );
|
||||
int shadowGrow = shadowFuzzyness + shadowSize;
|
||||
return windowRectangle.adjusted( shadowXOffset - shadowGrow, shadowYOffset - shadowGrow,
|
||||
shadowXOffset + shadowGrow, shadowYOffset + shadowGrow);
|
||||
}
|
||||
return shadowRect.toRect().translated( w->x(), w->y() );
|
||||
return windowRectangle.adjusted(
|
||||
qMin( shadowRect.x(), 0.0 ),
|
||||
qMin( shadowRect.y(), 0.0 ),
|
||||
qMax( shadowRect.x() + shadowRect.width() - w->width(), 0.0 ),
|
||||
qMax( shadowRect.y() + shadowRect.height() - w->height(), 0.0 )
|
||||
);
|
||||
}
|
||||
|
||||
#ifdef KWIN_HAVE_XRENDER_COMPOSITING
|
||||
|
@ -264,12 +264,8 @@ void ShadowEffect::paintScreen( int mask, QRegion region, ScreenPaintData& data
|
|||
|
||||
void ShadowEffect::prePaintWindow( EffectWindow* w, WindowPrePaintData& data, int time )
|
||||
{
|
||||
// Add the shadow area to the repaint if we are repainting the entire window
|
||||
// This occurs when the active window is changed for example
|
||||
// TODO: This only works if there are no animations in the shadows
|
||||
QRect overlap = ( data.paint & w->geometry() ).boundingRect();
|
||||
if( useShadow( w ) && !overlap.isEmpty() && overlap != data.paint.boundingRect() )
|
||||
data.paint |= shadowRectangle( w );
|
||||
if( useShadow( w ))
|
||||
data.paint |= shadowRectangle( w, data.paint.boundingRect() );
|
||||
effects->prePaintWindow( w, data, time );
|
||||
}
|
||||
|
||||
|
@ -300,7 +296,8 @@ void ShadowEffect::drawWindow( EffectWindow* w, int mask, QRegion region, Window
|
|||
if( !shadowDatas.isEmpty())
|
||||
d.clip |= shadowDatas.last().clip;
|
||||
d.mask = mask;
|
||||
d.region |= shadowRectangle( w );
|
||||
foreach( const QRect &r, region.rects() )
|
||||
d.region |= shadowRectangle( w, r );
|
||||
d.region &= region;
|
||||
shadowDatas.append(d);
|
||||
}
|
||||
|
@ -476,13 +473,13 @@ QRect ShadowEffect::transformWindowDamage( EffectWindow* w, const QRect& r )
|
|||
{
|
||||
if( !useShadow( w ))
|
||||
return effects->transformWindowDamage( w, r );
|
||||
QRect r2 = r | shadowRectangle( w );
|
||||
QRect r2 = r | shadowRectangle( w, r );
|
||||
return effects->transformWindowDamage( w, r2 );
|
||||
}
|
||||
|
||||
void ShadowEffect::windowClosed( EffectWindow* c )
|
||||
{
|
||||
effects->addRepaint( shadowRectangle( c ));
|
||||
effects->addRepaint( shadowRectangle( c, c->geometry() ));
|
||||
}
|
||||
|
||||
bool ShadowEffect::useShadow( EffectWindow* w ) const
|
||||
|
|
|
@ -61,7 +61,7 @@ class ShadowEffect
|
|||
void drawShadow( EffectWindow* w, int mask, QRegion region, const WindowPaintData& data );
|
||||
void addQuadVertices(QVector<float>& verts, float x1, float y1, float x2, float y2) const;
|
||||
// transforms window rect -> shadow rect
|
||||
QRect shadowRectangle( EffectWindow* w ) const;
|
||||
QRect shadowRectangle( EffectWindow* w, const QRect& windowRectangle ) const;
|
||||
bool useShadow( EffectWindow* w ) const;
|
||||
void drawQueuedShadows( EffectWindow* behindWindow );
|
||||
|
||||
|
|
Loading…
Reference in a new issue