Use always float as the floating point type for compositing
(http://lists.kde.org/?l=kwin&m=118493073424327&w=2). svn path=/trunk/KDE/kdebase/workspace/; revision=700026
This commit is contained in:
parent
32506e3aa7
commit
d846a1e8a9
28 changed files with 86 additions and 86 deletions
|
@ -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()
|
||||
};
|
||||
|
|
|
@ -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<EffectWindowImpl*>(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();
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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 )
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
};
|
||||
|
|
|
@ -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 );
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 )
|
||||
|
|
|
@ -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;
|
||||
};
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
};
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -32,8 +32,8 @@ class ZoomEffect
|
|||
void zoomOut();
|
||||
void actualSize();
|
||||
private:
|
||||
double zoom;
|
||||
double target_zoom;
|
||||
float zoom;
|
||||
float target_zoom;
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
};
|
||||
|
|
|
@ -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 )
|
||||
{
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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 )
|
||||
{
|
||||
|
|
|
@ -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;
|
||||
};
|
||||
|
||||
|
|
|
@ -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 ));
|
||||
|
|
|
@ -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();
|
||||
|
|
Loading…
Reference in a new issue