Properly mask out the inner part of the shadows (that overlaps with e.g. menus), to prevent artifacts when translucency is enabled.

BUG: 355695
wilder-pre-rebase
Hugo Pereira Da Costa 10 years ago
parent a415bc3026
commit 48321e81f7
  1. 8
      kstyle/breezehelper.h
  2. 15
      kstyle/breezeshadowhelper.cpp

@ -314,15 +314,15 @@ namespace Breeze
//@}
//* frame radius
qreal frameRadius( qreal bias = 0 ) const
{ return qMax( qreal( Metrics::Frame_FrameRadius ) - 0.5 + bias, 0.0 ); }
protected:
//* initialize
void init( void );
//* frame radius
qreal frameRadius( qreal bias = 0 ) const
{ return qMax( qreal( Metrics::Frame_FrameRadius ) - 0.5 + bias, 0.0 ); }
//* return rectangle for widgets shadow, offset depending on light source
QRectF shadowRect( const QRectF& ) const;

@ -153,6 +153,8 @@ namespace Breeze
// metrics
const int shadowSize = StyleConfigData::shadowSize()*12/16;
const int shadowOffset = qMax( shadowSize/2, Metrics::Shadow_Overlap*2 );
// const int size( shadowSize - Metrics::Shadow_Overlap );
const int shadowStrength = StyleConfigData::shadowStrength();
// pixmap
@ -181,8 +183,21 @@ namespace Breeze
// fill
QPainter p(&pixmap);
p.setRenderHint( QPainter::Antialiasing, true );
p.setCompositionMode(QPainter::CompositionMode_Source);
p.fillRect( pixmap.rect(), radialGradient);
p.setPen( Qt::NoPen );
p.setBrush( Qt::black );
QRectF innerRect(
shadowSize - shadowOffset - Metrics::Shadow_Overlap, shadowSize - shadowOffset - Metrics::Shadow_Overlap,
shadowOffset + 2*Metrics::Shadow_Overlap,shadowOffset + 2*Metrics::Shadow_Overlap );
p.setCompositionMode(QPainter::CompositionMode_DestinationOut );
const qreal radius( _helper.frameRadius() );
p.drawRoundedRect( innerRect, radius, radius );
p.end();
// create tiles from pixmap

Loading…
Cancel
Save