traverso-commit
[Top][All Lists]
Advanced

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

[Traverso-commit] traverso/src/sheetcanvas Cursors.cpp


From: Remon Sijrier
Subject: [Traverso-commit] traverso/src/sheetcanvas Cursors.cpp
Date: Sat, 27 Sep 2008 17:01:10 +0000

CVSROOT:        /sources/traverso
Module name:    traverso
Changes by:     Remon Sijrier <r_sijrier>       08/09/27 17:01:10

Modified files:
        src/sheetcanvas: Cursors.cpp 

Log message:
        * an attempt to reduce cpu load for animated scroll

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/traverso/src/sheetcanvas/Cursors.cpp?cvsroot=traverso&r1=1.2&r2=1.3

Patches:
Index: Cursors.cpp
===================================================================
RCS file: /sources/traverso/traverso/src/sheetcanvas/Cursors.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- Cursors.cpp 29 Jan 2008 18:21:54 -0000      1.2
+++ Cursors.cpp 27 Sep 2008 17:01:10 -0000      1.3
@@ -23,10 +23,12 @@
 #include "SheetView.h"
 #include "ClipsViewPort.h"
 #include "AudioDevice.h"
-#include <QPen>
 #include <Sheet.h>
 #include <Config.h>
 #include <Themer.h>
+
+#include <QCoreApplication>
+#include <QPen>
 #include <QScrollBar>
                
 // Always put me below _all_ includes, this is needed
@@ -190,7 +192,6 @@
        }
 }
 
-
 void PlayHead::set_animation_value(int value)
 {
        QPointF newPos(m_sheet->get_transport_location() / 
m_sv->timeref_scalefactor, 0);
@@ -202,11 +203,20 @@
        m_totalAnimValue += (int)(diff + deltaX);
        int newXPos = (int)(m_animationScrollStartPos + m_totalAnimValue);
        
+       // When moving the PlayHead and scrollbar at the same time, QGV may 
update a very large
+       // portion of the canvas. By forcing the playhead to be painted first 
by calling
+       // qApp->processEvents();(needs to be called twice to take effect, 
weird!)
+       // the canvas gets 2 paint events, one for the playhead move, and one 
for the scrollbar
+       // move, reducing the cpu load. Some sort of ugly hack that is ;-)
        if (newPos != pos()) {
                setPos(newPos);
+               qApp->processEvents();
+               qApp->processEvents();
        }
        
+       if (m_sv->hscrollbar_value() != newXPos) {
        m_sv->set_hscrollbar_value(newXPos);
+       }
 }
 
 void PlayHead::calculate_total_anim_frames()




reply via email to

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