2009-09-17 22:40:06 +00:00
|
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
|
|
// oxygenshadowcache.cpp
|
|
|
|
// handles caching of TileSet objects to draw shadows
|
|
|
|
// -------------------
|
|
|
|
//
|
|
|
|
// Copyright (c) 2009 Hugo Pereira Da Costa <hugo.pereira@free.fr>
|
|
|
|
//
|
|
|
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
|
|
// of this software and associated documentation files (the "Software"), to
|
|
|
|
// deal in the Software without restriction, including without limitation the
|
|
|
|
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
|
|
|
// sell copies of the Software, and to permit persons to whom the Software is
|
|
|
|
// furnished to do so, subject to the following conditions:
|
|
|
|
//
|
|
|
|
// The above copyright notice and this permission notice shall be included in
|
|
|
|
// all copies or substantial portions of the Software.
|
|
|
|
//
|
|
|
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
|
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
|
|
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
|
|
|
// IN THE SOFTWARE.
|
|
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#include "oxygenshadowcache.h"
|
|
|
|
#include "oxygenclient.h"
|
2009-09-26 04:23:27 +00:00
|
|
|
#include "oxygen.h"
|
2009-10-13 01:45:01 +00:00
|
|
|
#include "lib/helper.h"
|
2009-09-17 22:40:06 +00:00
|
|
|
|
2009-09-18 01:32:27 +00:00
|
|
|
#include <cassert>
|
2009-09-20 00:50:33 +00:00
|
|
|
#include <KColorUtils>
|
2009-09-20 07:42:03 +00:00
|
|
|
#include <QtGui/QPainter>
|
2009-09-17 22:40:06 +00:00
|
|
|
|
|
|
|
namespace Oxygen
|
|
|
|
{
|
|
|
|
|
2009-09-18 01:32:27 +00:00
|
|
|
//_______________________________________________________
|
2009-10-13 01:45:01 +00:00
|
|
|
OxygenShadowCache::OxygenShadowCache( OxygenHelper& helper, int maxIndex ):
|
|
|
|
helper_( helper ),
|
2009-09-18 01:32:27 +00:00
|
|
|
maxIndex_( maxIndex ),
|
|
|
|
activeShadowConfiguration_( OxygenShadowConfiguration( QPalette::Active ) ),
|
|
|
|
inactiveShadowConfiguration_( OxygenShadowConfiguration( QPalette::Inactive ) )
|
|
|
|
{
|
2009-09-18 23:55:18 +00:00
|
|
|
shadowCache_.setMaxCost( 1<<6 );
|
|
|
|
animatedShadowCache_.setMaxCost( maxIndex_<<6 );
|
2009-09-18 01:32:27 +00:00
|
|
|
}
|
|
|
|
|
2009-09-17 22:40:06 +00:00
|
|
|
//_______________________________________________________
|
|
|
|
bool OxygenShadowCache::shadowConfigurationChanged( const OxygenShadowConfiguration& other ) const
|
|
|
|
{
|
|
|
|
const OxygenShadowConfiguration& local = (other.colorGroup() == QPalette::Active ) ? activeShadowConfiguration_:inactiveShadowConfiguration_;
|
|
|
|
return !(local == other);
|
|
|
|
}
|
|
|
|
|
|
|
|
//_______________________________________________________
|
|
|
|
void OxygenShadowCache::setShadowConfiguration( const OxygenShadowConfiguration& other )
|
|
|
|
{
|
|
|
|
OxygenShadowConfiguration& local = (other.colorGroup() == QPalette::Active ) ? activeShadowConfiguration_:inactiveShadowConfiguration_;
|
|
|
|
local = other;
|
|
|
|
}
|
|
|
|
|
|
|
|
//_______________________________________________________
|
|
|
|
TileSet* OxygenShadowCache::tileSet( const OxygenClient* client )
|
|
|
|
{
|
|
|
|
|
|
|
|
// construct key
|
2009-09-18 23:55:18 +00:00
|
|
|
Key key( client );
|
2009-09-17 22:40:06 +00:00
|
|
|
|
|
|
|
// check if tileset already in cache
|
|
|
|
int hash( key.hash() );
|
|
|
|
if( shadowCache_.contains(hash) ) return shadowCache_.object(hash);
|
|
|
|
|
|
|
|
// create tileset otherwise
|
|
|
|
qreal size( shadowSize() );
|
|
|
|
TileSet* tileSet = new TileSet( shadowPixmap( client, key.active ), size, size, 1, 1);
|
|
|
|
shadowCache_.insert( hash, tileSet );
|
|
|
|
return tileSet;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
//_______________________________________________________
|
2009-09-18 01:32:27 +00:00
|
|
|
TileSet* OxygenShadowCache::tileSet( const OxygenClient* client, int index )
|
2009-09-17 22:40:06 +00:00
|
|
|
{
|
2009-09-18 01:32:27 +00:00
|
|
|
|
|
|
|
assert( index <= maxIndex_ );
|
|
|
|
|
|
|
|
// construct key
|
2009-09-18 23:55:18 +00:00
|
|
|
Key key( client );
|
2009-09-19 06:05:43 +00:00
|
|
|
key.index = index;
|
2009-09-18 01:32:27 +00:00
|
|
|
|
|
|
|
// check if tileset already in cache
|
|
|
|
int hash( key.hash() );
|
|
|
|
if( animatedShadowCache_.contains(hash) ) return animatedShadowCache_.object(hash);
|
|
|
|
|
|
|
|
// create shadow and tileset otherwise
|
|
|
|
qreal size( shadowSize() );
|
|
|
|
qreal opacity( qreal(index)/qreal(maxIndex_) );
|
|
|
|
|
|
|
|
QPixmap shadow( size*2, size*2 );
|
|
|
|
shadow.fill( Qt::transparent );
|
|
|
|
QPainter p( &shadow );
|
|
|
|
p.setRenderHint( QPainter::Antialiasing );
|
|
|
|
|
2009-09-26 21:21:39 +00:00
|
|
|
QPixmap inactiveShadow( shadowPixmap( client, false ) );
|
|
|
|
{
|
|
|
|
QPainter pp( &inactiveShadow );
|
|
|
|
pp.setRenderHint( QPainter::Antialiasing );
|
|
|
|
pp.setCompositionMode(QPainter::CompositionMode_DestinationIn);
|
|
|
|
pp.fillRect( inactiveShadow.rect(), QColor( 0, 0, 0, 255*(1.0-opacity ) ) );
|
|
|
|
}
|
|
|
|
|
|
|
|
QPixmap activeShadow( shadowPixmap( client, true ) );
|
|
|
|
{
|
|
|
|
QPainter pp( &activeShadow );
|
|
|
|
pp.setRenderHint( QPainter::Antialiasing );
|
|
|
|
pp.setCompositionMode(QPainter::CompositionMode_DestinationIn);
|
|
|
|
pp.fillRect( activeShadow.rect(), QColor( 0, 0, 0, 255*( opacity ) ) );
|
|
|
|
}
|
|
|
|
|
|
|
|
p.drawPixmap( QPointF(0,0), inactiveShadow );
|
|
|
|
p.drawPixmap( QPointF(0,0), activeShadow );
|
2009-09-18 01:32:27 +00:00
|
|
|
p.end();
|
|
|
|
|
|
|
|
TileSet* tileSet = new TileSet(shadow, size, size, 1, 1);
|
|
|
|
animatedShadowCache_.insert( hash, tileSet );
|
|
|
|
return tileSet;
|
|
|
|
|
2009-09-17 22:40:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//_________________________________________________________________
|
|
|
|
QPixmap OxygenShadowCache::shadowPixmap(const OxygenClient* client, bool active ) const
|
|
|
|
{
|
|
|
|
|
|
|
|
// get window color
|
2009-09-18 23:55:18 +00:00
|
|
|
Key key( client );
|
2009-09-17 22:40:06 +00:00
|
|
|
QPalette palette( client->backgroundPalette( client->widget(), client->widget()->palette() ) );
|
|
|
|
QColor color( palette.color( client->widget()->backgroundRole() ) );
|
2009-10-15 16:03:30 +00:00
|
|
|
return simpleShadowPixmap( color, key, active );
|
2009-09-17 22:40:06 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
//_______________________________________________________
|
2009-09-18 23:55:18 +00:00
|
|
|
QPixmap OxygenShadowCache::simpleShadowPixmap( const QColor& color, const Key& key, bool active ) const
|
2009-09-17 22:40:06 +00:00
|
|
|
{
|
|
|
|
|
|
|
|
// local reference to relevant shadow configuration
|
|
|
|
const OxygenShadowConfiguration& shadowConfiguration(
|
2009-09-18 23:55:18 +00:00
|
|
|
active && key.useOxygenShadows ?
|
2009-09-17 22:40:06 +00:00
|
|
|
activeShadowConfiguration_:inactiveShadowConfiguration_ );
|
|
|
|
|
|
|
|
static const qreal fixedSize = 25.5;
|
|
|
|
qreal size( shadowSize() );
|
|
|
|
qreal shadowSize( shadowConfiguration.shadowSize() );
|
|
|
|
|
|
|
|
QPixmap shadow = QPixmap( size*2, size*2 );
|
|
|
|
shadow.fill( Qt::transparent );
|
|
|
|
|
|
|
|
QPainter p( &shadow );
|
|
|
|
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;
|
|
|
|
|
2009-10-15 16:03:30 +00:00
|
|
|
// some gradients rendering are different at bottom corners if client has no border
|
|
|
|
bool hasBorder( key.hasBorder || key.isShade );
|
2009-09-20 06:50:42 +00:00
|
|
|
|
2009-10-19 19:43:59 +00:00
|
|
|
if( shadowSize )
|
2009-09-17 22:40:06 +00:00
|
|
|
{
|
|
|
|
|
2009-10-19 19:43:59 +00:00
|
|
|
if( active && key.useOxygenShadows )
|
2009-09-17 22:40:06 +00:00
|
|
|
{
|
|
|
|
|
2009-10-19 19:43:59 +00:00
|
|
|
{
|
2009-09-17 22:40:06 +00:00
|
|
|
|
2009-10-19 19:43:59 +00:00
|
|
|
// 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 ); }
|
2009-09-17 22:40:06 +00:00
|
|
|
|
2009-10-19 19:43:59 +00:00
|
|
|
p.setBrush( rg );
|
|
|
|
renderGradient( p, shadow.rect(), rg, hasBorder );
|
2009-09-17 22:40:06 +00:00
|
|
|
|
2009-10-19 19:43:59 +00:00
|
|
|
}
|
2009-09-17 22:40:06 +00:00
|
|
|
|
2009-10-19 19:43:59 +00:00
|
|
|
if( true ) {
|
2009-09-17 22:40:06 +00:00
|
|
|
|
2009-10-19 19:43:59 +00:00
|
|
|
// 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 ); }
|
2009-09-17 22:40:06 +00:00
|
|
|
|
2009-10-19 19:43:59 +00:00
|
|
|
p.setBrush( rg );
|
|
|
|
p.drawRect( shadow.rect() );
|
2009-09-17 22:40:06 +00:00
|
|
|
|
2009-10-19 19:43:59 +00:00
|
|
|
}
|
2009-09-17 22:40:06 +00:00
|
|
|
|
2009-10-19 19:43:59 +00:00
|
|
|
} else {
|
2009-09-17 22:40:06 +00:00
|
|
|
|
2009-10-19 19:43:59 +00:00
|
|
|
{
|
|
|
|
// 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 ); }
|
2009-09-17 22:40:06 +00:00
|
|
|
|
2009-10-19 19:43:59 +00:00
|
|
|
renderGradient( p, shadow.rect(), rg, hasBorder );
|
2009-09-17 22:40:06 +00:00
|
|
|
|
2009-10-19 19:43:59 +00:00
|
|
|
}
|
2009-09-17 22:40:06 +00:00
|
|
|
|
2009-10-19 19:43:59 +00:00
|
|
|
{
|
2009-09-17 22:40:06 +00:00
|
|
|
|
2009-10-19 19:43:59 +00:00
|
|
|
// 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 ); }
|
2009-09-17 22:40:06 +00:00
|
|
|
|
2009-10-19 19:43:59 +00:00
|
|
|
p.setBrush( rg );
|
|
|
|
p.drawRect( shadow.rect() );
|
2009-09-17 22:40:06 +00:00
|
|
|
|
2009-10-19 19:43:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
// 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() );
|
2009-10-11 17:10:08 +00:00
|
|
|
|
2009-10-19 19:43:59 +00:00
|
|
|
}
|
2009-09-17 22:40:06 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2009-09-19 05:51:31 +00:00
|
|
|
}
|
2009-09-17 22:40:06 +00:00
|
|
|
|
|
|
|
// 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);
|
2009-10-13 01:45:01 +00:00
|
|
|
lg.setColorAt(0.0, helper().calcLightColor( helper().backgroundTopColor(color) ));
|
2009-11-18 07:31:34 +00:00
|
|
|
lg.setColorAt(1.0, helper().backgroundBottomColor(color) );
|
2009-10-13 23:21:34 +00:00
|
|
|
|
2009-11-18 07:31:34 +00:00
|
|
|
if( key.isShade ) lg.setColorAt(0.51, helper().backgroundTopColor(color) );
|
|
|
|
else lg.setColorAt(0.51, helper().backgroundBottomColor(color) );
|
2009-10-13 23:21:34 +00:00
|
|
|
|
2009-09-17 22:40:06 +00:00
|
|
|
|
2009-09-20 06:50:42 +00:00
|
|
|
// draw ellipse.
|
|
|
|
p.setBrush( lg );
|
2009-10-11 17:10:08 +00:00
|
|
|
p.drawEllipse( QRectF( size-4, size-4, 8, 8 ) );
|
2009-09-17 22:40:06 +00:00
|
|
|
|
2009-09-19 05:51:31 +00:00
|
|
|
p.end();
|
|
|
|
return shadow;
|
2009-09-17 22:40:06 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2009-09-20 00:50:33 +00:00
|
|
|
//_______________________________________________________
|
2009-10-15 16:03:30 +00:00
|
|
|
void OxygenShadowCache::renderGradient( QPainter& p, const QRectF& rect, const QRadialGradient& rg, bool hasBorder ) const
|
2009-09-20 00:50:33 +00:00
|
|
|
{
|
|
|
|
|
2009-10-15 16:03:30 +00:00
|
|
|
if( hasBorder )
|
2009-09-20 00:50:33 +00:00
|
|
|
{
|
|
|
|
p.setBrush( rg );
|
|
|
|
p.drawRect( rect );
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
qreal size( rect.width()/2.0 );
|
|
|
|
qreal hoffset( rg.center().x() - size );
|
|
|
|
qreal voffset( rg.center().y() - size );
|
|
|
|
|
|
|
|
// load gradient stops
|
|
|
|
QGradientStops stops( rg.stops() );
|
|
|
|
qreal radius( rg.radius() );
|
|
|
|
|
|
|
|
// draw ellipse for the upper rect
|
2009-09-20 06:50:42 +00:00
|
|
|
{
|
|
|
|
QRectF rect( hoffset, voffset, 2*size-hoffset, size );
|
|
|
|
p.setBrush( rg );
|
|
|
|
p.drawRect( rect );
|
|
|
|
}
|
2009-09-20 00:50:33 +00:00
|
|
|
|
|
|
|
// draw square gradients for the lower rect
|
|
|
|
{
|
2009-09-20 06:50:42 +00:00
|
|
|
// vertical lines
|
|
|
|
QRectF rect( hoffset, size+voffset, 2*size-hoffset, 4 );
|
2009-09-20 00:50:33 +00:00
|
|
|
QLinearGradient lg( hoffset, 0.0, 2*size+hoffset, 0.0 );
|
|
|
|
for( int i = 0; i<stops.size(); i++ )
|
|
|
|
{
|
|
|
|
QColor c( stops[i].second );
|
|
|
|
qreal xx( stops[i].first*radius );
|
|
|
|
lg.setColorAt( (size-xx)/(2.0*size), c );
|
|
|
|
lg.setColorAt( (size+xx)/(2.0*size), c );
|
|
|
|
}
|
|
|
|
|
|
|
|
p.setBrush( lg );
|
|
|
|
p.drawRect( rect );
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
{
|
|
|
|
// horizontal line
|
2009-09-20 06:50:42 +00:00
|
|
|
QRectF rect( size-4+hoffset, size+voffset, 8, size );
|
2009-09-20 00:50:33 +00:00
|
|
|
QLinearGradient lg = QLinearGradient( 0, voffset, 0, 2*size+voffset );
|
|
|
|
for( int i = 0; i<stops.size(); i++ )
|
|
|
|
{
|
|
|
|
QColor c( stops[i].second );
|
|
|
|
qreal xx( stops[i].first*radius );
|
|
|
|
lg.setColorAt( (size+xx)/(2.0*size), c );
|
|
|
|
}
|
|
|
|
|
|
|
|
p.setBrush( lg );
|
|
|
|
p.drawRect( rect );
|
|
|
|
}
|
|
|
|
|
|
|
|
{
|
2009-09-20 06:50:42 +00:00
|
|
|
|
2009-09-20 00:50:33 +00:00
|
|
|
// bottom-left corner
|
2009-09-20 06:50:42 +00:00
|
|
|
QRectF rect( hoffset, size+4+voffset, size-4, size );
|
2009-09-20 00:50:33 +00:00
|
|
|
QRadialGradient rg = QRadialGradient( size+hoffset-4, size+4+voffset, radius );
|
|
|
|
for( int i = 0; i<stops.size(); i++ )
|
|
|
|
{
|
|
|
|
QColor c( stops[i].second );
|
|
|
|
qreal xx( stops[i].first -4.0/rg.radius() );
|
|
|
|
if( xx<0 && i < stops.size()-1 )
|
|
|
|
{
|
|
|
|
qreal x1( stops[i+1].first -4.0/rg.radius() );
|
|
|
|
c = KColorUtils::mix( c, stops[i+1].second, -xx/(x1-xx) );
|
|
|
|
xx = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
rg.setColorAt( xx, c );
|
|
|
|
}
|
|
|
|
|
|
|
|
p.setBrush( rg );
|
|
|
|
p.drawRect( rect );
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
{
|
|
|
|
// bottom-right corner
|
2009-09-20 06:50:42 +00:00
|
|
|
QRectF rect( size+4+hoffset, size+4+voffset, size-4, size );
|
2009-09-20 00:50:33 +00:00
|
|
|
QRadialGradient rg = QRadialGradient( size+hoffset+4, size+4+voffset, radius );
|
|
|
|
for( int i = 0; i<stops.size(); i++ )
|
|
|
|
{
|
|
|
|
QColor c( stops[i].second );
|
|
|
|
qreal xx( stops[i].first -4.0/rg.radius() );
|
|
|
|
if( xx<0 && i < stops.size()-1 )
|
|
|
|
{
|
|
|
|
qreal x1( stops[i+1].first -4.0/rg.radius() );
|
|
|
|
c = KColorUtils::mix( c, stops[i+1].second, -xx/(x1-xx) );
|
|
|
|
xx = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
rg.setColorAt( xx, c );
|
|
|
|
}
|
|
|
|
|
|
|
|
p.setBrush( rg );
|
|
|
|
p.drawRect( rect );
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
2009-09-20 06:50:42 +00:00
|
|
|
|
2009-10-13 01:45:01 +00:00
|
|
|
OxygenShadowCache::Key::Key( const OxygenClient* client):
|
|
|
|
index(0)
|
|
|
|
{
|
|
|
|
|
2009-11-15 03:24:04 +00:00
|
|
|
active = client->isActive() || client->isForcedActive();
|
2009-10-13 01:45:01 +00:00
|
|
|
useOxygenShadows = client->configuration().useOxygenShadows();
|
|
|
|
isShade = client->isShade();
|
|
|
|
hasTitleOutline = client->configuration().drawTitleOutline();
|
2009-10-15 16:03:30 +00:00
|
|
|
hasBorder = ( client->configuration().frameBorder() > OxygenConfiguration::BorderNone );
|
2009-10-13 01:45:01 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-09-17 22:40:06 +00:00
|
|
|
}
|