From 37d8ffe6e4e20c50857cbb1d51fbcc567bb9b0b2 Mon Sep 17 00:00:00 2001 From: Hugo Pereira Da Costa Date: Wed, 26 Jan 2011 21:28:39 +0000 Subject: [PATCH] added flag to disable drawing of "corners" in shadows. svn path=/trunk/KDE/kdebase/workspace/; revision=1217366 --- clients/oxygen/oxygenshadowcache.cpp | 22 +++++++++++--------- clients/oxygen/oxygenshadowcache.h | 30 ++++++++++++++++------------ 2 files changed, 30 insertions(+), 22 deletions(-) diff --git a/clients/oxygen/oxygenshadowcache.cpp b/clients/oxygen/oxygenshadowcache.cpp index 1b69e3d2eb..4f25f665af 100644 --- a/clients/oxygen/oxygenshadowcache.cpp +++ b/clients/oxygen/oxygenshadowcache.cpp @@ -78,6 +78,7 @@ namespace Oxygen qreal size( shadowSize() ); TileSet* tileSet = new TileSet( shadowPixmap( color, key, key.active ), size, size, 1, 1); shadowCache_.insert( hash, tileSet ); + return tileSet; } @@ -299,16 +300,19 @@ namespace Oxygen } - // draw the corner of the window - actually all 4 corners as one circle - // this is all fixedSize. Does not scale with shadow size - QLinearGradient lg = QLinearGradient(0.0, size-4.5, 0.0, size+4.5); - lg.setColorAt(0.0, helper().calcLightColor( helper().backgroundTopColor(color) )); - lg.setColorAt(0.51, helper().backgroundBottomColor(color) ); - lg.setColorAt(1.0, helper().backgroundBottomColor(color) ); + if( key.drawCorners ) + { + // draw the corner of the window - actually all 4 corners as one circle + // this is all fixedSize. Does not scale with shadow size + QLinearGradient lg = QLinearGradient(0.0, size-4.5, 0.0, size+4.5); + lg.setColorAt(0.0, helper().calcLightColor( helper().backgroundTopColor(color) )); + lg.setColorAt(0.51, helper().backgroundBottomColor(color) ); + lg.setColorAt(1.0, helper().backgroundBottomColor(color) ); - // draw ellipse. - p.setBrush( lg ); - p.drawEllipse( QRectF( size-4, size-4, 8, 8 ) ); + // draw ellipse. + p.setBrush( lg ); + p.drawEllipse( QRectF( size-4, size-4, 8, 8 ) ); + } // mask p.setCompositionMode(QPainter::CompositionMode_DestinationOut); diff --git a/clients/oxygen/oxygenshadowcache.h b/clients/oxygen/oxygenshadowcache.h index ed729fb4b6..04d584d1ae 100644 --- a/clients/oxygen/oxygenshadowcache.h +++ b/clients/oxygen/oxygenshadowcache.h @@ -132,17 +132,19 @@ namespace Oxygen useOxygenShadows(false), isShade(false), hasTitleOutline(false), - hasBorder( true ) + hasBorder( true ), + drawCorners( true ) {} //! constructor from int Key( int hash ): - index( hash>>5 ), - active( (hash>>4)&1 ), - useOxygenShadows( (hash>>3)&1 ), - isShade( (hash>>2)&1 ), - hasTitleOutline( (hash>>1)&1 ), - hasBorder( hash&1 ) + index( hash>>6 ), + active( (hash>>5)&1 ), + useOxygenShadows( (hash>>4)&1 ), + isShade( (hash>>3)&1 ), + hasTitleOutline( (hash>>2)&1 ), + hasBorder( (hash>>1)&1 ), + drawCorners( hash&1 ) {} //! hash function @@ -152,12 +154,13 @@ namespace Oxygen // note this can be optimized because not all of the flag configurations are actually relevant // allocate 3 empty bits for flags return - ( index << 5 ) | - ( active << 4 ) | - (useOxygenShadows << 3 ) | - (isShade<<2) | - (hasTitleOutline<<1) | - (hasBorder<<0); + ( index << 6 ) | + ( active << 5 ) | + (useOxygenShadows << 4 ) | + (isShade<<3) | + (hasTitleOutline<<2) | + (hasBorder<<1) | + (drawCorners); } @@ -167,6 +170,7 @@ namespace Oxygen bool isShade; bool hasTitleOutline; bool hasBorder; + bool drawCorners; };