gnash-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gnash-commit] gnash ChangeLog gui/fb.cpp


From: Udo Giacomozzi
Subject: [Gnash-commit] gnash ChangeLog gui/fb.cpp
Date: Mon, 09 Oct 2006 17:41:28 +0000

CVSROOT:        /cvsroot/gnash
Module name:    gnash
Changes by:     Udo Giacomozzi <udog>   06/10/09 17:41:28

Modified files:
        .              : ChangeLog 
        gui            : fb.cpp 

Log message:
        Implemented correct timing

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.1097&r2=1.1098
http://cvs.savannah.gnu.org/viewcvs/gnash/gui/fb.cpp?cvsroot=gnash&r1=1.6&r2=1.7

Patches:
Index: ChangeLog
===================================================================
RCS file: /cvsroot/gnash/gnash/ChangeLog,v
retrieving revision 1.1097
retrieving revision 1.1098
diff -u -b -r1.1097 -r1.1098
--- ChangeLog   9 Oct 2006 17:34:24 -0000       1.1097
+++ ChangeLog   9 Oct 2006 17:41:27 -0000       1.1098
@@ -17,6 +17,7 @@
 
        * backend/render_handler_agg_compat.h: added compatibility
        header for agg package found in debian testing.
+       * gui/fb.cpp: implemented correct timing
 
 2006-10-09 Udo Giacomozzi <address@hidden>
 

Index: gui/fb.cpp
===================================================================
RCS file: /cvsroot/gnash/gnash/gui/fb.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- gui/fb.cpp  9 Oct 2006 16:18:22 -0000       1.6
+++ gui/fb.cpp  9 Oct 2006 17:41:27 -0000       1.7
@@ -63,6 +63,7 @@
 
 #include <sys/types.h>
 #include <sys/stat.h>
+#include <sys/time.h>
 #include <fcntl.h>
 #include <errno.h>
 #include <sys/ioctl.h>
@@ -187,6 +188,7 @@
   #undef TO_16BIT
 }
 
+
 bool FBGui::init(int /*argc*/, char *** /*argv*/)
 {
   // Open the framebuffer device
@@ -312,10 +314,21 @@
 
 bool FBGui::run()
 {
+  double timer = 0.0;
+
        while (true) {
-               // sleep for _interval milliseconds
-    // TODO: Instead of sleeping, use a timer to compensate render time        
        
-               usleep(_interval*1000);
+       
+         double prevtimer = timer; 
+               
+               while ((timer-prevtimer)*1000 < _interval) {
+               
+                 usleep(1); // task switch
+                 
+      struct timeval tv;
+      if (!gettimeofday(&tv, NULL))
+        timer = (double)tv.tv_sec + (double)tv.tv_usec / 1000000.0;
+    }
+       
                Gui::advance_movie(this);
        }
        return true;




reply via email to

[Prev in Thread] Current Thread [Next in Thread]