Consistently decide whether shadow will be painted for a window.
svn path=/trunk/KDE/kdebase/workspace/; revision=728484
This commit is contained in:
parent
d51fb87c10
commit
211bbc95ba
3 changed files with 17 additions and 3 deletions
|
@ -40,16 +40,20 @@ QRect ShadowEffect::shadowRectangle(const QRect& windowRectangle) const
|
|||
return windowRectangle.adjusted( shadowXOffset - shadowGrow, shadowYOffset - shadowGrow,
|
||||
shadowXOffset + shadowGrow, shadowYOffset + shadowGrow);
|
||||
}
|
||||
|
||||
void ShadowEffect::prePaintWindow( EffectWindow* w, WindowPrePaintData& data, int time )
|
||||
{
|
||||
data.mask |= PAINT_WINDOW_TRANSLUCENT;
|
||||
data.paint |= QRegion( shadowRectangle( ( QRegion( w->geometry()) & data.paint ).boundingRect() ));
|
||||
if( useShadow( w ))
|
||||
{
|
||||
data.mask |= PAINT_WINDOW_TRANSLUCENT;
|
||||
data.paint |= QRegion( shadowRectangle( ( QRegion( w->geometry()) & data.paint ).boundingRect() ));
|
||||
}
|
||||
effects->prePaintWindow( w, data, time );
|
||||
}
|
||||
|
||||
void ShadowEffect::paintWindow( EffectWindow* w, int mask, QRegion region, WindowPaintData& data )
|
||||
{
|
||||
if( !w->isDeleted() && !w->isDesktop() && !w->isDock() )
|
||||
if( useShadow( w ))
|
||||
drawShadow( w, mask, region, data );
|
||||
effects->paintWindow( w, mask, region, data );
|
||||
}
|
||||
|
@ -61,10 +65,17 @@ void ShadowEffect::postPaintWindow( EffectWindow* w )
|
|||
|
||||
QRect ShadowEffect::transformWindowDamage( EffectWindow* w, const QRect& r )
|
||||
{
|
||||
if( !useShadow( w ))
|
||||
return effects->transformWindowDamage( w, r );
|
||||
QRect r2 = r | shadowRectangle( r );
|
||||
return effects->transformWindowDamage( w, r2 );
|
||||
}
|
||||
|
||||
bool ShadowEffect::useShadow( EffectWindow* w ) const
|
||||
{
|
||||
return !w->isDeleted() && !w->isDesktop() && !w->isDock();
|
||||
}
|
||||
|
||||
void ShadowEffect::addQuadVertices(QVector<float>& verts, float x1, float y1, float x2, float y2) const
|
||||
{
|
||||
verts << x1 << y1;
|
||||
|
|
|
@ -33,6 +33,7 @@ class ShadowEffect
|
|||
void addQuadVertices(QVector<float>& verts, float x1, float y1, float x2, float y2) const;
|
||||
// transforms window rect -> shadow rect
|
||||
QRect shadowRectangle(const QRect& windowRectangle) const;
|
||||
bool useShadow( EffectWindow* w ) const;
|
||||
|
||||
int shadowXOffset, shadowYOffset;
|
||||
double shadowOpacity;
|
||||
|
|
|
@ -227,6 +227,8 @@ void Scene::paintSimpleScreen( int orig_mask, QRegion region )
|
|||
if( !w->isPaintingEnabled())
|
||||
continue;
|
||||
data.paint -= allclips; // make sure to avoid already clipped areas
|
||||
// no painting outside visible screen (and no transformations)
|
||||
data.paint &= QRect( 0, 0, displayWidth(), displayHeight());
|
||||
if( data.paint.isEmpty()) // completely clipped
|
||||
continue;
|
||||
if( data.paint != region ) // prepaint added area to draw
|
||||
|
|
Loading…
Reference in a new issue