[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-bugs-dist
Subject: [Bug 57429] screen saver setup breaks after using it several times
From: Enrico Ros <rosenric () dei ! unipd ! it>
Date: 2004-04-02 11:14:58
Message-ID: 20040402111458.9806.qmail () ktown ! kde ! org
[Download RAW message or body]
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.
http://bugs.kde.org/show_bug.cgi?id=57429
rosenric dei unipd it changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |FIXED
------- Additional Comments From rosenric dei unipd it 2004-04-02 13:14 -------
CVS commit by eros:
Euphoria cumulative patch. Fixes the "white bg" bug, some mem leaks, more
precise timings and minor things.
CCMAIL: 57429-done bugs kde org
M +23 -13 Euphoria.cpp 1.9
M +1 -1 Euphoria.h 1.3
--- kdeartwork/kscreensaver/kdesavers/Euphoria.cpp #1.8:1.9
@ -46,10 +46,10 @
-// Returns the system time, in milliseconds.
-long timeGetTime()
+// Returns the system time, in seconds.
+double timeGetTime()
{
struct timeval tp;
gettimeofday( &tp, 0 );
- return (tp.tv_sec * 1000) + (tp.tv_usec / 1000);
+ return (double)tp.tv_sec + (double)tp.tv_usec / 1000000;
}
@ -459,5 +459,6 @ void wisp::drawAsBackground()
EuphoriaWidget::EuphoriaWidget( QWidget* parent, const char* name )
- : QGLWidget(parent, name), _wisps(0), _backwisps(0)
+ : QGLWidget(parent, name), texName(0), _wisps(0), _backwisps(0),
+ feedbackmap(0), feedbacktex(0)
{
setDefaults( Regular );
@ -472,4 +473,8 @ EuphoriaWidget::~EuphoriaWidget()
{
// Free memory
+ if ( texName )
+ glDeleteTextures( 1, &texName );
+ if ( feedbacktex )
+ glDeleteTextures( 1, &feedbacktex );
delete[] _wisps;
delete[] _backwisps;
@ -480,13 +485,9 @ void EuphoriaWidget::paintGL()
{
int i;
- static long thisTime = timeGetTime(), lastTime;
+ static double lastTime = timeGetTime();
// update time
- lastTime = thisTime;
- thisTime = timeGetTime();
- if(thisTime >= lastTime)
- elapsedTime = float(thisTime - lastTime) * 0.001f;
- // else use elapsedTime from last frame
-
+ elapsedTime = timeGetTime() - lastTime;
+ lastTime += elapsedTime;
_ec = this;
@ -501,5 +502,5 @ void EuphoriaWidget::paintGL()
if(dFeedback)
{
- static float feedbackIntensity = float(dFeedback) / 101.0f;
+ float feedbackIntensity = float(dFeedback) / 101.0f;
// update feedback variables
@ -625,5 +626,7 @ void EuphoriaWidget::resizeGL( int w, in
void EuphoriaWidget::initializeGL()
{
- //resizeGL( width(), height() );
+ // Need to call this to setup viewport[] parameters used in
+ // the next updateParameters() call
+ resizeGL( width(), height() );
updateParameters();
@ -707,4 +710,7 @ void EuphoriaWidget::updateParameters()
gluBuild2DMipmaps(GL_TEXTURE_2D, 1, TEXSIZE, TEXSIZE, \
GL_LUMINANCE, GL_UNSIGNED_BYTE, linesmap); }
+ } else if ( texName ) {
+ glDeleteTextures( 1, &texName );
+ texName = 0;
}
@ -719,4 +725,5 @ void EuphoriaWidget::updateParameters()
// feedback texture setup
glEnable(GL_TEXTURE_2D);
+ delete [] feedbackmap;
feedbackmap = new unsigned char[feedbacktexsize*feedbacktexsize*3];
glGenTextures(1, &feedbacktex);
@ -736,4 +743,7 @ void EuphoriaWidget::updateParameters()
lv[1] = float(dFeedbackspeed) * (myRandf(0.0025f) + 0.0025f);
lv[2] = float(dFeedbackspeed) * (myRandf(0.0025f) + 0.0025f);
+ } else if ( feedbacktex ) {
+ glDeleteTextures( 1, &feedbacktex );
+ feedbacktex = 0;
}
--- kdeartwork/kscreensaver/kdesavers/Euphoria.h #1.2:1.3
@ -65,5 +65,5 @ private:
float aspectRatio;
int viewport[4];
- float elapsedTime;
+ double elapsedTime;
// feedback texture object
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic