fixed bug on shadow rendering when size < 5 - in which case only the round corner should be rendered
svn path=/trunk/KDE/kdebase/workspace/; revision=1037681
This commit is contained in:
parent
f7c3b99ac0
commit
60bf914cee
2 changed files with 71 additions and 60 deletions
|
@ -172,86 +172,91 @@ namespace Oxygen
|
|||
// some gradients rendering are different at bottom corners if client has no border
|
||||
bool hasBorder( key.hasBorder || key.isShade );
|
||||
|
||||
if( active && key.useOxygenShadows )
|
||||
if( shadowSize )
|
||||
{
|
||||
|
||||
if( active && key.useOxygenShadows )
|
||||
{
|
||||
|
||||
// inner (shark) gradient
|
||||
int nPoints = 7;
|
||||
qreal x[7] = {0, 0.05, 0.1, 0.15, 0.2, 0.3, 0.4 };
|
||||
int values[7] = {203, 200, 175, 105, 45, 2, 0 };
|
||||
QRadialGradient rg = QRadialGradient( size+12.0*hoffset, size+12.0*voffset, shadowSize );
|
||||
QColor c = shadowConfiguration.innerColor();
|
||||
for( int i = 0; i<nPoints; i++ )
|
||||
{ c.setAlpha( values[i] ); rg.setColorAt( x[i], c ); }
|
||||
{
|
||||
|
||||
p.setBrush( rg );
|
||||
renderGradient( p, shadow.rect(), rg, hasBorder );
|
||||
// inner (shark) gradient
|
||||
int nPoints = 7;
|
||||
qreal x[7] = {0, 0.05, 0.1, 0.15, 0.2, 0.3, 0.4 };
|
||||
int values[7] = {203, 200, 175, 105, 45, 2, 0 };
|
||||
QRadialGradient rg = QRadialGradient( size+12.0*hoffset, size+12.0*voffset, shadowSize );
|
||||
QColor c = shadowConfiguration.innerColor();
|
||||
for( int i = 0; i<nPoints; i++ )
|
||||
{ c.setAlpha( values[i] ); rg.setColorAt( x[i], c ); }
|
||||
|
||||
}
|
||||
p.setBrush( rg );
|
||||
renderGradient( p, shadow.rect(), rg, hasBorder );
|
||||
|
||||
if( true ) {
|
||||
}
|
||||
|
||||
// outer (spread) gradient
|
||||
int nPoints = 7;
|
||||
qreal x[7] = {0, 0.15, 0.3, 0.45, 0.65, 0.75, 1 };
|
||||
int values[7] = {120, 95, 50, 20, 10, 5, 0 };
|
||||
QRadialGradient rg = QRadialGradient( size+12.0*hoffset, size+12.0*voffset, shadowSize );
|
||||
QColor c = shadowConfiguration.outerColor();
|
||||
for( int i = 0; i<nPoints; i++ )
|
||||
{ c.setAlpha( values[i] ); rg.setColorAt( x[i], c ); }
|
||||
if( true ) {
|
||||
|
||||
p.setBrush( rg );
|
||||
p.drawRect( shadow.rect() );
|
||||
// outer (spread) gradient
|
||||
int nPoints = 7;
|
||||
qreal x[7] = {0, 0.15, 0.3, 0.45, 0.65, 0.75, 1 };
|
||||
int values[7] = {120, 95, 50, 20, 10, 5, 0 };
|
||||
QRadialGradient rg = QRadialGradient( size+12.0*hoffset, size+12.0*voffset, shadowSize );
|
||||
QColor c = shadowConfiguration.outerColor();
|
||||
for( int i = 0; i<nPoints; i++ )
|
||||
{ c.setAlpha( values[i] ); rg.setColorAt( x[i], c ); }
|
||||
|
||||
}
|
||||
p.setBrush( rg );
|
||||
p.drawRect( shadow.rect() );
|
||||
|
||||
} else {
|
||||
}
|
||||
|
||||
{
|
||||
// inner (sharp gradient)
|
||||
int nPoints = 5;
|
||||
qreal values[5] = { 1, 0.32, 0.22, 0.03, 0 };
|
||||
qreal x[5] = { 0, 4.5, 5.0, 5.5, 6.5 };
|
||||
QRadialGradient rg = QRadialGradient( size+hoffset, size+voffset, shadowSize );
|
||||
QColor c = shadowConfiguration.innerColor();
|
||||
for( int i = 0; i<nPoints; i++ )
|
||||
{ c.setAlphaF( values[i] ); rg.setColorAt( x[i]/fixedSize, c ); }
|
||||
} else {
|
||||
|
||||
renderGradient( p, shadow.rect(), rg, hasBorder );
|
||||
{
|
||||
// inner (sharp gradient)
|
||||
int nPoints = 5;
|
||||
qreal values[5] = { 1, 0.32, 0.22, 0.03, 0 };
|
||||
qreal x[5] = { 0, 4.5, 5.0, 5.5, 6.5 };
|
||||
QRadialGradient rg = QRadialGradient( size+hoffset, size+voffset, shadowSize );
|
||||
QColor c = shadowConfiguration.innerColor();
|
||||
for( int i = 0; i<nPoints; i++ )
|
||||
{ c.setAlphaF( values[i] ); rg.setColorAt( x[i]/fixedSize, c ); }
|
||||
|
||||
}
|
||||
renderGradient( p, shadow.rect(), rg, hasBorder );
|
||||
|
||||
{
|
||||
}
|
||||
|
||||
// mid gradient
|
||||
int nPoints = 7;
|
||||
qreal values[7] = {0.55, 0.25, 0.20, 0.1, 0.06, 0.015, 0 };
|
||||
qreal x[7] = {0, 4.5, 5.5, 7.5, 8.5, 11.5, 14.5 };
|
||||
QRadialGradient rg = QRadialGradient( size+10.0*hoffset, size+10.0*voffset, shadowSize );
|
||||
QColor c = shadowConfiguration.midColor();
|
||||
for( int i = 0; i<nPoints; i++ )
|
||||
{ c.setAlphaF( values[i] ); rg.setColorAt( x[i]/fixedSize, c ); }
|
||||
{
|
||||
|
||||
p.setBrush( rg );
|
||||
p.drawRect( shadow.rect() );
|
||||
// mid gradient
|
||||
int nPoints = 7;
|
||||
qreal values[7] = {0.55, 0.25, 0.20, 0.1, 0.06, 0.015, 0 };
|
||||
qreal x[7] = {0, 4.5, 5.5, 7.5, 8.5, 11.5, 14.5 };
|
||||
QRadialGradient rg = QRadialGradient( size+10.0*hoffset, size+10.0*voffset, shadowSize );
|
||||
QColor c = shadowConfiguration.midColor();
|
||||
for( int i = 0; i<nPoints; i++ )
|
||||
{ c.setAlphaF( values[i] ); rg.setColorAt( x[i]/fixedSize, c ); }
|
||||
|
||||
}
|
||||
p.setBrush( rg );
|
||||
p.drawRect( shadow.rect() );
|
||||
|
||||
{
|
||||
}
|
||||
|
||||
// outer (spread) gradient
|
||||
int nPoints = 9;
|
||||
qreal values[9] = { 0.17, 0.12, 0.11, 0.075, 0.06, 0.035, 0.025, 0.01, 0 };
|
||||
qreal x[9] = {0, 4.5, 6.6, 8.5, 11.5, 14.5, 17.5, 21.5, 25.5 };
|
||||
QRadialGradient rg = QRadialGradient( size+20.0*hoffset, size+20.0*voffset, shadowSize );
|
||||
QColor c = shadowConfiguration.outerColor();
|
||||
for( int i = 0; i<nPoints; i++ )
|
||||
{ c.setAlphaF( values[i] ); rg.setColorAt( x[i]/fixedSize, c ); }
|
||||
{
|
||||
|
||||
p.setBrush( rg );
|
||||
p.drawRect( shadow.rect() );
|
||||
// outer (spread) gradient
|
||||
int nPoints = 9;
|
||||
qreal values[9] = { 0.17, 0.12, 0.11, 0.075, 0.06, 0.035, 0.025, 0.01, 0 };
|
||||
qreal x[9] = {0, 4.5, 6.6, 8.5, 11.5, 14.5, 17.5, 21.5, 25.5 };
|
||||
QRadialGradient rg = QRadialGradient( size+20.0*hoffset, size+20.0*voffset, shadowSize );
|
||||
QColor c = shadowConfiguration.outerColor();
|
||||
for( int i = 0; i<nPoints; i++ )
|
||||
{ c.setAlphaF( values[i] ); rg.setColorAt( x[i]/fixedSize, c ); }
|
||||
|
||||
p.setBrush( rg );
|
||||
p.drawRect( shadow.rect() );
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -73,7 +73,13 @@ namespace Oxygen
|
|||
|
||||
//! shadow size
|
||||
qreal shadowSize( void ) const
|
||||
{ return qMax( activeShadowConfiguration_.shadowSize(), inactiveShadowConfiguration_.shadowSize() ); }
|
||||
{
|
||||
qreal size( qMax( activeShadowConfiguration_.shadowSize(), inactiveShadowConfiguration_.shadowSize() ) );
|
||||
|
||||
// even if shadows are disabled,
|
||||
// you need a minimum size to allow corner rendering
|
||||
return qMax( size, 5.0 );
|
||||
}
|
||||
|
||||
//! get shadow matching client
|
||||
TileSet* tileSet( const OxygenClient* );
|
||||
|
|
Loading…
Reference in a new issue