diff --git a/deleted.h b/deleted.h index 269aef86ab..5e2e38c380 100644 --- a/deleted.h +++ b/deleted.h @@ -35,7 +35,7 @@ class Deleted void copyToDeleted( Toplevel* c ); virtual ~Deleted(); // deleted only using unrefWindow() int delete_refcount; - double window_opacity; + float window_opacity; int desk; QRect contentsRect; // for clientPos()/clientSize() }; diff --git a/effects.cpp b/effects.cpp index 7a5b59bd88..cab0ab1630 100644 --- a/effects.cpp +++ b/effects.cpp @@ -172,7 +172,7 @@ void EffectsHandlerImpl::windowUserMovedResized( EffectWindow* c, bool first, bo ep.second->windowUserMovedResized( c, first, last ); } -void EffectsHandlerImpl::windowOpacityChanged( EffectWindow* c, double old_opacity ) +void EffectsHandlerImpl::windowOpacityChanged( EffectWindow* c, float old_opacity ) { if( static_cast(c)->window()->opacity() == old_opacity ) return; @@ -853,7 +853,7 @@ bool EffectWindowImpl::isMinimized() const return false; } -double EffectWindowImpl::opacity() const +float EffectWindowImpl::opacity() const { return toplevel->opacity(); } diff --git a/effects.h b/effects.h index bd1e51e247..647c0d0cea 100644 --- a/effects.h +++ b/effects.h @@ -92,7 +92,7 @@ class EffectsHandlerImpl : public EffectsHandler // internal (used by kwin core or compositing code) void startPaint(); void windowUserMovedResized( EffectWindow* c, bool first, bool last ); - void windowOpacityChanged( EffectWindow* c, double old_opacity ); + void windowOpacityChanged( EffectWindow* c, float old_opacity ); void windowAdded( EffectWindow* c ); void windowClosed( EffectWindow* c ); void windowDeleted( EffectWindow* c ); @@ -149,7 +149,7 @@ class EffectWindowImpl : public EffectWindow virtual bool isOnAllDesktops() const; virtual int desktop() const; // prefer isOnXXX() virtual bool isMinimized() const; - virtual double opacity() const; + virtual float opacity() const; virtual QString caption() const; virtual QPixmap icon() const; virtual QString windowClass() const; diff --git a/effects/boxswitch.cpp b/effects/boxswitch.cpp index d7ab72b384..66a0c5a679 100644 --- a/effects/boxswitch.cpp +++ b/effects/boxswitch.cpp @@ -524,8 +524,8 @@ void BoxSwitchEffect::paintDesktopThumbnail( int iDesktop ) QSize size = QSize( displayWidth(), displayHeight()); size.scale( r.size(), Qt::KeepAspectRatio ); - data.xScale = size.width() / double( displayWidth()); - data.yScale = size.height() / double( displayHeight()); + data.xScale = size.width() / float( displayWidth()); + data.yScale = size.height() / float( displayHeight()); int width = int( displayWidth() * data.xScale ); int height = int( displayHeight() * data.yScale ); int x = r.x() + ( r.width() - width ) / 2; diff --git a/effects/desktopgrid.cpp b/effects/desktopgrid.cpp index 66652c1303..52e9316490 100644 --- a/effects/desktopgrid.cpp +++ b/effects/desktopgrid.cpp @@ -46,7 +46,7 @@ void DesktopGridEffect::prePaintScreen( ScreenPrePaintData& data, int time ) { if( slide ) { - progress = qMin( 1.0, progress + time / double( PROGRESS_TIME )); + progress = qMin( 1.0f, progress + time / float( PROGRESS_TIME )); // 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 if( progress != 1 ) @@ -60,9 +60,9 @@ void DesktopGridEffect::prePaintScreen( ScreenPrePaintData& data, int time ) else if( progress != 0 || activated ) { if( activated ) - progress = qMin( 1.0, progress + time / double( PROGRESS_TIME )); + progress = qMin( 1.0f, progress + time / float( PROGRESS_TIME )); else - progress = qMax( 0.0, progress - time / double( PROGRESS_TIME )); + progress = qMax( 0.0f, progress - time / float( PROGRESS_TIME )); // 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 if( progress != 0 ) diff --git a/effects/drunken.h b/effects/drunken.h index 2b665c4536..85ac1a1b8c 100644 --- a/effects/drunken.h +++ b/effects/drunken.h @@ -27,7 +27,7 @@ class DrunkenEffect virtual void windowAdded( EffectWindow* w ); virtual void windowClosed( EffectWindow* w ); private: - QHash< EffectWindow*, double > windows; // progress + QHash< EffectWindow*, float > windows; // progress }; } // namespace diff --git a/effects/explosioneffect.h b/effects/explosioneffect.h index b2846cd6aa..e570469cc7 100644 --- a/effects/explosioneffect.h +++ b/effects/explosioneffect.h @@ -50,7 +50,7 @@ class ExplosionEffect GLShader* mShader; GLTexture* mStartOffsetTex; GLTexture* mEndOffsetTex; - QMap< const EffectWindow*, double > mWindows; + QMap< const EffectWindow*, float > mWindows; int mActiveAnimations; bool mValid; bool mInited; diff --git a/effects/fade.cpp b/effects/fade.cpp index 4841ec1706..cd5e2e0ecc 100644 --- a/effects/fade.cpp +++ b/effects/fade.cpp @@ -29,8 +29,8 @@ void FadeEffect::prePaintScreen( ScreenPrePaintData& data, int time ) { if( !windows.isEmpty()) { - fadeInStep = time / double( fadeInTime ); - fadeOutStep = time / double( fadeOutTime ); + fadeInStep = time / float( fadeInTime ); + fadeOutStep = time / float( fadeOutTime ); } effects->prePaintScreen( data, time ); } @@ -114,7 +114,7 @@ void FadeEffect::paintWindow( EffectWindow* w, int mask, QRegion region, WindowP windows[ w ].brightness - float( windows[ w ].fadeOutStep )); } - windows[ w ].opacity = qBound( 0.0, windows[ w ].opacity, 1.0 ); + windows[ w ].opacity = qBound( 0.0f, windows[ w ].opacity, 1.0f ); windows[ w ].saturation = qBound( 0.0f, windows[ w ].saturation, 1.0f ); windows[ w ].brightness = qBound( 0.0f, windows[ w ].brightness, 1.0f ); windows[ w ].fadeInStep = 0.0; @@ -136,7 +136,7 @@ void FadeEffect::paintWindow( EffectWindow* w, int mask, QRegion region, WindowP effects->paintWindow( w, mask, region, data ); } -void FadeEffect::windowOpacityChanged( EffectWindow* w, double old_opacity ) +void FadeEffect::windowOpacityChanged( EffectWindow* w, float old_opacity ) { if( !windows.contains( w )) windows[ w ].opacity = old_opacity; diff --git a/effects/fade.h b/effects/fade.h index 0b2f20ae9b..f1f27ef226 100644 --- a/effects/fade.h +++ b/effects/fade.h @@ -26,7 +26,7 @@ class FadeEffect virtual void paintWindow( EffectWindow* w, int mask, QRegion region, WindowPaintData& data ); // TODO react also on virtual desktop changes - virtual void windowOpacityChanged( EffectWindow* c, double old_opacity ); + virtual void windowOpacityChanged( EffectWindow* c, float old_opacity ); virtual void windowAdded( EffectWindow* c ); virtual void windowClosed( EffectWindow* c ); virtual void windowDeleted( EffectWindow* c ); @@ -35,7 +35,7 @@ class FadeEffect private: class WindowInfo; QHash< const EffectWindow*, WindowInfo > windows; - double fadeInStep, fadeOutStep; + float fadeInStep, fadeOutStep; int fadeInTime, fadeOutTime; bool fadeWindows; }; @@ -51,8 +51,8 @@ class FadeEffect::WindowInfo , brightness( 1.0 ) , deleted( false ) {} - double fadeInStep, fadeOutStep; - double opacity; + float fadeInStep, fadeOutStep; + float opacity; float saturation, brightness; bool deleted; }; diff --git a/effects/fallapart.cpp b/effects/fallapart.cpp index beee4717af..cc4cbeba30 100644 --- a/effects/fallapart.cpp +++ b/effects/fallapart.cpp @@ -57,17 +57,17 @@ void FallApartEffect::paintWindow( EffectWindow* w, int mask, QRegion region, Wi // make fragments move in various directions, based on where // they are (left pieces generally move to the left, etc.) QPointF p1( quad[ 0 ].x(), quad[ 0 ].y()); - double xdiff = 0; + float xdiff = 0; if( p1.x() < w->width() / 2 ) xdiff = -( w->width() / 2 - p1.x()) / w->width() * 100; if( p1.x() > w->width() / 2 ) xdiff = ( p1.x() - w->width() / 2 ) / w->width() * 100; - double ydiff = 0; + float ydiff = 0; if( p1.y() < w->height() / 2 ) ydiff = -( w->height() / 2 - p1.y()) / w->height() * 100; if( p1.y() > w->height() / 2 ) ydiff = ( p1.y() - w->height() / 2 ) / w->height() * 100; - double modif = windows[ w ] * windows[ w ] * 64; + float modif = windows[ w ] * windows[ w ] * 64; srandom( cnt ); // change direction randomly but consistently xdiff += ( 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 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 ); - double adiff = ( rand() % 720 - 360 ) / 360. * 2 * M_PI; // spin randomly + float adiff = ( rand() % 720 - 360 ) / 360. * 2 * M_PI; // spin randomly for( int j = 0; j < 4; ++j ) { - double x = quad[ j ].x() - center.x(); - double y = quad[ j ].y() - center.y(); - double angle = atan2( y, x ); + float x = quad[ j ].x() - center.x(); + float y = quad[ j ].y() - center.y(); + float angle = atan2( y, x ); angle += windows[ w ] * adiff; - double dist = sqrt( x * x + y * y ); + float dist = sqrt( x * x + y * y ); x = dist * cos( angle ); y = dist * sin( angle ); quad[ j ].move( center.x() + x, center.y() + y ); diff --git a/effects/fallapart.h b/effects/fallapart.h index 90f399aace..f420f32907 100644 --- a/effects/fallapart.h +++ b/effects/fallapart.h @@ -27,7 +27,7 @@ class FallApartEffect virtual void windowClosed( EffectWindow* c ); virtual void windowDeleted( EffectWindow* c ); private: - QHash< const EffectWindow*, double > windows; + QHash< const EffectWindow*, float > windows; }; } // namespace diff --git a/effects/flame.h b/effects/flame.h index ee3ac7da53..861e755ad8 100644 --- a/effects/flame.h +++ b/effects/flame.h @@ -27,7 +27,7 @@ class FlameEffect virtual void windowClosed( EffectWindow* c ); virtual void windowDeleted( EffectWindow* c ); private: - QHash< const EffectWindow*, double > windows; + QHash< const EffectWindow*, float > windows; }; } // namespace diff --git a/effects/magnifier.cpp b/effects/magnifier.cpp index d8c9e6f5c8..cb34f238d9 100644 --- a/effects/magnifier.cpp +++ b/effects/magnifier.cpp @@ -46,11 +46,11 @@ void MagnifierEffect::prePaintScreen( ScreenPrePaintData& data, int time ) { if( zoom != target_zoom ) { - double diff = time / 500.0; + float diff = time / 500.0; if( target_zoom > zoom ) - zoom = qMin( zoom * qMax( 1 + diff, 1.2 ), target_zoom ); + zoom = qMin( zoom * qMax( 1 + diff, 1.2f ), target_zoom ); else - zoom = qMax( zoom * qMin( 1 - diff, 0.8 ), target_zoom ); + zoom = qMax( zoom * qMin( 1 - diff, 0.8f ), target_zoom ); } effects->prePaintScreen( data, time ); if( zoom != 1.0 ) diff --git a/effects/magnifier.h b/effects/magnifier.h index 548bbe7e12..8d08670fb1 100644 --- a/effects/magnifier.h +++ b/effects/magnifier.h @@ -33,8 +33,8 @@ class MagnifierEffect void toggle(); private: QRect magnifierArea( QPoint pos = cursorPos()) const; - double zoom; - double target_zoom; + float zoom; + float target_zoom; QSize magnifier_size; }; diff --git a/effects/presentwindows.cpp b/effects/presentwindows.cpp index 7f29c36c98..d45132c525 100644 --- a/effects/presentwindows.cpp +++ b/effects/presentwindows.cpp @@ -443,12 +443,12 @@ void PresentWindowsEffect::calculateWindowTransformationsKompose(EffectWindowLis if ( parentRatio > 1 ) { columns = (int)ceil( sqrt(windowlist.count()) ); - rows = (int)ceil( (double)windowlist.count() / (double)columns ); + rows = (int)ceil( (float)windowlist.count() / (float)columns ); } else { rows = (int)ceil( sqrt(windowlist.count()) ); - columns = (int)ceil( (double)windowlist.count() / (double)rows ); + columns = (int)ceil( (float)windowlist.count() / (float)rows ); } kDebug() << k_funcinfo << "Using " << rows << " rows & " << columns << " columns for " << windowlist.count() << " clients"; @@ -505,8 +505,8 @@ void PresentWindowsEffect::calculateWindowTransformationsKompose(EffectWindowLis } else { - double widthForHeight = windowWidthForHeight(window, usableH); - double heightForWidth = windowHeightForWidth(window, usableW); + float widthForHeight = windowWidthForHeight(window, usableH); + float heightForWidth = windowHeightForWidth(window, usableW); if ( (ratio >= 1.0 && heightForWidth <= usableH) || (ratio < 1.0 && widthForHeight > usableW) ) { @@ -572,7 +572,7 @@ void PresentWindowsEffect::calculateWindowTransformationsClosest(EffectWindowLis { QRect area = effects->clientArea( PlacementArea, QPoint( 0, 0 ), effects->currentDesktop()); int columns = int( ceil( sqrt( windowlist.count()))); - int rows = int( ceil( windowlist.count() / double( columns ))); + int rows = int( ceil( windowlist.count() / float( columns ))); foreach( EffectWindow* w, windowlist ) mWindowData[ w ].slot = -1; for(;;) @@ -693,9 +693,9 @@ bool PresentWindowsEffect::canRearrangeClosest(EffectWindowList windowlist) { QRect area = effects->clientArea( PlacementArea, QPoint( 0, 0 ), effects->currentDesktop()); int columns = int( ceil( sqrt( windowlist.count()))); - int rows = int( ceil( windowlist.count() / double( columns ))); + int rows = int( ceil( windowlist.count() / float( columns ))); int old_columns = int( ceil( sqrt( mWindowData.count()))); - int old_rows = int( ceil( mWindowData.count() / double( columns ))); + int old_rows = int( ceil( mWindowData.count() / float( columns ))); return old_columns != columns || old_rows != rows; } diff --git a/effects/scalein.h b/effects/scalein.h index a687043973..b1ea088b1d 100644 --- a/effects/scalein.h +++ b/effects/scalein.h @@ -28,7 +28,7 @@ class ScaleInEffect virtual void windowAdded( EffectWindow* c ); virtual void windowClosed( EffectWindow* c ); private: - QHash< const EffectWindow*, double > windows; + QHash< const EffectWindow*, float > windows; }; } // namespace diff --git a/effects/showfps.h b/effects/showfps.h index e85dc98381..cc58b80bd2 100644 --- a/effects/showfps.h +++ b/effects/showfps.h @@ -36,7 +36,7 @@ class ShowFpsEffect enum { MAX_FPS = 200 }; int frames[ MAX_FPS ]; // (sec*1000+msec) of the time the frame was done int frames_pos; // position in the queue - double alpha; + float alpha; int x; int y; }; diff --git a/effects/thumbnailaside.cpp b/effects/thumbnailaside.cpp index 53f72a4e93..59f8d83d49 100644 --- a/effects/thumbnailaside.cpp +++ b/effects/thumbnailaside.cpp @@ -127,8 +127,8 @@ void ThumbnailAsideEffect::arrange() pos[ d.index ] = d.window->height(); } QRect area = effects->clientArea( WorkArea, QPoint(), effects->currentDesktop()); - double scale = area.height() / double( height ); - scale = qMin( scale, maxwidth / double( mwidth )); // don't be wider than maxwidth pixels + float scale = area.height() / float( height ); + scale = qMin( scale, maxwidth / float( mwidth )); // don't be wider than maxwidth pixels int add = 0; for( int i = 0; i < windows.size(); diff --git a/effects/zoom.cpp b/effects/zoom.cpp index 965fe776fe..5fbeefc52b 100644 --- a/effects/zoom.cpp +++ b/effects/zoom.cpp @@ -37,11 +37,11 @@ void ZoomEffect::prePaintScreen( ScreenPrePaintData& data, int time ) { if( zoom != target_zoom ) { - double diff = time / 500.0; + float diff = time / 500.0; if( target_zoom > zoom ) - zoom = qMin( zoom * qMax( 1 + diff, 1.2 ), target_zoom ); + zoom = qMin( zoom * qMax( 1 + diff, 1.2f ), target_zoom ); else - zoom = qMax( zoom * qMin( 1 - diff, 0.8 ), target_zoom ); + zoom = qMax( zoom * qMin( 1 - diff, 0.8f ), target_zoom ); } if( zoom != 1.0 ) data.mask |= PAINT_SCREEN_TRANSFORMED; diff --git a/effects/zoom.h b/effects/zoom.h index f198b7391f..af54fe2ec5 100644 --- a/effects/zoom.h +++ b/effects/zoom.h @@ -32,8 +32,8 @@ class ZoomEffect void zoomOut(); void actualSize(); private: - double zoom; - double target_zoom; + float zoom; + float target_zoom; }; } // namespace diff --git a/lib/kwineffects.cpp b/lib/kwineffects.cpp index de324b1db7..d4bf4fa9d0 100644 --- a/lib/kwineffects.cpp +++ b/lib/kwineffects.cpp @@ -74,7 +74,7 @@ void Effect::windowUserMovedResized( EffectWindow* , bool, bool ) { } -void Effect::windowOpacityChanged( EffectWindow*, double ) +void Effect::windowOpacityChanged( EffectWindow*, float ) { } @@ -187,8 +187,8 @@ void Effect::setPositionTransformations( WindowPaintData& data, QRect& region, E { QSize size = w->size(); size.scale( r.size(), aspect ); - data.xScale = size.width() / double( w->width()); - data.yScale = size.height() / double( w->height()); + data.xScale = size.width() / float( w->width()); + data.yScale = size.height() / float( w->height()); int width = int( w->width() * data.xScale ); int height = int( w->height() * data.yScale ); int x = r.x() + ( r.width() - width ) / 2; diff --git a/lib/kwineffects.h b/lib/kwineffects.h index 2a26ac0a74..69989c0bd1 100644 --- a/lib/kwineffects.h +++ b/lib/kwineffects.h @@ -96,7 +96,7 @@ class KWIN_EXPORT Effect // called when moved/resized or once after it's finished virtual void windowUserMovedResized( EffectWindow* c, bool first, bool last ); - virtual void windowOpacityChanged( EffectWindow* c, double old_opacity ); + virtual void windowOpacityChanged( EffectWindow* c, float old_opacity ); virtual void windowAdded( EffectWindow* c ); virtual void windowClosed( EffectWindow* c ); virtual void windowDeleted( EffectWindow* c ); @@ -294,7 +294,7 @@ class KWIN_EXPORT EffectWindow virtual bool isDeleted() const = 0; virtual bool isMinimized() const = 0; - virtual double opacity() const = 0; + virtual float opacity() const = 0; virtual bool isOnDesktop( int d ) const; virtual bool isOnCurrentDesktop() const; @@ -457,11 +457,11 @@ class KWIN_EXPORT WindowPaintData * Opacity for contents is opacity*contents_opacity, the same * way for decoration. */ - double opacity; - double contents_opacity; - double decoration_opacity; - double xScale; - double yScale; + float opacity; + float contents_opacity; + float decoration_opacity; + float xScale; + float yScale; int xTranslate; int yTranslate; /** @@ -488,8 +488,8 @@ class KWIN_EXPORT ScreenPaintData { public: ScreenPaintData(); - double xScale; - double yScale; + float xScale; + float yScale; int xTranslate; int yTranslate; }; diff --git a/scene_opengl.cpp b/scene_opengl.cpp index 1d66ee55aa..2c75296e9a 100644 --- a/scene_opengl.cpp +++ b/scene_opengl.cpp @@ -1168,7 +1168,7 @@ void SceneOpenGL::Window::renderQuads( int mask, const QRegion& region, const Wi delete[] texcoords; } -void SceneOpenGL::Window::prepareStates( double opacity, double brightness, double saturation, GLShader* shader ) +void SceneOpenGL::Window::prepareStates( float opacity, float brightness, float saturation, GLShader* shader ) { if(shader) prepareShaderRenderStates( opacity, brightness, saturation, shader ); @@ -1176,7 +1176,7 @@ void SceneOpenGL::Window::prepareStates( double opacity, double brightness, doub prepareRenderStates( opacity, brightness, saturation ); } -void SceneOpenGL::Window::prepareShaderRenderStates( double opacity, double brightness, double saturation, GLShader* shader ) +void SceneOpenGL::Window::prepareShaderRenderStates( float opacity, float brightness, float saturation, GLShader* shader ) { // setup blending of transparent windows glPushAttrib( GL_ENABLE_BIT ); @@ -1191,7 +1191,7 @@ void SceneOpenGL::Window::prepareShaderRenderStates( double opacity, double brig shader->setUniform("brightness", (float)brightness); } -void SceneOpenGL::Window::prepareRenderStates( double opacity, double brightness, double saturation ) +void SceneOpenGL::Window::prepareRenderStates( float opacity, float brightness, float saturation ) { // setup blending of transparent windows glPushAttrib( GL_ENABLE_BIT ); @@ -1316,7 +1316,7 @@ void SceneOpenGL::Window::prepareRenderStates( double opacity, double brightness } } -void SceneOpenGL::Window::restoreStates( double opacity, double brightness, double saturation, GLShader* shader ) +void SceneOpenGL::Window::restoreStates( float opacity, float brightness, float saturation, GLShader* shader ) { if(shader) restoreShaderRenderStates( opacity, brightness, saturation, shader ); @@ -1324,7 +1324,7 @@ void SceneOpenGL::Window::restoreStates( double opacity, double brightness, doub restoreRenderStates( opacity, brightness, saturation ); } -void SceneOpenGL::Window::restoreShaderRenderStates( double opacity, double brightness, double saturation, GLShader* shader ) +void SceneOpenGL::Window::restoreShaderRenderStates( float opacity, float brightness, float saturation, GLShader* shader ) { Q_UNUSED( opacity ); Q_UNUSED( brightness ); @@ -1333,7 +1333,7 @@ void SceneOpenGL::Window::restoreShaderRenderStates( double opacity, double brig glPopAttrib(); // ENABLE_BIT } -void SceneOpenGL::Window::restoreRenderStates( double opacity, double brightness, double saturation ) +void SceneOpenGL::Window::restoreRenderStates( float opacity, float brightness, float saturation ) { if( opacity != 1.0 || saturation != 1.0 || brightness != 1.0f ) { diff --git a/scene_opengl.h b/scene_opengl.h index e30d00db84..ca2e3a0e43 100644 --- a/scene_opengl.h +++ b/scene_opengl.h @@ -124,12 +124,12 @@ class SceneOpenGL::Window protected: void renderQuads( int mask, const QRegion& region, const WindowQuadList& quads ); - void prepareStates( double opacity, double brightness, double saturation, GLShader* shader ); - void prepareRenderStates( double opacity, double brightness, double saturation ); - void prepareShaderRenderStates( double opacity, double brightness, double saturation, GLShader* shader ); - void restoreStates( double opacity, double brightness, double saturation, GLShader* shader ); - void restoreRenderStates( double opacity, double brightness, double saturation ); - void restoreShaderRenderStates( double opacity, double brightness, double saturation, GLShader* shader ); + void prepareStates( float opacity, float brightness, float saturation, GLShader* shader ); + void prepareRenderStates( float opacity, float brightness, float saturation ); + void prepareShaderRenderStates( float opacity, float brightness, float saturation, GLShader* shader ); + void restoreStates( float opacity, float brightness, float saturation, GLShader* shader ); + void restoreRenderStates( float opacity, float brightness, float saturation ); + void restoreShaderRenderStates( float opacity, float brightness, float saturation, GLShader* shader ); private: Texture texture; diff --git a/scene_xrender.cpp b/scene_xrender.cpp index cf99e2a9c8..0e7174c4aa 100644 --- a/scene_xrender.cpp +++ b/scene_xrender.cpp @@ -394,7 +394,7 @@ void SceneXrender::Window::discardAlpha() } // Create XRender picture for the alpha mask. -Picture SceneXrender::Window::alphaMask( double opacity ) +Picture SceneXrender::Window::alphaMask( float opacity ) { if( isOpaque() && opacity == 1.0 ) return None; @@ -469,8 +469,8 @@ void SceneXrender::Window::performPaint( int mask, QRegion region, WindowPaintDa int y = toplevel->y(); int width = toplevel->width(); int height = toplevel->height(); - double xscale = 1; - double yscale = 1; + float xscale = 1; + float yscale = 1; transformed_shape = shape(); if( mask & PAINT_WINDOW_TRANSFORMED ) { diff --git a/scene_xrender.h b/scene_xrender.h index ae1de60018..cefa27d4fa 100644 --- a/scene_xrender.h +++ b/scene_xrender.h @@ -67,11 +67,11 @@ class SceneXrender::Window void setTransformedShape( const QRegion& shape ); private: Picture picture(); - Picture alphaMask( double opacity ); + Picture alphaMask( float opacity ); Picture _picture; XRenderPictFormat* format; Picture alpha; - double alpha_cached_opacity; + float alpha_cached_opacity; QRegion transformed_shape; }; diff --git a/toplevel.cpp b/toplevel.cpp index 322836d97b..a5d37e7b21 100644 --- a/toplevel.cpp +++ b/toplevel.cpp @@ -294,17 +294,17 @@ void Toplevel::getResourceClass() } } -double Toplevel::opacity() const +float Toplevel::opacity() const { if( info->opacity() == 0xffffffff ) return 1.0; return info->opacity() * 1.0 / 0xffffffff; } -void Toplevel::setOpacity( double new_opacity ) +void Toplevel::setOpacity( float new_opacity ) { - double old_opacity = opacity(); - new_opacity = qBound( 0.0, new_opacity, 1.0 ); + float old_opacity = opacity(); + new_opacity = qBound( 0.0f, new_opacity, 1.0f ); if( old_opacity == new_opacity ) return; info->setOpacity( static_cast< unsigned long >( new_opacity * 0xffffffff )); diff --git a/toplevel.h b/toplevel.h index b8cf559804..1b224297c7 100644 --- a/toplevel.h +++ b/toplevel.h @@ -90,8 +90,8 @@ class Toplevel bool readyForPainting() const; // true if the window has been already painted its contents Visual* visual() const; bool shape() const; - void setOpacity( double opacity ); - double opacity() const; + void setOpacity( float opacity ); + float opacity() const; int depth() const; bool hasAlpha() const; void setupCompositing();