[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] gnash ChangeLog gui/NullGui.cpp
From: |
Sandro Santilli |
Subject: |
[Gnash-commit] gnash ChangeLog gui/NullGui.cpp |
Date: |
Fri, 07 Dec 2007 18:13:12 +0000 |
CVSROOT: /sources/gnash
Module name: gnash
Changes by: Sandro Santilli <strk> 07/12/07 18:13:12
Modified files:
. : ChangeLog
gui : NullGui.cpp
Log message:
stop keeping CPU busy for nothing.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.5110&r2=1.5111
http://cvs.savannah.gnu.org/viewcvs/gnash/gui/NullGui.cpp?cvsroot=gnash&r1=1.19&r2=1.20
Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.5110
retrieving revision 1.5111
diff -u -b -r1.5110 -r1.5111
--- ChangeLog 7 Dec 2007 17:41:37 -0000 1.5110
+++ ChangeLog 7 Dec 2007 18:13:12 -0000 1.5111
@@ -1,5 +1,6 @@
2007-12-07 Sandro Santilli <address@hidden>
+ * gui/NullGui.cpp (run): stop keeping CPU busy for nothing.
* utilities/: parser.cpp, Makefile.am: drop gparser.
2007-12-07 Sandro Santilli <address@hidden>
Index: gui/NullGui.cpp
===================================================================
RCS file: /sources/gnash/gnash/gui/NullGui.cpp,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -b -r1.19 -r1.20
--- gui/NullGui.cpp 4 Dec 2007 11:45:22 -0000 1.19
+++ gui/NullGui.cpp 7 Dec 2007 18:13:12 -0000 1.20
@@ -32,7 +32,9 @@
# include <unistd.h> // for usleep
#endif
-#include "tu_timer.h"
+#include "SystemClock.h"
+
+//#include <iostream>
namespace gnash
{
@@ -40,51 +42,33 @@
bool
NullGui::run()
{
- boost::uint64_t prevtimer=0;
- boost::uint64_t start_timer = tu_timer::get_ticks(); // returns milliseconds
- prevtimer = start_timer;
+ SystemClock timer;
- while (true)
+ unsigned long prevtime = timer.elapsed();
+ while (!_quit)
{
- boost::uint64_t timer=0;
+ Gui::advance_movie(this);
+ unsigned long now = timer.elapsed();
+ unsigned long spent = now-prevtime;
- // synchronize to frame time
- if (_timeout || (_interval>1)) // avoid timing completely for interval==1
- while (1)
+ long rem = _interval-spent;
+ if ( rem > 0 )
{
-
- timer = tu_timer::get_ticks();
-
- if (timer - prevtimer >= _interval)
- break; // next frame, please!
-
- if (timer < prevtimer) // time glitch protection
- prevtimer = timer;
-
- usleep(1);
-
+ //std::cout << "spent: " << spent << " - rem: " << rem << std::endl;
+ usleep( rem * 1000 );
}
- if ( _timeout )
- {
- if ( timer - start_timer > _timeout)
+ if ( _timeout && now > _timeout)
{
break;
}
- }
-
-
- prevtimer = timer;
+ prevtime = now;
- Gui::advance_movie(this);
-
- // when runnign gnash with -1 switch ::advance_movie() will call ::quit()
- // at last frame
- if ( _quit ) break;
}
+
return false;
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gnash-commit] gnash ChangeLog gui/NullGui.cpp,
Sandro Santilli <=