Commit ce4bddf3 authored by Erwan Tulou's avatar Erwan Tulou
Browse files

skins2: optimize refresh

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.
parent 58a785a5
......@@ -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
}
......
......@@ -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() );
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment