[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    branches/KDE/4.6/kdeedu/marble/src/plugins/render/routing
From:       Dennis Nienhüser <earthwings () gentoo ! org>
Date:       2011-01-06 14:11:45
Message-ID: 20110106141145.ACB54AC8B0 () svn ! kde ! org
[Download RAW message or body]

SVN commit 1212311 by nienhueser:

Performance optimizations:
- Avoid dynamic_casts in eventFilter which is called quite often
- Only repaint marble widget when the button check state has really changed. \
                zoomChanged() is called frequently.
- Activate item caching via pixmaps. This increases rendering speed nearly by a \
factor of 4 on my system, painting the float item without caching takes around 55 ms, \
less than 1 ms with. Backport of commit 1212304.

 M  +10 -4     RoutingPlugin.cpp  


--- branches/KDE/4.6/kdeedu/marble/src/plugins/render/routing/RoutingPlugin.cpp \
#1212310:1212311 @@ -36,7 +36,6 @@
 #include <QtGui/QActionGroup>
 #include <QtGui/QPixmap>
 #include <QtGui/QPlastiqueStyle>
-#include <QtCore/QDebug>
 
 namespace Marble
 {
@@ -138,11 +137,16 @@
     int const minZoom = m_marbleWidget ? m_marbleWidget->minimumZoom() : 900;
     int const maxZoom = m_marbleWidget ? m_marbleWidget->maximumZoom() : 2400;
 
-    m_widget.zoomInButton->setEnabled( zoomValue < maxZoom );
-    m_widget.zoomOutButton->setEnabled( zoomValue > minZoom );
+    bool const zoomInEnabled = zoomValue < maxZoom;
+    bool const zoomOutEnabled = zoomValue > minZoom;
 
+    if ( ( zoomInEnabled != m_widget.zoomInButton->isEnabled() ) ||
+         ( zoomOutEnabled != m_widget.zoomOutButton->isEnabled() ) ) {
+        m_widget.zoomInButton->setEnabled( zoomInEnabled );
+        m_widget.zoomOutButton->setEnabled( zoomOutEnabled );
     forceRepaint();
 }
+}
 
 void RoutingPluginPrivate::updateGuidanceModeButton()
 {
@@ -152,6 +156,7 @@
 
 void RoutingPluginPrivate::forceRepaint()
 {
+    m_widgetItem->update();
     if ( m_marbleWidget ) {
         // Trigger a repaint of the float item. Otherwise button state updates are \
delayed  m_marbleWidget->setAttribute( Qt::WA_NoSystemBackground, false );
@@ -384,6 +389,7 @@
 
     d->m_widgetItem = new WidgetGraphicsItem( this );
     d->m_widgetItem->setWidget( widget );
+    d->m_widgetItem->setCacheMode( MarbleGraphicsItem::DeviceCoordinateCache );
 
     bool const smallScreen = MarbleGlobal::getInstance()->profiles() & \
MarbleGlobal::SmallScreen;  if ( smallScreen ) {
@@ -408,7 +414,7 @@
 
 bool RoutingPlugin::eventFilter( QObject *object, QEvent *e )
 {
-    if ( !enabled() || !visible() ) {
+    if ( d->m_marbleWidget || !enabled() || !visible() ) {
         return AbstractFloatItem::eventFilter( object, e );
     }
 


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic