Arghl. Again a stupid bug caused by float having poor precision.

Reverting r700026 and changing floats to doubles again. I'd probably like
to change even the ones interfacing with OpenGL which I've left for now.


svn path=/trunk/KDE/kdebase/workspace/; revision=707987
icc-effect-5.14.5
Luboš Luňák 2007-09-03 15:00:43 +00:00
parent 228928d45e
commit e6069e9cf6
49 changed files with 232 additions and 232 deletions

View File

@ -35,7 +35,7 @@ class Deleted
void copyToDeleted( Toplevel* c ); void copyToDeleted( Toplevel* c );
virtual ~Deleted(); // deleted only using unrefWindow() virtual ~Deleted(); // deleted only using unrefWindow()
int delete_refcount; int delete_refcount;
float window_opacity; double window_opacity;
int desk; int desk;
QRect contentsRect; // for clientPos()/clientSize() QRect contentsRect; // for clientPos()/clientSize()
}; };

View File

@ -172,7 +172,7 @@ void EffectsHandlerImpl::windowUserMovedResized( EffectWindow* c, bool first, bo
ep.second->windowUserMovedResized( c, first, last ); ep.second->windowUserMovedResized( c, first, last );
} }
void EffectsHandlerImpl::windowOpacityChanged( EffectWindow* c, float old_opacity ) void EffectsHandlerImpl::windowOpacityChanged( EffectWindow* c, double old_opacity )
{ {
if( static_cast<EffectWindowImpl*>(c)->window()->opacity() == old_opacity ) if( static_cast<EffectWindowImpl*>(c)->window()->opacity() == old_opacity )
return; return;
@ -853,7 +853,7 @@ bool EffectWindowImpl::isMinimized() const
return false; return false;
} }
float EffectWindowImpl::opacity() const double EffectWindowImpl::opacity() const
{ {
return toplevel->opacity(); return toplevel->opacity();
} }

View File

@ -92,7 +92,7 @@ class EffectsHandlerImpl : public EffectsHandler
// internal (used by kwin core or compositing code) // internal (used by kwin core or compositing code)
void startPaint(); void startPaint();
void windowUserMovedResized( EffectWindow* c, bool first, bool last ); void windowUserMovedResized( EffectWindow* c, bool first, bool last );
void windowOpacityChanged( EffectWindow* c, float old_opacity ); void windowOpacityChanged( EffectWindow* c, double old_opacity );
void windowAdded( EffectWindow* c ); void windowAdded( EffectWindow* c );
void windowClosed( EffectWindow* c ); void windowClosed( EffectWindow* c );
void windowDeleted( EffectWindow* c ); void windowDeleted( EffectWindow* c );
@ -149,7 +149,7 @@ class EffectWindowImpl : public EffectWindow
virtual bool isOnAllDesktops() const; virtual bool isOnAllDesktops() const;
virtual int desktop() const; // prefer isOnXXX() virtual int desktop() const; // prefer isOnXXX()
virtual bool isMinimized() const; virtual bool isMinimized() const;
virtual float opacity() const; virtual double opacity() const;
virtual QString caption() const; virtual QString caption() const;
virtual QPixmap icon() const; virtual QPixmap icon() const;
virtual QString windowClass() const; virtual QString windowClass() const;

View File

@ -528,8 +528,8 @@ void BoxSwitchEffect::paintDesktopThumbnail( int iDesktop )
QSize size = QSize( displayWidth(), displayHeight()); QSize size = QSize( displayWidth(), displayHeight());
size.scale( r.size(), Qt::KeepAspectRatio ); size.scale( r.size(), Qt::KeepAspectRatio );
data.xScale = size.width() / float( displayWidth()); data.xScale = size.width() / double( displayWidth());
data.yScale = size.height() / float( displayHeight()); data.yScale = size.height() / double( displayHeight());
int width = int( displayWidth() * data.xScale ); int width = int( displayWidth() * data.xScale );
int height = int( displayHeight() * data.yScale ); int height = int( displayHeight() * data.yScale );
int x = r.x() + ( r.width() - width ) / 2; int x = r.x() + ( r.width() - width ) / 2;

View File

@ -121,7 +121,7 @@ void LiquidEffect::postPaintScreen()
// Use the shader // Use the shader
mShader->bind(); mShader->bind();
mShader->setUniform("time", mTime); mShader->setUniform("time", (float)mTime);
// Render fullscreen quad with screen contents // Render fullscreen quad with screen contents
glBegin(GL_QUADS); glBegin(GL_QUADS);

View File

@ -44,7 +44,7 @@ class LiquidEffect : public Effect
GLShader* mShader; GLShader* mShader;
bool mValid; bool mValid;
float mTime; double mTime;
}; };
} // namespace } // namespace

View File

@ -59,8 +59,8 @@ void TaskbarThumbnailEffect::postPaintScreen()
WindowPaintData thumbdata( w ); WindowPaintData thumbdata( w );
thumbdata.xTranslate = thumb.x() - w->x(); thumbdata.xTranslate = thumb.x() - w->x();
thumbdata.yTranslate = thumb.y() - w->y(); thumbdata.yTranslate = thumb.y() - w->y();
thumbdata.xScale = thumb.width() / (float)w->width(); thumbdata.xScale = thumb.width() / (double)w->width();
thumbdata.yScale = thumb.height() / (float)w->height(); thumbdata.yScale = thumb.height() / (double)w->height();
// From Scene::Window::infiniteRegion() // From Scene::Window::infiniteRegion()
QRegion infRegion = QRegion( INT_MIN / 2, INT_MIN / 2, INT_MAX, INT_MAX ); QRegion infRegion = QRegion( INT_MIN / 2, INT_MIN / 2, INT_MAX, INT_MAX );
effects->paintWindow( w, PAINT_WINDOW_TRANSFORMED, infRegion, thumbdata ); effects->paintWindow( w, PAINT_WINDOW_TRANSFORMED, infRegion, thumbdata );
@ -79,7 +79,7 @@ QRect TaskbarThumbnailEffect::getThumbnailPosition( EffectWindow* c, int* space
if( icon.right() < 40 || ( displayWidth() - icon.left()) < 40 ) if( icon.right() < 40 || ( displayWidth() - icon.left()) < 40 )
{ {
// Vertical taskbar... // Vertical taskbar...
float scale = qMin(qMax(icon.height(), 100) / (float)c->height(), 200.0f / c->width()); double scale = qMin(qMax(icon.height(), 100) / (double)c->height(), 200.0 / c->width());
thumb.setSize( QSize( int(scale * c->width()),int(scale * c->height()) )); thumb.setSize( QSize( int(scale * c->width()),int(scale * c->height()) ));
if( icon.right() < 40 ) // ...on the left if( icon.right() < 40 ) // ...on the left
thumb.moveTopLeft( QPoint( icon.right() + *space, icon.top() )); thumb.moveTopLeft( QPoint( icon.right() + *space, icon.top() ));
@ -90,7 +90,7 @@ QRect TaskbarThumbnailEffect::getThumbnailPosition( EffectWindow* c, int* space
else else
{ {
// Horizontal taskbar... // Horizontal taskbar...
float scale = qMin(qMax(icon.width(), 75) / (float)c->width(), 200.0f / c->height()); double scale = qMin(qMax(icon.width(), 75) / (double)c->width(), 200.0 / c->height());
thumb.setSize( QSize( int(scale * c->width()),int(scale * c->height()) )); thumb.setSize( QSize( int(scale * c->width()),int(scale * c->height()) ));
if( icon.top() < ( displayHeight() - icon.bottom())) // ...at the top if( icon.top() < ( displayHeight() - icon.bottom())) // ...at the top
thumb.moveTopLeft( QPoint( icon.left(), icon.bottom() + *space )); thumb.moveTopLeft( QPoint( icon.left(), icon.bottom() + *space ));

View File

@ -32,7 +32,7 @@ class WavyWindowsEffect
virtual void postPaintScreen(); virtual void postPaintScreen();
private: private:
float mTimeElapsed; double mTimeElapsed;
}; };
} // namespace } // namespace

View File

@ -46,7 +46,7 @@ void DesktopGridEffect::prePaintScreen( ScreenPrePaintData& data, int time )
{ {
if( slide ) if( slide )
{ {
progress = qMin( 1.0f, progress + time / float( PROGRESS_TIME )); progress = qMin( 1.0, progress + time / double( PROGRESS_TIME ));
// PAINT_SCREEN_BACKGROUND_FIRST is needed because screen will be actually painted more than once, // PAINT_SCREEN_BACKGROUND_FIRST is needed because screen will be actually painted more than once,
// so with normal screen painting second screen paint would erase parts of the first paint // so with normal screen painting second screen paint would erase parts of the first paint
if( progress != 1 ) if( progress != 1 )
@ -60,9 +60,9 @@ void DesktopGridEffect::prePaintScreen( ScreenPrePaintData& data, int time )
else if( progress != 0 || activated ) else if( progress != 0 || activated )
{ {
if( activated ) if( activated )
progress = qMin( 1.0f, progress + time / float( PROGRESS_TIME )); progress = qMin( 1.0, progress + time / double( PROGRESS_TIME ));
else else
progress = qMax( 0.0f, progress - time / float( PROGRESS_TIME )); progress = qMax( 0.0, progress - time / double( PROGRESS_TIME ));
// PAINT_SCREEN_BACKGROUND_FIRST is needed because screen will be actually painted more than once, // PAINT_SCREEN_BACKGROUND_FIRST is needed because screen will be actually painted more than once,
// so with normal screen painting second screen paint would erase parts of the first paint // so with normal screen painting second screen paint would erase parts of the first paint
if( progress != 0 ) if( progress != 0 )
@ -150,8 +150,8 @@ void DesktopGridEffect::paintScreenDesktop( int desktop, int mask, QRegion regio
QRect normal = desktopRect( effects->currentDesktop(), false ); QRect normal = desktopRect( effects->currentDesktop(), false );
d.xTranslate += rect.x(); // - normal.x(); d.xTranslate += rect.x(); // - normal.x();
d.yTranslate += rect.y(); // - normal.y(); d.yTranslate += rect.y(); // - normal.y();
d.xScale *= rect.width() / float( normal.width()); d.xScale *= rect.width() / double( normal.width());
d.yScale *= rect.height() / float( normal.height()); d.yScale *= rect.height() / double( normal.height());
// TODO mask parts that are not visible? // TODO mask parts that are not visible?
effects->paintScreen( mask, region, d ); effects->paintScreen( mask, region, d );
} }
@ -280,10 +280,10 @@ QRect DesktopGridEffect::desktopRect( int desktop, bool scaled ) const
if( !scaled ) if( !scaled )
return rect; return rect;
QRect current = desktopRect( effects->currentDesktop(), false ); QRect current = desktopRect( effects->currentDesktop(), false );
rect = QRect( qRound( interpolate( rect.x() - current.x(), rect.x() / float( x ), progress )), rect = QRect( qRound( interpolate( rect.x() - current.x(), rect.x() / double( x ), progress )),
qRound( interpolate( rect.y() - current.y(), rect.y() / float( y ), progress )), qRound( interpolate( rect.y() - current.y(), rect.y() / double( y ), progress )),
qRound( interpolate( rect.width(), displayWidth() / float( x ), progress )), qRound( interpolate( rect.width(), displayWidth() / double( x ), progress )),
qRound( interpolate( rect.height(), displayHeight() / float( y ), progress ))); qRound( interpolate( rect.height(), displayHeight() / double( y ), progress )));
return rect; return rect;
} }
@ -395,9 +395,9 @@ void DesktopGridEffect::slideDesktopChanged( int old )
{ // current position is in new current desktop (e.g. quickly changing back), { // current position is in new current desktop (e.g. quickly changing back),
// don't do full progress // don't do full progress
if( abs( currentPos.x() - rect.x()) > abs( currentPos.y() - rect.y())) if( abs( currentPos.x() - rect.x()) > abs( currentPos.y() - rect.y()))
progress = 1 - abs( currentPos.x() - rect.x()) / float( displayWidth()); progress = 1 - abs( currentPos.x() - rect.x()) / double( displayWidth());
else else
progress = 1 - abs( currentPos.y() - rect.y()) / float( displayHeight()); progress = 1 - abs( currentPos.y() - rect.y()) / double( displayHeight());
} }
else // current position is not on current desktop, do full progress else // current position is not on current desktop, do full progress
progress = 0; progress = 0;

View File

@ -45,7 +45,7 @@ class DesktopGridEffect
void paintSlide( int mask, QRegion region, const ScreenPaintData& data ); void paintSlide( int mask, QRegion region, const ScreenPaintData& data );
void paintScreenDesktop( int desktop, int mask, QRegion region, ScreenPaintData data ); void paintScreenDesktop( int desktop, int mask, QRegion region, ScreenPaintData data );
void slideDesktopChanged( int old ); void slideDesktopChanged( int old );
float progress; double progress;
bool activated; bool activated;
int painting_desktop; int painting_desktop;
int hover_desktop; int hover_desktop;

View File

@ -18,7 +18,7 @@ KWIN_EFFECT( dialogparent, DialogParentEffect )
void DialogParentEffect::prePaintWindow( EffectWindow* w, WindowPrePaintData& data, int time ) void DialogParentEffect::prePaintWindow( EffectWindow* w, WindowPrePaintData& data, int time )
{ {
// How long does it take for the effect to get it's full strength (in ms) // How long does it take for the effect to get it's full strength (in ms)
const float changeTime = 200; const double changeTime = 200;
// Check if this window has a modal dialog and change the window's // Check if this window has a modal dialog and change the window's
// effect's strength accordingly // effect's strength accordingly
@ -26,11 +26,11 @@ void DialogParentEffect::prePaintWindow( EffectWindow* w, WindowPrePaintData& da
if( hasDialog ) if( hasDialog )
{ {
// Increase effect strength of this window // Increase effect strength of this window
effectStrength[w] = qMin(1.0f, effectStrength[w] + time/changeTime); effectStrength[w] = qMin(1.0, effectStrength[w] + time/changeTime);
} }
else else
{ {
effectStrength[w] = qMax(0.0f, effectStrength[w] - time/changeTime); effectStrength[w] = qMax(0.0, effectStrength[w] - time/changeTime);
} }
// Call the next effect // Call the next effect
@ -39,7 +39,7 @@ void DialogParentEffect::prePaintWindow( EffectWindow* w, WindowPrePaintData& da
void DialogParentEffect::paintWindow( EffectWindow* w, int mask, QRegion region, WindowPaintData& data ) void DialogParentEffect::paintWindow( EffectWindow* w, int mask, QRegion region, WindowPaintData& data )
{ {
float s = effectStrength[w]; double s = effectStrength[w];
if(s > 0.0f) if(s > 0.0f)
{ {
// Brightness will be within [1.0; 0.6] // Brightness will be within [1.0; 0.6]
@ -54,7 +54,7 @@ void DialogParentEffect::paintWindow( EffectWindow* w, int mask, QRegion region,
void DialogParentEffect::postPaintWindow( EffectWindow* w ) void DialogParentEffect::postPaintWindow( EffectWindow* w )
{ {
float s = effectStrength[w]; double s = effectStrength[w];
// If strength is between 0 and 1, the effect is still in progress and the // If strength is between 0 and 1, the effect is still in progress and the
// window has to be repainted during the next pass // window has to be repainted during the next pass

View File

@ -39,7 +39,7 @@ class DialogParentEffect
bool hasModalWindow( EffectWindow* t ); bool hasModalWindow( EffectWindow* t );
private: private:
// The progress of the fading. // The progress of the fading.
QHash<EffectWindow*, float> effectStrength; QHash<EffectWindow*, double> effectStrength;
}; };
} // namespace } // namespace

View File

@ -27,7 +27,7 @@ class DrunkenEffect
virtual void windowAdded( EffectWindow* w ); virtual void windowAdded( EffectWindow* w );
virtual void windowClosed( EffectWindow* w ); virtual void windowClosed( EffectWindow* w );
private: private:
QHash< EffectWindow*, float > windows; // progress QHash< EffectWindow*, double > windows; // progress
}; };
} // namespace } // namespace

View File

@ -144,8 +144,8 @@ void ExplosionEffect::paintWindow( EffectWindow* w, int mask, QRegion region, Wi
bool useshader = ( mValid && mWindows.contains( w ) ); bool useshader = ( mValid && mWindows.contains( w ) );
if( useshader ) if( useshader )
{ {
float maxscaleadd = 1.5f; double maxscaleadd = 1.5f;
float scale = 1 + maxscaleadd*mWindows[w]; double scale = 1 + maxscaleadd*mWindows[w];
data.xScale = scale; data.xScale = scale;
data.yScale = scale; data.yScale = scale;
data.xTranslate += int( w->width() / 2 * ( 1 - scale )); data.xTranslate += int( w->width() / 2 * ( 1 - scale ));
@ -153,7 +153,7 @@ void ExplosionEffect::paintWindow( EffectWindow* w, int mask, QRegion region, Wi
data.opacity *= 0.99; // Force blending data.opacity *= 0.99; // Force blending
mShader->bind(); mShader->bind();
mShader->setUniform("factor", (float)mWindows[w]); mShader->setUniform("factor", (float)mWindows[w]);
mShader->setUniform("scale", scale); mShader->setUniform("scale", (float)scale);
glActiveTexture(GL_TEXTURE4); glActiveTexture(GL_TEXTURE4);
mStartOffsetTex->bind(); mStartOffsetTex->bind();
glActiveTexture(GL_TEXTURE5); glActiveTexture(GL_TEXTURE5);

View File

@ -50,7 +50,7 @@ class ExplosionEffect
GLShader* mShader; GLShader* mShader;
GLTexture* mStartOffsetTex; GLTexture* mStartOffsetTex;
GLTexture* mEndOffsetTex; GLTexture* mEndOffsetTex;
QMap< const EffectWindow*, float > mWindows; QMap< const EffectWindow*, double > mWindows;
int mActiveAnimations; int mActiveAnimations;
bool mValid; bool mValid;
bool mInited; bool mInited;

View File

@ -29,8 +29,8 @@ void FadeEffect::prePaintScreen( ScreenPrePaintData& data, int time )
{ {
if( !windows.isEmpty()) if( !windows.isEmpty())
{ {
fadeInStep = time / float( fadeInTime ); fadeInStep = time / double( fadeInTime );
fadeOutStep = time / float( fadeOutTime ); fadeOutStep = time / double( fadeOutTime );
} }
effects->prePaintScreen( data, time ); effects->prePaintScreen( data, time );
} }
@ -95,28 +95,28 @@ void FadeEffect::paintWindow( EffectWindow* w, int mask, QRegion region, WindowP
if( new_data.saturation > windows[ w ].saturation ) if( new_data.saturation > windows[ w ].saturation )
{ {
windows[ w ].saturation = qMin( new_data.saturation, windows[ w ].saturation = qMin( new_data.saturation,
windows[ w ].saturation + float( windows[ w ].fadeInStep )); windows[ w ].saturation + windows[ w ].fadeInStep );
} }
else if( new_data.saturation < windows[ w ].saturation ) else if( new_data.saturation < windows[ w ].saturation )
{ {
windows[ w ].saturation = qMax( new_data.saturation, windows[ w ].saturation = qMax( new_data.saturation,
windows[ w ].saturation - float( windows[ w ].fadeOutStep )); windows[ w ].saturation - windows[ w ].fadeOutStep );
} }
if( new_data.brightness > windows[ w ].brightness ) if( new_data.brightness > windows[ w ].brightness )
{ {
windows[ w ].brightness = qMin( new_data.brightness, windows[ w ].brightness = qMin( new_data.brightness,
windows[ w ].brightness + float( windows[ w ].fadeInStep )); windows[ w ].brightness + windows[ w ].fadeInStep );
} }
else if( new_data.brightness < windows[ w ].brightness ) else if( new_data.brightness < windows[ w ].brightness )
{ {
windows[ w ].brightness = qMax( new_data.brightness, windows[ w ].brightness = qMax( new_data.brightness,
windows[ w ].brightness - float( windows[ w ].fadeOutStep )); windows[ w ].brightness - windows[ w ].fadeOutStep );
} }
windows[ w ].opacity = qBound( 0.0f, windows[ w ].opacity, 1.0f ); windows[ w ].opacity = qBound( 0.0, windows[ w ].opacity, 1.0 );
windows[ w ].saturation = qBound( 0.0f, windows[ w ].saturation, 1.0f ); windows[ w ].saturation = qBound( 0.0, windows[ w ].saturation, 1.0 );
windows[ w ].brightness = qBound( 0.0f, windows[ w ].brightness, 1.0f ); windows[ w ].brightness = qBound( 0.0, windows[ w ].brightness, 1.0 );
windows[ w ].fadeInStep = 0.0; windows[ w ].fadeInStep = 0.0;
windows[ w ].fadeOutStep = 0.0; windows[ w ].fadeOutStep = 0.0;
@ -136,7 +136,7 @@ void FadeEffect::paintWindow( EffectWindow* w, int mask, QRegion region, WindowP
effects->paintWindow( w, mask, region, data ); effects->paintWindow( w, mask, region, data );
} }
void FadeEffect::windowOpacityChanged( EffectWindow* w, float old_opacity ) void FadeEffect::windowOpacityChanged( EffectWindow* w, double old_opacity )
{ {
if( !windows.contains( w )) if( !windows.contains( w ))
windows[ w ].opacity = old_opacity; windows[ w ].opacity = old_opacity;

View File

@ -26,7 +26,7 @@ class FadeEffect
virtual void paintWindow( EffectWindow* w, int mask, QRegion region, WindowPaintData& data ); virtual void paintWindow( EffectWindow* w, int mask, QRegion region, WindowPaintData& data );
// TODO react also on virtual desktop changes // TODO react also on virtual desktop changes
virtual void windowOpacityChanged( EffectWindow* c, float old_opacity ); virtual void windowOpacityChanged( EffectWindow* c, double old_opacity );
virtual void windowAdded( EffectWindow* c ); virtual void windowAdded( EffectWindow* c );
virtual void windowClosed( EffectWindow* c ); virtual void windowClosed( EffectWindow* c );
virtual void windowDeleted( EffectWindow* c ); virtual void windowDeleted( EffectWindow* c );
@ -35,7 +35,7 @@ class FadeEffect
private: private:
class WindowInfo; class WindowInfo;
QHash< const EffectWindow*, WindowInfo > windows; QHash< const EffectWindow*, WindowInfo > windows;
float fadeInStep, fadeOutStep; double fadeInStep, fadeOutStep;
int fadeInTime, fadeOutTime; int fadeInTime, fadeOutTime;
bool fadeWindows; bool fadeWindows;
}; };
@ -51,9 +51,9 @@ class FadeEffect::WindowInfo
, brightness( 1.0 ) , brightness( 1.0 )
, deleted( false ) , deleted( false )
{} {}
float fadeInStep, fadeOutStep; double fadeInStep, fadeOutStep;
float opacity; double opacity;
float saturation, brightness; double saturation, brightness;
bool deleted; bool deleted;
}; };

View File

@ -57,17 +57,17 @@ void FallApartEffect::paintWindow( EffectWindow* w, int mask, QRegion region, Wi
// make fragments move in various directions, based on where // make fragments move in various directions, based on where
// they are (left pieces generally move to the left, etc.) // they are (left pieces generally move to the left, etc.)
QPointF p1( quad[ 0 ].x(), quad[ 0 ].y()); QPointF p1( quad[ 0 ].x(), quad[ 0 ].y());
float xdiff = 0; double xdiff = 0;
if( p1.x() < w->width() / 2 ) if( p1.x() < w->width() / 2 )
xdiff = -( w->width() / 2 - p1.x()) / w->width() * 100; xdiff = -( w->width() / 2 - p1.x()) / w->width() * 100;
if( p1.x() > w->width() / 2 ) if( p1.x() > w->width() / 2 )
xdiff = ( p1.x() - w->width() / 2 ) / w->width() * 100; xdiff = ( p1.x() - w->width() / 2 ) / w->width() * 100;
float ydiff = 0; double ydiff = 0;
if( p1.y() < w->height() / 2 ) if( p1.y() < w->height() / 2 )
ydiff = -( w->height() / 2 - p1.y()) / w->height() * 100; ydiff = -( w->height() / 2 - p1.y()) / w->height() * 100;
if( p1.y() > w->height() / 2 ) if( p1.y() > w->height() / 2 )
ydiff = ( p1.y() - w->height() / 2 ) / w->height() * 100; ydiff = ( p1.y() - w->height() / 2 ) / w->height() * 100;
float modif = windows[ w ] * windows[ w ] * 64; double modif = windows[ w ] * windows[ w ] * 64;
srandom( cnt ); // change direction randomly but consistently srandom( cnt ); // change direction randomly but consistently
xdiff += ( rand() % 21 - 10 ); xdiff += ( rand() % 21 - 10 );
ydiff += ( rand() % 21 - 10 ); ydiff += ( rand() % 21 - 10 );
@ -80,16 +80,16 @@ void FallApartEffect::paintWindow( EffectWindow* w, int mask, QRegion region, Wi
// also make the fragments rotate around their center // also make the fragments rotate around their center
QPointF center(( quad[ 0 ].x() + quad[ 1 ].x() + quad[ 2 ].x() + quad[ 3 ].x()) / 4, QPointF center(( quad[ 0 ].x() + quad[ 1 ].x() + quad[ 2 ].x() + quad[ 3 ].x()) / 4,
( quad[ 0 ].y() + quad[ 1 ].y() + quad[ 2 ].y() + quad[ 3 ].y()) / 4 ); ( quad[ 0 ].y() + quad[ 1 ].y() + quad[ 2 ].y() + quad[ 3 ].y()) / 4 );
float adiff = ( rand() % 720 - 360 ) / 360. * 2 * M_PI; // spin randomly double adiff = ( rand() % 720 - 360 ) / 360. * 2 * M_PI; // spin randomly
for( int j = 0; for( int j = 0;
j < 4; j < 4;
++j ) ++j )
{ {
float x = quad[ j ].x() - center.x(); double x = quad[ j ].x() - center.x();
float y = quad[ j ].y() - center.y(); double y = quad[ j ].y() - center.y();
float angle = atan2( y, x ); double angle = atan2( y, x );
angle += windows[ w ] * adiff; angle += windows[ w ] * adiff;
float dist = sqrt( x * x + y * y ); double dist = sqrt( x * x + y * y );
x = dist * cos( angle ); x = dist * cos( angle );
y = dist * sin( angle ); y = dist * sin( angle );
quad[ j ].move( center.x() + x, center.y() + y ); quad[ j ].move( center.x() + x, center.y() + y );

View File

@ -27,7 +27,7 @@ class FallApartEffect
virtual void windowClosed( EffectWindow* c ); virtual void windowClosed( EffectWindow* c );
virtual void windowDeleted( EffectWindow* c ); virtual void windowDeleted( EffectWindow* c );
private: private:
QHash< const EffectWindow*, float > windows; QHash< const EffectWindow*, double > windows;
}; };
} // namespace } // namespace

View File

@ -50,7 +50,7 @@ void FlameEffect::paintWindow( EffectWindow* w, int mask, QRegion region, Window
if( windows.contains( w )) if( windows.contains( w ))
{ {
WindowQuadList new_quads; WindowQuadList new_quads;
float ylimit = windows[ w ] * w->height(); // parts above this are already away double ylimit = windows[ w ] * w->height(); // parts above this are already away
foreach( WindowQuad quad, data.quads ) foreach( WindowQuad quad, data.quads )
{ {
if( quad.bottom() <= ylimit ) if( quad.bottom() <= ylimit )

View File

@ -27,7 +27,7 @@ class FlameEffect
virtual void windowClosed( EffectWindow* c ); virtual void windowClosed( EffectWindow* c );
virtual void windowDeleted( EffectWindow* c ); virtual void windowDeleted( EffectWindow* c );
private: private:
QHash< const EffectWindow*, float > windows; QHash< const EffectWindow*, double > windows;
}; };
} // namespace } // namespace

View File

@ -53,7 +53,7 @@ void LookingGlassEffect::toggle()
void LookingGlassEffect::zoomIn() void LookingGlassEffect::zoomIn()
{ {
target_zoom = qMin(7.0f, target_zoom + 0.5f); target_zoom = qMin(7.0, target_zoom + 0.5);
setEnabled( true ); setEnabled( true );
effects->addRepaint( cursorPos().x() - radius, cursorPos().y() - radius, 2*radius, 2*radius ); effects->addRepaint( cursorPos().x() - radius, cursorPos().y() - radius, 2*radius, 2*radius );
} }
@ -73,18 +73,18 @@ void LookingGlassEffect::prePaintScreen( ScreenPrePaintData& data, int time )
{ {
if( zoom != target_zoom ) if( zoom != target_zoom )
{ {
float diff = time / 500.0f; double diff = time / 500.0;
if( target_zoom > zoom ) if( target_zoom > zoom )
zoom = qMin( zoom * qMax( 1.0f + diff, 1.2f ), target_zoom ); zoom = qMin( zoom * qMax( 1.0 + diff, 1.2 ), target_zoom );
else else
zoom = qMax( zoom * qMin( 1.0f - diff, 0.8f ), target_zoom ); zoom = qMax( zoom * qMin( 1.0 - diff, 0.8 ), target_zoom );
kDebug() << "zoom is now " << zoom; kDebug() << "zoom is now " << zoom;
radius = qBound(200.0f, 200.0f * zoom, 500.0f); radius = qBound(200.0, 200.0 * zoom, 500.0);
if( zoom > 1.0f ) if( zoom > 1.0f )
{ {
shader()->bind(); shader()->bind();
shader()->setUniform("zoom", zoom); shader()->setUniform("zoom", (float)zoom);
shader()->setUniform("radius", (float)radius); shader()->setUniform("radius", (float)radius);
shader()->unbind(); shader()->unbind();
} }

View File

@ -36,8 +36,8 @@ class LookingGlassEffect : public QObject, public ShaderEffect
void zoomOut(); void zoomOut();
private: private:
float zoom; double zoom;
float target_zoom; double target_zoom;
int radius; int radius;
}; };

View File

@ -46,11 +46,11 @@ void MagnifierEffect::prePaintScreen( ScreenPrePaintData& data, int time )
{ {
if( zoom != target_zoom ) if( zoom != target_zoom )
{ {
float diff = time / 500.0; double diff = time / 500.0;
if( target_zoom > zoom ) if( target_zoom > zoom )
zoom = qMin( zoom * qMax( 1 + diff, 1.2f ), target_zoom ); zoom = qMin( zoom * qMax( 1 + diff, 1.2 ), target_zoom );
else else
zoom = qMax( zoom * qMin( 1 - diff, 0.8f ), target_zoom ); zoom = qMax( zoom * qMin( 1 - diff, 0.8 ), target_zoom );
} }
effects->prePaintScreen( data, time ); effects->prePaintScreen( data, time );
if( zoom != 1.0 ) if( zoom != 1.0 )

View File

@ -33,8 +33,8 @@ class MagnifierEffect
void toggle(); void toggle();
private: private:
QRect magnifierArea( QPoint pos = cursorPos()) const; QRect magnifierArea( QPoint pos = cursorPos()) const;
float zoom; double zoom;
float target_zoom; double target_zoom;
QSize magnifier_size; QSize magnifier_size;
}; };

View File

@ -25,9 +25,9 @@ class MakeTransparentEffect
virtual void prePaintWindow( EffectWindow* w, WindowPrePaintData& data, int time ); virtual void prePaintWindow( EffectWindow* w, WindowPrePaintData& data, int time );
virtual void paintWindow( EffectWindow* w, int mask, QRegion region, WindowPaintData& data ); virtual void paintWindow( EffectWindow* w, int mask, QRegion region, WindowPaintData& data );
private: private:
float decoration; double decoration;
float moveresize; double moveresize;
float dialogs; double dialogs;
}; };
} // namespace } // namespace

View File

@ -34,7 +34,7 @@ void MinimizeAnimationEffect::prePaintScreen( ScreenPrePaintData& data, int time
void MinimizeAnimationEffect::prePaintWindow( EffectWindow* w, WindowPrePaintData& data, int time ) void MinimizeAnimationEffect::prePaintWindow( EffectWindow* w, WindowPrePaintData& data, int time )
{ {
const float changeTime = 500; const double changeTime = 500;
if( mAnimationProgress.contains( w )) if( mAnimationProgress.contains( w ))
{ {
if( w->isMinimized() ) if( w->isMinimized() )
@ -71,7 +71,7 @@ void MinimizeAnimationEffect::paintWindow( EffectWindow* w, int mask, QRegion re
if( mAnimationProgress.contains( w )) if( mAnimationProgress.contains( w ))
{ {
// 0 = not minimized, 1 = fully minimized // 0 = not minimized, 1 = fully minimized
float progress = mAnimationProgress[w]; double progress = mAnimationProgress[w];
QRect geo = w->geometry(); QRect geo = w->geometry();
QRect icon = w->iconGeometry(); QRect icon = w->iconGeometry();
@ -79,8 +79,8 @@ void MinimizeAnimationEffect::paintWindow( EffectWindow* w, int mask, QRegion re
if( !icon.isValid() ) if( !icon.isValid() )
icon = QRect( displayWidth() / 2, displayHeight() / 2, 0, 0 ); icon = QRect( displayWidth() / 2, displayHeight() / 2, 0, 0 );
data.xScale *= interpolate(1.0, icon.width() / (float)geo.width(), progress); data.xScale *= interpolate(1.0, icon.width() / (double)geo.width(), progress);
data.yScale *= interpolate(1.0, icon.height() / (float)geo.height(), progress); data.yScale *= interpolate(1.0, icon.height() / (double)geo.height(), progress);
data.xTranslate = (int)interpolate(data.xTranslate, icon.x() - geo.x(), progress); data.xTranslate = (int)interpolate(data.xTranslate, icon.x() - geo.x(), progress);
data.yTranslate = (int)interpolate(data.yTranslate, icon.y() - geo.y(), progress); data.yTranslate = (int)interpolate(data.yTranslate, icon.y() - geo.y(), progress);
} }

View File

@ -36,7 +36,7 @@ class MinimizeAnimationEffect
virtual void windowUnminimized( EffectWindow* c ); virtual void windowUnminimized( EffectWindow* c );
private: private:
QHash< EffectWindow*, float > mAnimationProgress; QHash< EffectWindow*, double > mAnimationProgress;
int mActiveAnimations; int mActiveAnimations;
}; };

View File

@ -73,17 +73,17 @@ PresentWindowsEffect::~PresentWindowsEffect()
void PresentWindowsEffect::prePaintScreen( ScreenPrePaintData& data, int time ) void PresentWindowsEffect::prePaintScreen( ScreenPrePaintData& data, int time )
{ {
// How long does it take for the effect to get it's full strength (in ms) // How long does it take for the effect to get it's full strength (in ms)
const float changeTime = 300; const double changeTime = 300;
if(mActivated) if(mActivated)
{ {
mActiveness = qMin(1.0f, mActiveness + time/changeTime); mActiveness = qMin(1.0, mActiveness + time/changeTime);
if( mRearranging < 1 ) if( mRearranging < 1 )
mRearranging = qMin(1.0f, mRearranging + time/changeTime); mRearranging = qMin(1.0, mRearranging + time/changeTime);
} }
else if(mActiveness > 0.0f) else if(mActiveness > 0.0)
{ {
mActiveness = qMax(0.0f, mActiveness - time/changeTime); mActiveness = qMax(0.0, mActiveness - time/changeTime);
if(mActiveness <= 0.0f) if(mActiveness <= 0.0)
effectTerminated(); effectTerminated();
} }
@ -111,11 +111,11 @@ void PresentWindowsEffect::prePaintWindow( EffectWindow* w, WindowPrePaintData&
data.setTranslucent(); data.setTranslucent();
// Change window's hover according to cursor pos // Change window's hover according to cursor pos
WindowData& windata = mWindowData[w]; WindowData& windata = mWindowData[w];
const float hoverchangetime = 200; const double hoverchangetime = 200;
if( windata.area.contains(cursorPos()) ) if( windata.area.contains(cursorPos()) )
windata.hover = qMin(1.0f, windata.hover + time / hoverchangetime); windata.hover = qMin(1.0, windata.hover + time / hoverchangetime);
else else
windata.hover = qMax(0.0f, windata.hover - time / hoverchangetime); windata.hover = qMax(0.0, windata.hover - time / hoverchangetime);
} }
else if( !w->isDesktop()) else if( !w->isDesktop())
w->disablePainting( EffectWindow::PAINT_DISABLED ); w->disablePainting( EffectWindow::PAINT_DISABLED );
@ -195,10 +195,10 @@ void PresentWindowsEffect::paintWindow( EffectWindow* w, int mask, QRegion regio
paintWindowIcon( w, data ); paintWindowIcon( w, data );
QString text = w->caption(); QString text = w->caption();
float centerx = w->x() + data.xTranslate + w->width() * data.xScale * 0.5f; double centerx = w->x() + data.xTranslate + w->width() * data.xScale * 0.5f;
float centery = w->y() + data.yTranslate + w->height() * data.yScale * 0.5f; double centery = w->y() + data.yTranslate + w->height() * data.yScale * 0.5f;
int maxwidth = (int)(w->width() * data.xScale - 20); int maxwidth = (int)(w->width() * data.xScale - 20);
float opacity = (0.7 + 0.2*windata.hover) * data.opacity; double opacity = (0.7 + 0.2*windata.hover) * data.opacity;
QColor textcolor( 255, 255, 255, (int)(255*opacity) ); QColor textcolor( 255, 255, 255, (int)(255*opacity) );
QColor bgcolor( 0, 0, 0, (int)(255*opacity) ); QColor bgcolor( 0, 0, 0, (int)(255*opacity) );
QFont f; QFont f;
@ -421,7 +421,7 @@ void PresentWindowsEffect::calculateWindowTransformationsDumb(EffectWindowList w
int r = i / cols; int r = i / cols;
int c = i % cols; int c = i % cols;
mWindowData[window].hover = 0.0f; mWindowData[window].hover = 0.0f;
mWindowData[window].scale = qMin(cellwidth / (float)window->width(), cellheight / (float)window->height()); mWindowData[window].scale = qMin(cellwidth / (double)window->width(), cellheight / (double)window->height());
mWindowData[window].area.setLeft(placementRect.left() + cellwidth * c); mWindowData[window].area.setLeft(placementRect.left() + cellwidth * c);
mWindowData[window].area.setTop(placementRect.top() + cellheight * r); mWindowData[window].area.setTop(placementRect.top() + cellheight * r);
mWindowData[window].area.setWidth((int)(window->width() * mWindowData[window].scale)); mWindowData[window].area.setWidth((int)(window->width() * mWindowData[window].scale));
@ -434,19 +434,19 @@ void PresentWindowsEffect::calculateWindowTransformationsDumb(EffectWindowList w
} }
} }
float PresentWindowsEffect::windowAspectRatio(EffectWindow* c) double PresentWindowsEffect::windowAspectRatio(EffectWindow* c)
{ {
return c->width() / (float)c->height(); return c->width() / (double)c->height();
} }
int PresentWindowsEffect::windowWidthForHeight(EffectWindow* c, int h) int PresentWindowsEffect::windowWidthForHeight(EffectWindow* c, int h)
{ {
return (int)((h / (float)c->height()) * c->width()); return (int)((h / (double)c->height()) * c->width());
} }
int PresentWindowsEffect::windowHeightForWidth(EffectWindow* c, int w) int PresentWindowsEffect::windowHeightForWidth(EffectWindow* c, int w)
{ {
return (int)((w / (float)c->width()) * c->height()); return (int)((w / (double)c->width()) * c->height());
} }
void PresentWindowsEffect::calculateWindowTransformationsKompose(EffectWindowList windowlist) void PresentWindowsEffect::calculateWindowTransformationsKompose(EffectWindowList windowlist)
@ -458,17 +458,17 @@ void PresentWindowsEffect::calculateWindowTransformationsKompose(EffectWindowLis
int spacing = 10; int spacing = 10;
int rows, columns; int rows, columns;
float parentRatio = availRect.width() / (float)availRect.height(); double parentRatio = availRect.width() / (double)availRect.height();
// Use more columns than rows when parent's width > parent's height // Use more columns than rows when parent's width > parent's height
if ( parentRatio > 1 ) if ( parentRatio > 1 )
{ {
columns = (int)ceil( sqrt(windowlist.count()) ); columns = (int)ceil( sqrt(windowlist.count()) );
rows = (int)ceil( (float)windowlist.count() / (float)columns ); rows = (int)ceil( (double)windowlist.count() / (double)columns );
} }
else else
{ {
rows = (int)ceil( sqrt(windowlist.count()) ); rows = (int)ceil( sqrt(windowlist.count()) );
columns = (int)ceil( (float)windowlist.count() / (float)rows ); columns = (int)ceil( (double)windowlist.count() / (double)rows );
} }
kDebug() << "Using " << rows << " rows & " << columns << " columns for " << windowlist.count() << " clients"; kDebug() << "Using " << rows << " rows & " << columns << " columns for " << windowlist.count() << " clients";
@ -495,7 +495,7 @@ void PresentWindowsEffect::calculateWindowTransformationsKompose(EffectWindowLis
window = *it; window = *it;
// Calculate width and height of widget // Calculate width and height of widget
float ratio = windowAspectRatio(window); double ratio = windowAspectRatio(window);
int widgetw = 100; int widgetw = 100;
int widgeth = 100; int widgeth = 100;
@ -525,8 +525,8 @@ void PresentWindowsEffect::calculateWindowTransformationsKompose(EffectWindowLis
} }
else else
{ {
float widthForHeight = windowWidthForHeight(window, usableH); double widthForHeight = windowWidthForHeight(window, usableH);
float heightForWidth = windowHeightForWidth(window, usableW); double heightForWidth = windowHeightForWidth(window, usableW);
if ( (ratio >= 1.0 && heightForWidth <= usableH) || if ( (ratio >= 1.0 && heightForWidth <= usableH) ||
(ratio < 1.0 && widthForHeight > usableW) ) (ratio < 1.0 && widthForHeight > usableW) )
{ {
@ -576,7 +576,7 @@ void PresentWindowsEffect::calculateWindowTransformationsKompose(EffectWindowLis
QRect geom = geometryRects[pos]; QRect geom = geometryRects[pos];
geom.setY( geom.y() + topOffset ); geom.setY( geom.y() + topOffset );
mWindowData[window].area = geom; mWindowData[window].area = geom;
mWindowData[window].scale = geom.width() / (float)window->width(); mWindowData[window].scale = geom.width() / (double)window->width();
mWindowData[window].hover = 0.0f; mWindowData[window].hover = 0.0f;
kDebug() << "Window '" << window->caption() << "' gets moved to (" << kDebug() << "Window '" << window->caption() << "' gets moved to (" <<
@ -592,7 +592,7 @@ void PresentWindowsEffect::calculateWindowTransformationsClosest(EffectWindowLis
{ {
QRect area = effects->clientArea( PlacementArea, QPoint( 0, 0 ), effects->currentDesktop()); QRect area = effects->clientArea( PlacementArea, QPoint( 0, 0 ), effects->currentDesktop());
int columns = int( ceil( sqrt( windowlist.count()))); int columns = int( ceil( sqrt( windowlist.count())));
int rows = int( ceil( windowlist.count() / float( columns ))); int rows = int( ceil( windowlist.count() / double( columns )));
foreach( EffectWindow* w, windowlist ) foreach( EffectWindow* w, windowlist )
mWindowData[ w ].slot = -1; mWindowData[ w ].slot = -1;
for(;;) for(;;)
@ -621,17 +621,17 @@ void PresentWindowsEffect::calculateWindowTransformationsClosest(EffectWindowLis
area.y() + ((*it).slot / columns ) * slotheight, area.y() + ((*it).slot / columns ) * slotheight,
slotwidth, slotheight ); slotwidth, slotheight );
geom.adjust( 10, 10, -10, -10 ); // borders geom.adjust( 10, 10, -10, -10 ); // borders
float scale; double scale;
EffectWindow* w = it.key(); EffectWindow* w = it.key();
if( geom.width() / float( w->width()) < geom.height() / float( w->height())) if( geom.width() / double( w->width()) < geom.height() / double( w->height()))
{ // center vertically { // center vertically
scale = geom.width() / float( w->width()); scale = geom.width() / double( w->width());
geom.moveTop( geom.top() + ( geom.height() - int( w->height() * scale )) / 2 ); geom.moveTop( geom.top() + ( geom.height() - int( w->height() * scale )) / 2 );
geom.setHeight( int( w->height() * scale )); geom.setHeight( int( w->height() * scale ));
} }
else else
{ // center horizontally { // center horizontally
scale = geom.height() / float( w->height()); scale = geom.height() / double( w->height());
geom.moveLeft( geom.left() + ( geom.width() - int( w->width() * scale )) / 2 ); geom.moveLeft( geom.left() + ( geom.width() - int( w->width() * scale )) / 2 );
geom.setWidth( int( w->width() * scale )); geom.setWidth( int( w->width() * scale ));
} }
@ -713,9 +713,9 @@ bool PresentWindowsEffect::canRearrangeClosest(EffectWindowList windowlist)
{ {
QRect area = effects->clientArea( PlacementArea, QPoint( 0, 0 ), effects->currentDesktop()); QRect area = effects->clientArea( PlacementArea, QPoint( 0, 0 ), effects->currentDesktop());
int columns = int( ceil( sqrt( windowlist.count()))); int columns = int( ceil( sqrt( windowlist.count())));
int rows = int( ceil( windowlist.count() / float( columns ))); int rows = int( ceil( windowlist.count() / double( columns )));
int old_columns = int( ceil( sqrt( mWindowData.count()))); int old_columns = int( ceil( sqrt( mWindowData.count())));
int old_rows = int( ceil( mWindowData.count() / float( columns ))); int old_rows = int( ceil( mWindowData.count() / double( columns )));
return old_columns != columns || old_rows != rows; return old_columns != columns || old_rows != rows;
} }

View File

@ -61,7 +61,7 @@ class PresentWindowsEffect
bool canRearrangeClosest(EffectWindowList windowlist); bool canRearrangeClosest(EffectWindowList windowlist);
// Helper methods for layout calculation // Helper methods for layout calculation
float windowAspectRatio(EffectWindow* c); double windowAspectRatio(EffectWindow* c);
int windowWidthForHeight(EffectWindow* c, int h); int windowWidthForHeight(EffectWindow* c, int h);
int windowHeightForWidth(EffectWindow* c, int w); int windowHeightForWidth(EffectWindow* c, int w);
@ -84,9 +84,9 @@ class PresentWindowsEffect
// Whether the effect is currently activated by the user // Whether the effect is currently activated by the user
bool mActivated; bool mActivated;
// 0 = not active, 1 = fully active // 0 = not active, 1 = fully active
float mActiveness; double mActiveness;
// 0 = start of rearranging (old_area), 1 = done // 0 = start of rearranging (old_area), 1 = done
float mRearranging; double mRearranging;
Window mInput; Window mInput;
bool hasKeyboardGrab; bool hasKeyboardGrab;
@ -96,9 +96,9 @@ class PresentWindowsEffect
{ {
QRect area; QRect area;
QRect old_area; // when rearranging, otherwise unset QRect old_area; // when rearranging, otherwise unset
float scale; double scale;
float old_scale; // when rearranging, otherwise unset double old_scale; // when rearranging, otherwise unset
float hover; double hover;
int slot; int slot;
int slot_distance; int slot_distance;
QPixmap icon; QPixmap icon;

View File

@ -28,7 +28,7 @@ class ScaleInEffect
virtual void windowAdded( EffectWindow* c ); virtual void windowAdded( EffectWindow* c );
virtual void windowClosed( EffectWindow* c ); virtual void windowClosed( EffectWindow* c );
private: private:
QHash< const EffectWindow*, float > windows; QHash< const EffectWindow*, double > windows;
}; };
} // namespace } // namespace

View File

@ -25,7 +25,7 @@ ShadowEffect::ShadowEffect()
KConfigGroup conf = effects->effectConfig("Shadow"); KConfigGroup conf = effects->effectConfig("Shadow");
shadowXOffset = conf.readEntry( "XOffset", 10 ); shadowXOffset = conf.readEntry( "XOffset", 10 );
shadowYOffset = conf.readEntry( "YOffset", 10 ); shadowYOffset = conf.readEntry( "YOffset", 10 );
shadowOpacity = (float)conf.readEntry( "Opacity", 0.2 ); shadowOpacity = conf.readEntry( "Opacity", 0.2 );
shadowFuzzyness = conf.readEntry( "Fuzzyness", 10 ); shadowFuzzyness = conf.readEntry( "Fuzzyness", 10 );
QString shadowtexture = KGlobal::dirs()->findResource("data", "kwin/shadow-texture.png"); QString shadowtexture = KGlobal::dirs()->findResource("data", "kwin/shadow-texture.png");
@ -125,7 +125,7 @@ void ShadowEffect::drawShadow( EffectWindow* window, int mask, QRegion region, W
mShadowTexture->bind(); mShadowTexture->bind();
// Take the transparency settings and window's transparency into account. // Take the transparency settings and window's transparency into account.
// Also make the shadow more transparent if we've made it bigger // Also make the shadow more transparent if we've made it bigger
glColor4f(0, 0, 0, shadowOpacity * data.opacity * (window->width() / (float)w) * (window->height() / (float)h)); glColor4f(0, 0, 0, shadowOpacity * data.opacity * (window->width() / (double)w) * (window->height() / (double)h));
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
// We have two elements per vertex in the verts array // We have two elements per vertex in the verts array
int verticesCount = verts.count() / 2; int verticesCount = verts.count() / 2;

View File

@ -35,7 +35,7 @@ class ShadowEffect
QRect shadowRectangle(const QRect& windowRectangle) const; QRect shadowRectangle(const QRect& windowRectangle) const;
int shadowXOffset, shadowYOffset; int shadowXOffset, shadowYOffset;
float shadowOpacity; double shadowOpacity;
int shadowFuzzyness; int shadowFuzzyness;
GLTexture* mShadowTexture; GLTexture* mShadowTexture;
}; };

View File

@ -36,7 +36,7 @@ class ShowFpsEffect
enum { MAX_FPS = 200 }; enum { MAX_FPS = 200 };
int frames[ MAX_FPS ]; // (sec*1000+msec) of the time the frame was done int frames[ MAX_FPS ]; // (sec*1000+msec) of the time the frame was done
int frames_pos; // position in the queue int frames_pos; // position in the queue
float alpha; double alpha;
int x; int x;
int y; int y;
}; };

View File

@ -41,7 +41,7 @@ class TestFBOEffect : public Effect
GLRenderTarget* mRenderTarget; GLRenderTarget* mRenderTarget;
bool mValid; bool mValid;
float mRot; double mRot;
}; };
} // namespace } // namespace

View File

@ -127,8 +127,8 @@ void ThumbnailAsideEffect::arrange()
pos[ d.index ] = d.window->height(); pos[ d.index ] = d.window->height();
} }
QRect area = effects->clientArea( WorkArea, QPoint(), effects->currentDesktop()); QRect area = effects->clientArea( WorkArea, QPoint(), effects->currentDesktop());
float scale = area.height() / float( height ); double scale = area.height() / double( height );
scale = qMin( scale, maxwidth / float( mwidth )); // don't be wider than maxwidth pixels scale = qMin( scale, maxwidth / double( mwidth )); // don't be wider than maxwidth pixels
int add = 0; int add = 0;
for( int i = 0; for( int i = 0;
i < windows.size(); i < windows.size();

View File

@ -51,7 +51,7 @@ class ThumbnailAsideEffect
QHash< EffectWindow*, Data > windows; QHash< EffectWindow*, Data > windows;
int maxwidth; int maxwidth;
int spacing; int spacing;
float opacity; double opacity;
}; };
} // namespace } // namespace

View File

@ -37,11 +37,11 @@ void ZoomEffect::prePaintScreen( ScreenPrePaintData& data, int time )
{ {
if( zoom != target_zoom ) if( zoom != target_zoom )
{ {
float diff = time / 500.0; double diff = time / 500.0;
if( target_zoom > zoom ) if( target_zoom > zoom )
zoom = qMin( zoom * qMax( 1 + diff, 1.2f ), target_zoom ); zoom = qMin( zoom * qMax( 1 + diff, 1.2 ), target_zoom );
else else
zoom = qMax( zoom * qMin( 1 - diff, 0.8f ), target_zoom ); zoom = qMax( zoom * qMin( 1 - diff, 0.8 ), target_zoom );
} }
if( zoom != 1.0 ) if( zoom != 1.0 )
data.mask |= PAINT_SCREEN_TRANSFORMED; data.mask |= PAINT_SCREEN_TRANSFORMED;

View File

@ -32,8 +32,8 @@ class ZoomEffect
void zoomOut(); void zoomOut();
void actualSize(); void actualSize();
private: private:
float zoom; double zoom;
float target_zoom; double target_zoom;
}; };
} // namespace } // namespace

View File

@ -84,7 +84,7 @@ void Effect::windowUserMovedResized( EffectWindow* , bool, bool )
{ {
} }
void Effect::windowOpacityChanged( EffectWindow*, float ) void Effect::windowOpacityChanged( EffectWindow*, double )
{ {
} }
@ -197,8 +197,8 @@ void Effect::setPositionTransformations( WindowPaintData& data, QRect& region, E
{ {
QSize size = w->size(); QSize size = w->size();
size.scale( r.size(), aspect ); size.scale( r.size(), aspect );
data.xScale = size.width() / float( w->width()); data.xScale = size.width() / double( w->width());
data.yScale = size.height() / float( w->height()); data.yScale = size.height() / double( w->height());
int width = int( w->width() * data.xScale ); int width = int( w->width() * data.xScale );
int height = int( w->height() * data.yScale ); int height = int( w->height() * data.yScale );
int x = r.x() + ( r.width() - width ) / 2; int x = r.x() + ( r.width() - width ) / 2;
@ -425,7 +425,7 @@ EffectWindowGroup::~EffectWindowGroup()
WindowQuad WindowQuad
***************************************************************/ ***************************************************************/
WindowQuad WindowQuad::makeSubQuad( float x1, float y1, float x2, float y2 ) const WindowQuad WindowQuad::makeSubQuad( double x1, double y1, double x2, double y2 ) const
{ {
assert( x1 < x2 && y1 < y2 && x1 >= left() && x2 <= right() && y1 >= top() && y2 <= bottom()); assert( x1 < x2 && y1 < y2 && x1 >= left() && x2 <= right() && y1 >= top() && y2 <= bottom());
#ifndef NDEBUG #ifndef NDEBUG
@ -451,14 +451,14 @@ WindowQuad WindowQuad::makeSubQuad( float x1, float y1, float x2, float y2 ) con
ret.verts[ 1 ].oy = y1; ret.verts[ 1 ].oy = y1;
ret.verts[ 2 ].oy = y2; ret.verts[ 2 ].oy = y2;
ret.verts[ 3 ].oy = y2; ret.verts[ 3 ].oy = y2;
float my_tleft = verts[ 0 ].tx; double my_tleft = verts[ 0 ].tx;
float my_tright = verts[ 2 ].tx; double my_tright = verts[ 2 ].tx;
float my_ttop = verts[ 0 ].ty; double my_ttop = verts[ 0 ].ty;
float my_tbottom = verts[ 2 ].ty; double my_tbottom = verts[ 2 ].ty;
float tleft = ( x1 - left()) / ( right() - left()) * ( my_tright - my_tleft ) + my_tleft; double tleft = ( x1 - left()) / ( right() - left()) * ( my_tright - my_tleft ) + my_tleft;
float tright = ( x2 - left()) / ( right() - left()) * ( my_tright - my_tleft ) + my_tleft; double tright = ( x2 - left()) / ( right() - left()) * ( my_tright - my_tleft ) + my_tleft;
float ttop = ( y1 - top()) / ( bottom() - top()) * ( my_tbottom - my_ttop ) + my_ttop; double ttop = ( y1 - top()) / ( bottom() - top()) * ( my_tbottom - my_ttop ) + my_ttop;
float tbottom = ( y2 - top()) / ( bottom() - top()) * ( my_tbottom - my_ttop ) + my_ttop; double tbottom = ( y2 - top()) / ( bottom() - top()) * ( my_tbottom - my_ttop ) + my_ttop;
ret.verts[ 0 ].tx = tleft; ret.verts[ 0 ].tx = tleft;
ret.verts[ 3 ].tx = tleft; ret.verts[ 3 ].tx = tleft;
ret.verts[ 1 ].tx = tright; ret.verts[ 1 ].tx = tright;
@ -473,8 +473,8 @@ WindowQuad WindowQuad::makeSubQuad( float x1, float y1, float x2, float y2 ) con
bool WindowQuad::smoothNeeded() const bool WindowQuad::smoothNeeded() const
{ {
// smoothing is needed if the width or height of the quad does not match the original size // smoothing is needed if the width or height of the quad does not match the original size
float width = verts[ 1 ].ox - verts[ 0 ].ox; double width = verts[ 1 ].ox - verts[ 0 ].ox;
float height = verts[ 2 ].oy - verts[ 1 ].oy; double height = verts[ 2 ].oy - verts[ 1 ].oy;
return( verts[ 1 ].px - verts[ 0 ].px != width || verts[ 2 ].px - verts[ 3 ].px != width return( verts[ 1 ].px - verts[ 0 ].px != width || verts[ 2 ].px - verts[ 3 ].px != width
|| verts[ 2 ].py - verts[ 1 ].py != height || verts[ 3 ].py - verts[ 0 ].py != height ); || verts[ 2 ].py - verts[ 1 ].py != height || verts[ 3 ].py - verts[ 0 ].py != height );
} }
@ -483,7 +483,7 @@ bool WindowQuad::smoothNeeded() const
WindowQuadList WindowQuadList
***************************************************************/ ***************************************************************/
WindowQuadList WindowQuadList::splitAtX( float x ) const WindowQuadList WindowQuadList::splitAtX( double x ) const
{ {
WindowQuadList ret; WindowQuadList ret;
foreach( WindowQuad quad, *this ) foreach( WindowQuad quad, *this )
@ -514,7 +514,7 @@ WindowQuadList WindowQuadList::splitAtX( float x ) const
return ret; return ret;
} }
WindowQuadList WindowQuadList::splitAtY( float y ) const WindowQuadList WindowQuadList::splitAtY( double y ) const
{ {
WindowQuadList ret; WindowQuadList ret;
foreach( WindowQuad quad, *this ) foreach( WindowQuad quad, *this )
@ -550,10 +550,10 @@ WindowQuadList WindowQuadList::makeGrid( int maxquadsize ) const
if( empty()) if( empty())
return *this; return *this;
// find the bounding rectangle // find the bounding rectangle
float left = first().left(); double left = first().left();
float right = first().right(); double right = first().right();
float top = first().top(); double top = first().top();
float bottom = first().bottom(); double bottom = first().bottom();
foreach( WindowQuad quad, *this ) foreach( WindowQuad quad, *this )
{ {
#ifndef NDEBUG #ifndef NDEBUG
@ -566,11 +566,11 @@ WindowQuadList WindowQuadList::makeGrid( int maxquadsize ) const
bottom = qMax( bottom, quad.bottom()); bottom = qMax( bottom, quad.bottom());
} }
WindowQuadList ret; WindowQuadList ret;
for( float x = left; for( double x = left;
x < right; x < right;
x += maxquadsize ) x += maxquadsize )
{ {
for( float y = top; for( double y = top;
y < bottom; y < bottom;
y += maxquadsize ) y += maxquadsize )
{ {

View File

@ -97,7 +97,7 @@ class KWIN_EXPORT Effect
// called when moved/resized or once after it's finished // called when moved/resized or once after it's finished
virtual void windowUserMovedResized( EffectWindow* c, bool first, bool last ); virtual void windowUserMovedResized( EffectWindow* c, bool first, bool last );
virtual void windowOpacityChanged( EffectWindow* c, float old_opacity ); virtual void windowOpacityChanged( EffectWindow* c, double old_opacity );
virtual void windowAdded( EffectWindow* c ); virtual void windowAdded( EffectWindow* c );
virtual void windowClosed( EffectWindow* c ); virtual void windowClosed( EffectWindow* c );
virtual void windowDeleted( EffectWindow* c ); virtual void windowDeleted( EffectWindow* c );
@ -122,7 +122,7 @@ class KWIN_EXPORT Effect
static QPoint cursorPos(); static QPoint cursorPos();
// Interpolates between x and y // Interpolates between x and y
static float interpolate(float x, float y, float a) static double interpolate(double x, double y, double a)
{ {
return x * (1 - a) + y * a; return x * (1 - a) + y * a;
} }
@ -309,7 +309,7 @@ class KWIN_EXPORT EffectWindow
virtual bool isDeleted() const = 0; virtual bool isDeleted() const = 0;
virtual bool isMinimized() const = 0; virtual bool isMinimized() const = 0;
virtual float opacity() const = 0; virtual double opacity() const = 0;
virtual bool isOnDesktop( int d ) const; virtual bool isOnDesktop( int d ) const;
virtual bool isOnCurrentDesktop() const; virtual bool isOnCurrentDesktop() const;
@ -379,21 +379,21 @@ class KWIN_EXPORT EffectWindowGroup
class KWIN_EXPORT WindowVertex class KWIN_EXPORT WindowVertex
{ {
public: public:
float x() const; double x() const;
float y() const; double y() const;
void move( float x, float y ); void move( double x, double y );
void setX( float x ); void setX( double x );
void setY( float y ); void setY( double y );
float originalX() const; double originalX() const;
float originalY() const; double originalY() const;
WindowVertex(); WindowVertex();
WindowVertex( float x, float y, float tx, float ty ); WindowVertex( double x, double y, double tx, double ty );
private: private:
friend class WindowQuad; friend class WindowQuad;
friend class WindowQuadList; friend class WindowQuadList;
float px, py; // position double px, py; // position
float ox, oy; // origional position double ox, oy; // origional position
float tx, ty; // texture coords double tx, ty; // texture coords
}; };
enum WindowQuadType enum WindowQuadType
@ -412,18 +412,18 @@ class KWIN_EXPORT WindowQuad
{ {
public: public:
explicit WindowQuad( WindowQuadType type ); explicit WindowQuad( WindowQuadType type );
WindowQuad makeSubQuad( float x1, float y1, float x2, float y2 ) const; WindowQuad makeSubQuad( double x1, double y1, double x2, double y2 ) const;
WindowVertex& operator[]( int index ); WindowVertex& operator[]( int index );
const WindowVertex& operator[]( int index ) const; const WindowVertex& operator[]( int index ) const;
bool decoration() const; bool decoration() const;
float left() const; double left() const;
float right() const; double right() const;
float top() const; double top() const;
float bottom() const; double bottom() const;
float originalLeft() const; double originalLeft() const;
float originalRight() const; double originalRight() const;
float originalTop() const; double originalTop() const;
float originalBottom() const; double originalBottom() const;
bool smoothNeeded() const; bool smoothNeeded() const;
bool isTransformed() const; bool isTransformed() const;
private: private:
@ -436,8 +436,8 @@ class KWIN_EXPORT WindowQuadList
: public QList< WindowQuad > : public QList< WindowQuad >
{ {
public: public:
WindowQuadList splitAtX( float x ) const; WindowQuadList splitAtX( double x ) const;
WindowQuadList splitAtY( float y ) const; WindowQuadList splitAtY( double y ) const;
WindowQuadList makeGrid( int maxquadsize ) const; WindowQuadList makeGrid( int maxquadsize ) const;
WindowQuadList select( WindowQuadType type ) const; WindowQuadList select( WindowQuadType type ) const;
WindowQuadList filterOut( WindowQuadType type ) const; WindowQuadList filterOut( WindowQuadType type ) const;
@ -472,11 +472,11 @@ class KWIN_EXPORT WindowPaintData
* Opacity for contents is opacity*contents_opacity, the same * Opacity for contents is opacity*contents_opacity, the same
* way for decoration. * way for decoration.
*/ */
float opacity; double opacity;
float contents_opacity; double contents_opacity;
float decoration_opacity; double decoration_opacity;
float xScale; double xScale;
float yScale; double yScale;
int xTranslate; int xTranslate;
int yTranslate; int yTranslate;
/** /**
@ -485,13 +485,13 @@ class KWIN_EXPORT WindowPaintData
* unsaturated (greyscale). 0.5 would make the colors less intense, * unsaturated (greyscale). 0.5 would make the colors less intense,
* but not completely grey * but not completely grey
**/ **/
float saturation; double saturation;
/** /**
* Brightness of the window, in range [0; 1] * Brightness of the window, in range [0; 1]
* 1 means that the window is unchanged, 0 means that it's completely * 1 means that the window is unchanged, 0 means that it's completely
* black. 0.5 would make it 50% darker than usual * black. 0.5 would make it 50% darker than usual
**/ **/
float brightness; double brightness;
WindowQuadList quads; WindowQuadList quads;
/** /**
* Shader to be used for rendering, if any. * Shader to be used for rendering, if any.
@ -503,8 +503,8 @@ class KWIN_EXPORT ScreenPaintData
{ {
public: public:
ScreenPaintData(); ScreenPaintData();
float xScale; double xScale;
float yScale; double yScale;
int xTranslate; int xTranslate;
int yTranslate; int yTranslate;
}; };
@ -529,50 +529,50 @@ WindowVertex::WindowVertex()
} }
inline inline
WindowVertex::WindowVertex( float _x, float _y, float _tx, float _ty ) WindowVertex::WindowVertex( double _x, double _y, double _tx, double _ty )
: px( _x ), py( _y ), ox( _x ), oy( _y ), tx( _tx ), ty( _ty ) : px( _x ), py( _y ), ox( _x ), oy( _y ), tx( _tx ), ty( _ty )
{ {
} }
inline inline
float WindowVertex::x() const double WindowVertex::x() const
{ {
return px; return px;
} }
inline inline
float WindowVertex::y() const double WindowVertex::y() const
{ {
return py; return py;
} }
inline inline
float WindowVertex::originalX() const double WindowVertex::originalX() const
{ {
return ox; return ox;
} }
inline inline
float WindowVertex::originalY() const double WindowVertex::originalY() const
{ {
return oy; return oy;
} }
inline inline
void WindowVertex::move( float x, float y ) void WindowVertex::move( double x, double y )
{ {
px = x; px = x;
py = y; py = y;
} }
inline inline
void WindowVertex::setX( float x ) void WindowVertex::setX( double x )
{ {
px = x; px = x;
} }
inline inline
void WindowVertex::setY( float y ) void WindowVertex::setY( double y )
{ {
py = y; py = y;
} }
@ -618,49 +618,49 @@ bool WindowQuad::isTransformed() const
} }
inline inline
float WindowQuad::left() const double WindowQuad::left() const
{ {
return qMin( verts[ 0 ].px, qMin( verts[ 1 ].px, qMin( verts[ 2 ].px, verts[ 3 ].px ))); return qMin( verts[ 0 ].px, qMin( verts[ 1 ].px, qMin( verts[ 2 ].px, verts[ 3 ].px )));
} }
inline inline
float WindowQuad::right() const double WindowQuad::right() const
{ {
return qMax( verts[ 0 ].px, qMax( verts[ 1 ].px, qMax( verts[ 2 ].px, verts[ 3 ].px ))); return qMax( verts[ 0 ].px, qMax( verts[ 1 ].px, qMax( verts[ 2 ].px, verts[ 3 ].px )));
} }
inline inline
float WindowQuad::top() const double WindowQuad::top() const
{ {
return qMin( verts[ 0 ].py, qMin( verts[ 1 ].py, qMin( verts[ 2 ].py, verts[ 3 ].py ))); return qMin( verts[ 0 ].py, qMin( verts[ 1 ].py, qMin( verts[ 2 ].py, verts[ 3 ].py )));
} }
inline inline
float WindowQuad::bottom() const double WindowQuad::bottom() const
{ {
return qMax( verts[ 0 ].py, qMax( verts[ 1 ].py, qMax( verts[ 2 ].py, verts[ 3 ].py ))); return qMax( verts[ 0 ].py, qMax( verts[ 1 ].py, qMax( verts[ 2 ].py, verts[ 3 ].py )));
} }
inline inline
float WindowQuad::originalLeft() const double WindowQuad::originalLeft() const
{ {
return verts[ 0 ].ox; return verts[ 0 ].ox;
} }
inline inline
float WindowQuad::originalRight() const double WindowQuad::originalRight() const
{ {
return verts[ 2 ].ox; return verts[ 2 ].ox;
} }
inline inline
float WindowQuad::originalTop() const double WindowQuad::originalTop() const
{ {
return verts[ 0 ].oy; return verts[ 0 ].oy;
} }
inline inline
float WindowQuad::originalBottom() const double WindowQuad::originalBottom() const
{ {
return verts[ 2 ].oy; return verts[ 2 ].oy;
} }

View File

@ -145,7 +145,7 @@ void ShaderEffect::postPaintScreen()
// Use the shader // Use the shader
mShader->bind(); mShader->bind();
mShader->setUniform("time", mTime); mShader->setUniform("time", (float)mTime);
mShader->setUniform("cursorX", (float)cursorPos().x()); mShader->setUniform("cursorX", (float)cursorPos().x());
mShader->setUniform("cursorY", (float)cursorPos().y()); mShader->setUniform("cursorY", (float)cursorPos().y());

View File

@ -46,7 +46,7 @@ class KWIN_EXPORT ShaderEffect : public Effect
GLShader* mShader; GLShader* mShader;
bool mValid; bool mValid;
float mTime; double mTime;
bool mEnabled; bool mEnabled;
}; };

View File

@ -1177,7 +1177,7 @@ void SceneOpenGL::Window::renderQuads( int mask, const QRegion& region, const Wi
delete[] texcoords; delete[] texcoords;
} }
void SceneOpenGL::Window::prepareStates( float opacity, float brightness, float saturation, GLShader* shader ) void SceneOpenGL::Window::prepareStates( double opacity, double brightness, double saturation, GLShader* shader )
{ {
if(shader) if(shader)
prepareShaderRenderStates( opacity, brightness, saturation, shader ); prepareShaderRenderStates( opacity, brightness, saturation, shader );
@ -1185,7 +1185,7 @@ void SceneOpenGL::Window::prepareStates( float opacity, float brightness, float
prepareRenderStates( opacity, brightness, saturation ); prepareRenderStates( opacity, brightness, saturation );
} }
void SceneOpenGL::Window::prepareShaderRenderStates( float opacity, float brightness, float saturation, GLShader* shader ) void SceneOpenGL::Window::prepareShaderRenderStates( double opacity, double brightness, double saturation, GLShader* shader )
{ {
// setup blending of transparent windows // setup blending of transparent windows
glPushAttrib( GL_ENABLE_BIT ); glPushAttrib( GL_ENABLE_BIT );
@ -1200,7 +1200,7 @@ void SceneOpenGL::Window::prepareShaderRenderStates( float opacity, float bright
shader->setUniform("brightness", (float)brightness); shader->setUniform("brightness", (float)brightness);
} }
void SceneOpenGL::Window::prepareRenderStates( float opacity, float brightness, float saturation ) void SceneOpenGL::Window::prepareRenderStates( double opacity, double brightness, double saturation )
{ {
// setup blending of transparent windows // setup blending of transparent windows
glPushAttrib( GL_ENABLE_BIT ); glPushAttrib( GL_ENABLE_BIT );
@ -1325,7 +1325,7 @@ void SceneOpenGL::Window::prepareRenderStates( float opacity, float brightness,
} }
} }
void SceneOpenGL::Window::restoreStates( float opacity, float brightness, float saturation, GLShader* shader ) void SceneOpenGL::Window::restoreStates( double opacity, double brightness, double saturation, GLShader* shader )
{ {
if(shader) if(shader)
restoreShaderRenderStates( opacity, brightness, saturation, shader ); restoreShaderRenderStates( opacity, brightness, saturation, shader );
@ -1333,7 +1333,7 @@ void SceneOpenGL::Window::restoreStates( float opacity, float brightness, float
restoreRenderStates( opacity, brightness, saturation ); restoreRenderStates( opacity, brightness, saturation );
} }
void SceneOpenGL::Window::restoreShaderRenderStates( float opacity, float brightness, float saturation, GLShader* shader ) void SceneOpenGL::Window::restoreShaderRenderStates( double opacity, double brightness, double saturation, GLShader* shader )
{ {
Q_UNUSED( opacity ); Q_UNUSED( opacity );
Q_UNUSED( brightness ); Q_UNUSED( brightness );
@ -1342,7 +1342,7 @@ void SceneOpenGL::Window::restoreShaderRenderStates( float opacity, float bright
glPopAttrib(); // ENABLE_BIT glPopAttrib(); // ENABLE_BIT
} }
void SceneOpenGL::Window::restoreRenderStates( float opacity, float brightness, float saturation ) void SceneOpenGL::Window::restoreRenderStates( double opacity, double brightness, double saturation )
{ {
if( opacity != 1.0 || saturation != 1.0 || brightness != 1.0f ) if( opacity != 1.0 || saturation != 1.0 || brightness != 1.0f )
{ {

View File

@ -125,12 +125,12 @@ class SceneOpenGL::Window
protected: protected:
void renderQuads( int mask, const QRegion& region, const WindowQuadList& quads ); void renderQuads( int mask, const QRegion& region, const WindowQuadList& quads );
void prepareStates( float opacity, float brightness, float saturation, GLShader* shader ); void prepareStates( double opacity, double brightness, double saturation, GLShader* shader );
void prepareRenderStates( float opacity, float brightness, float saturation ); void prepareRenderStates( double opacity, double brightness, double saturation );
void prepareShaderRenderStates( float opacity, float brightness, float saturation, GLShader* shader ); void prepareShaderRenderStates( double opacity, double brightness, double saturation, GLShader* shader );
void restoreStates( float opacity, float brightness, float saturation, GLShader* shader ); void restoreStates( double opacity, double brightness, double saturation, GLShader* shader );
void restoreRenderStates( float opacity, float brightness, float saturation ); void restoreRenderStates( double opacity, double brightness, double saturation );
void restoreShaderRenderStates( float opacity, float brightness, float saturation, GLShader* shader ); void restoreShaderRenderStates( double opacity, double brightness, double saturation, GLShader* shader );
private: private:
Texture texture; Texture texture;

View File

@ -394,7 +394,7 @@ void SceneXrender::Window::discardAlpha()
} }
// Create XRender picture for the alpha mask. // Create XRender picture for the alpha mask.
Picture SceneXrender::Window::alphaMask( float opacity ) Picture SceneXrender::Window::alphaMask( double opacity )
{ {
if( isOpaque() && opacity == 1.0 ) if( isOpaque() && opacity == 1.0 )
return None; return None;
@ -469,8 +469,8 @@ void SceneXrender::Window::performPaint( int mask, QRegion region, WindowPaintDa
int y = toplevel->y(); int y = toplevel->y();
int width = toplevel->width(); int width = toplevel->width();
int height = toplevel->height(); int height = toplevel->height();
float xscale = 1; double xscale = 1;
float yscale = 1; double yscale = 1;
transformed_shape = shape(); transformed_shape = shape();
if( mask & PAINT_WINDOW_TRANSFORMED ) if( mask & PAINT_WINDOW_TRANSFORMED )
{ {

View File

@ -67,11 +67,11 @@ class SceneXrender::Window
void setTransformedShape( const QRegion& shape ); void setTransformedShape( const QRegion& shape );
private: private:
Picture picture(); Picture picture();
Picture alphaMask( float opacity ); Picture alphaMask( double opacity );
Picture _picture; Picture _picture;
XRenderPictFormat* format; XRenderPictFormat* format;
Picture alpha; Picture alpha;
float alpha_cached_opacity; double alpha_cached_opacity;
QRegion transformed_shape; QRegion transformed_shape;
}; };

View File

@ -294,17 +294,17 @@ void Toplevel::getResourceClass()
} }
} }
float Toplevel::opacity() const double Toplevel::opacity() const
{ {
if( info->opacity() == 0xffffffff ) if( info->opacity() == 0xffffffff )
return 1.0; return 1.0;
return info->opacity() * 1.0 / 0xffffffff; return info->opacity() * 1.0 / 0xffffffff;
} }
void Toplevel::setOpacity( float new_opacity ) void Toplevel::setOpacity( double new_opacity )
{ {
float old_opacity = opacity(); double old_opacity = opacity();
new_opacity = qBound( 0.0f, new_opacity, 1.0f ); new_opacity = qBound( 0.0, new_opacity, 1.0 );
if( old_opacity == new_opacity ) if( old_opacity == new_opacity )
return; return;
info->setOpacity( static_cast< unsigned long >( new_opacity * 0xffffffff )); info->setOpacity( static_cast< unsigned long >( new_opacity * 0xffffffff ));

View File

@ -90,8 +90,8 @@ class Toplevel
bool readyForPainting() const; // true if the window has been already painted its contents bool readyForPainting() const; // true if the window has been already painted its contents
Visual* visual() const; Visual* visual() const;
bool shape() const; bool shape() const;
void setOpacity( float opacity ); void setOpacity( double opacity );
float opacity() const; double opacity() const;
int depth() const; int depth() const;
bool hasAlpha() const; bool hasAlpha() const;
void setupCompositing(); void setupCompositing();