Fixed decoration shadows and glow for large-size settings.

svn path=/trunk/KDE/kdebase/workspace/; revision=1124726
This commit is contained in:
Hugo Pereira Da Costa 2010-05-10 00:28:38 +00:00
parent a9d772796c
commit 0f6f610265

View file

@ -162,12 +162,6 @@ namespace Oxygen
p.setRenderHint( QPainter::Antialiasing );
p.setPen( Qt::NoPen );
// offsets are scaled with the shadow size
// so that the ratio Top-shadow/Bottom-shadow is kept constant
// when shadow size is changed
qreal hoffset = shadowConfiguration.horizontalOffset()*shadowSize/fixedSize;
qreal voffset = shadowConfiguration.verticalOffset()*shadowSize/fixedSize;
// some gradients rendering are different at bottom corners if client has no border
bool hasBorder( key.hasBorder || key.isShade );
@ -179,30 +173,38 @@ namespace Oxygen
{
const qreal gradientSize = qMin( shadowSize, (shadowSize+fixedSize)/2 );
const qreal hoffset = shadowConfiguration.horizontalOffset()*gradientSize/fixedSize;
const qreal voffset = shadowConfiguration.verticalOffset()*gradientSize/fixedSize;
// 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 );
const int nPoints = 7;
const qreal x[7] = {0, 0.05, 0.1, 0.15, 0.2, 0.3, 0.4 };
const qreal values[7] = {0.8, 0.78, 0.69, 0.42, 0.18, 0.01, 0 };
QRadialGradient rg = QRadialGradient( size+12.0*hoffset, size+12.0*voffset, gradientSize );
QColor c = shadowConfiguration.innerColor();
for( int i = 0; i<nPoints; i++ )
{ c.setAlpha( values[i] ); rg.setColorAt( x[i], c ); }
{ c.setAlphaF( values[i] ); rg.setColorAt( x[i], c ); }
p.setBrush( rg );
renderGradient( p, shadow.rect(), rg, hasBorder );
}
if( true ) {
{
const qreal gradientSize = shadowSize;
const qreal hoffset = shadowConfiguration.horizontalOffset()*gradientSize/fixedSize;
const qreal voffset = shadowConfiguration.verticalOffset()*gradientSize/fixedSize;
// 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 );
const int nPoints = 7;
const qreal x[7] = {0, 0.15, 0.3, 0.45, 0.65, 0.75, 1 };
const qreal values[7] = {0.47, 0.37, 0.2, 0.08, 0.04, 0.02, 0 };
QRadialGradient rg = QRadialGradient( size+12.0*hoffset, size+12.0*voffset, gradientSize );
QColor c = shadowConfiguration.outerColor();
for( int i = 0; i<nPoints; i++ )
{ c.setAlpha( values[i] ); rg.setColorAt( x[i], c ); }
{ c.setAlphaF( values[i] ); rg.setColorAt( x[i], c ); }
p.setBrush( rg );
p.drawRect( shadow.rect() );
@ -212,11 +214,15 @@ namespace Oxygen
} else {
{
const qreal gradientSize = qMin( shadowSize, fixedSize );
const qreal hoffset = shadowConfiguration.horizontalOffset()*gradientSize/fixedSize;
const qreal voffset = shadowConfiguration.verticalOffset()*gradientSize/fixedSize;
// 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 );
const int nPoints = 5;
const qreal x[5] = { 0, 4.5, 5.0, 5.5, 6.5 };
const qreal values[5] = { 1.0, 0.32, 0.22, 0.03, 0 };
QRadialGradient rg = QRadialGradient( size+hoffset, size+voffset, gradientSize );
QColor c = shadowConfiguration.innerColor();
for( int i = 0; i<nPoints; i++ )
{ c.setAlphaF( values[i] ); rg.setColorAt( x[i]/fixedSize, c ); }
@ -228,10 +234,14 @@ namespace Oxygen
{
// 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 );
const qreal gradientSize = qMin( shadowSize, (shadowSize+fixedSize)/2 );
const qreal hoffset = shadowConfiguration.horizontalOffset()*gradientSize/fixedSize;
const qreal voffset = shadowConfiguration.verticalOffset()*gradientSize/fixedSize;
const int nPoints = 7;
const qreal x[7] = {0, 4.5, 5.5, 7.5, 8.5, 11.5, 14.5 };
const qreal values[7] = {0.55, 0.25, 0.20, 0.1, 0.06, 0.015, 0 };
QRadialGradient rg = QRadialGradient( size+8.0*hoffset, size+8.0*voffset, gradientSize );
QColor c = shadowConfiguration.midColor();
for( int i = 0; i<nPoints; i++ )
{ c.setAlphaF( values[i] ); rg.setColorAt( x[i]/fixedSize, c ); }
@ -244,10 +254,14 @@ namespace Oxygen
{
// 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 );
const qreal gradientSize = shadowSize;
const qreal hoffset = shadowConfiguration.horizontalOffset()*gradientSize/fixedSize;
const qreal voffset = shadowConfiguration.verticalOffset()*gradientSize/fixedSize;
const int nPoints = 9;
const qreal x[9] = {0, 4.5, 6.6, 8.5, 11.5, 14.5, 17.5, 21.5, 25.5 };
const qreal values[9] = { 0.17, 0.12, 0.11, 0.075, 0.06, 0.035, 0.025, 0.01, 0 };
QRadialGradient rg = QRadialGradient( size+20.0*hoffset, size+20.0*voffset, gradientSize );
QColor c = shadowConfiguration.outerColor();
for( int i = 0; i<nPoints; i++ )
{ c.setAlphaF( values[i] ); rg.setColorAt( x[i]/fixedSize, c ); }