]> git.sesse.net Git - vlc/commitdiff
skins2: optimize refresh
authorErwan Tulou <erwan10@videolan.org>
Sat, 26 Dec 2009 20:31:06 +0000 (21:31 +0100)
committerErwan Tulou <erwan10@videolan.org>
Sat, 26 Dec 2009 22:18:34 +0000 (23:18 +0100)
skins2 manages a cache for building layouts. Yet, on each redraw/expose,
it rebuilds the whole layout. This patch avoids these unnecessary rebuilds.
It results in dramatic improvement, especially on Linux, where refresh was a real issue.

modules/gui/skins2/src/generic_layout.cpp
modules/gui/skins2/src/top_window.cpp

index ff695aec0dbab4a3bf95205a971a17fee1de1983..97bb03ce4d269c01b16b90db7f144dd1d176c133 100644 (file)
@@ -234,17 +234,7 @@ void GenericLayout::refreshRect( int x, int y, int width, int height )
         if( y + height > m_rect.getHeight() )
             height = m_rect.getHeight() - y;
 
-        // Refresh the window... but do not paint on a visible video control!
-        if( !m_pVideoCtrlSet.size() )
-        {
-            // No video control, we can safely repaint the rectangle
-            pWindow->refresh( x, y, width, height );
-        }
-        else
-        {
-            // video control(s) present, we need more calculations
-            computeRefresh( x, y, width, height );
-        }
+        computeRefresh( x, y, width, height );
     }
 }
 
@@ -280,9 +270,23 @@ public:
 
 void GenericLayout::computeRefresh( int x, int y, int width, int height )
 {
+    TopWindow *pWindow = getWindow();
+
+#ifndef WIN32
+
+    pWindow->refresh( x, y, width, height );
+
+#else
+
+    if( !m_pVideoCtrlSet.size() )
+    {
+        // No video control, we can safely repaint the rectangle
+        pWindow->refresh( x, y, width, height );
+        return;
+    }
+
     int w = width;
     int h = height;
-    TopWindow *pWindow = getWindow();
 
     set<int> x_set;
     set<int> y_set;
@@ -355,6 +359,9 @@ void GenericLayout::computeRefresh( int x, int y, int width, int height )
                 pWindow->refresh( x0, y0, w0 ,h0 );
         }
     }
+
+#endif
+
 }
 
 
index b7f791b62770067d319f81e331c59a89595c890a..1b355ebf0fa891d6fbd7815578b3e4ea2f9f6c21 100644 (file)
@@ -82,10 +82,10 @@ void TopWindow::processEvent( EvtRefresh &rEvtRefresh )
     }
     else
     {
-        m_pActiveLayout->refreshRect( rEvtRefresh.getXStart(),
-                                      rEvtRefresh.getYStart(),
-                                      rEvtRefresh.getWidth(),
-                                      rEvtRefresh.getHeight() );
+        m_pActiveLayout->computeRefresh( rEvtRefresh.getXStart(),
+                                         rEvtRefresh.getYStart(),
+                                         rEvtRefresh.getWidth(),
+                                         rEvtRefresh.getHeight() );
     }
 }