[vlc-devel] commit: skins(Win32): replace GetWindowDC with GetDC (Erwan Tulou )
git version control
git at videolan.org
Mon Mar 1 21:59:42 CET 2010
vlc | branch: master | Erwan Tulou <erwan10 at videolan.org> | Mon Mar 1 18:16:47 2010 +0100| [4ad06d105245706d12932f3391584ee5f5bbf5ea] | committer: Erwan Tulou
skins(Win32): replace GetWindowDC with GetDC
GetWindowDC paints in nonclient area (not recommended on msdn)
and not needed for skins. Also, it doesn't take WS_CLIPCHILDREN
into account and forced to add a lengthy hack which can now be removed.
This patch hopefully could also fix a refresh issue found only on
Vista/Win7 (to be tested) (http://forum.videolan.org/viewtopic.php?f=15&t=68891)
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=4ad06d105245706d12932f3391584ee5f5bbf5ea
---
modules/gui/skins2/src/generic_layout.cpp | 126 ---------------------------
modules/gui/skins2/src/generic_layout.hpp | 3 -
modules/gui/skins2/src/top_window.cpp | 18 ----
modules/gui/skins2/src/top_window.hpp | 1 -
modules/gui/skins2/win32/win32_graphics.cpp | 2 +-
modules/gui/skins2/win32/win32_tooltip.cpp | 2 +-
6 files changed, 2 insertions(+), 150 deletions(-)
diff --git a/modules/gui/skins2/src/generic_layout.cpp b/modules/gui/skins2/src/generic_layout.cpp
index 217d3b0..731d8dd 100644
--- a/modules/gui/skins2/src/generic_layout.cpp
+++ b/modules/gui/skins2/src/generic_layout.cpp
@@ -247,134 +247,8 @@ void GenericLayout::refreshRect( int x, int y, int width, int height )
if( y + height > m_rect.getHeight() )
height = m_rect.getHeight() - y;
- computeRefresh( x, y, width, height );
- }
-}
-
-class rect
-{
-public:
- rect( int v_x = 0, int v_y = 0, int v_width = 0, int v_height = 0 )
- : x( v_x ), y( v_y ), width( v_width ), height( v_height ) { }
- ~rect() { }
- int x;
- int y;
- int width;
- int height;
-
- static bool isIncluded( rect& rect2, rect& rect1 )
- {
- int x1 = rect1.x;
- int y1 = rect1.y;
- int w1 = rect1.width;
- int h1 = rect1.height;
-
- int x2 = rect2.x;
- int y2 = rect2.y;
- int w2 = rect2.width;
- int h2 = rect2.height;
-
- return x2 >= x1 && x2 < x1 + w1
- && y2 >= y1 && y2 < y1 + h1
- && w2 <= w1
- && h2 <= h1;
- }
-};
-
-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;
-
- set<int> x_set;
- set<int> y_set;
- vector<rect> rect_set;
-
- x_set.insert( x + w );
- y_set.insert( y + h );
-
- // retrieve video controls being used
- // and remember their rectangles
- set<CtrlVideo*>::const_iterator it;
- for( it = m_pVideoCtrlSet.begin(); it != m_pVideoCtrlSet.end(); it++ )
- {
- if( (*it)->isUsed() )
- {
- int xx = (*it)->getPosition()->getLeft();
- int yy = (*it)->getPosition()->getTop();
- int ww = (*it)->getPosition()->getWidth();
- int hh = (*it)->getPosition()->getHeight();
-
- rect r(xx, yy, ww, hh );
- rect_set.push_back( r );
-
- if( xx > x && xx < x + w )
- x_set.insert( xx );
- if( xx + ww > x && xx + ww < x + w )
- x_set.insert( xx + ww );
- if( yy > y && yy < y + h )
- y_set.insert( yy );
- if( yy + hh > y && yy + hh < y + h )
- y_set.insert( yy + hh );
- }
- }
-
- // for each subregion, test whether they are part
- // of the video control(s) or not
- set<int>::const_iterator it_x;
- set<int>::const_iterator it_y;
- int x_prev, y_prev;
-
- for( x_prev = x, it_x = x_set.begin();
- it_x != x_set.end(); x_prev = *it_x, it_x++ )
- {
- int x0 = x_prev;
- int w0 = *it_x - x_prev;
-
- for( y_prev = y, it_y = y_set.begin();
- it_y != y_set.end(); y_prev = *it_y, it_y++ )
- {
- int y0 = y_prev;
- int h0 = *it_y - y_prev;
-
- rect r( x0, y0, w0, h0 );
- bool b_refresh = true;
-
- vector<rect>::iterator it;
- for( it = rect_set.begin(); it != rect_set.end(); it++ )
- {
- rect r_ctrl = *it;
- if( rect::isIncluded( r, r_ctrl ) )
- {
- b_refresh = false;
- break;
- }
- }
-
- // subregion is not part of a video control
- // needs to be refreshed
- if( b_refresh )
- pWindow->refresh( x0, y0, w0 ,h0 );
- }
- }
-
-#endif
-
}
diff --git a/modules/gui/skins2/src/generic_layout.hpp b/modules/gui/skins2/src/generic_layout.hpp
index 5b6f46d..a730d19 100644
--- a/modules/gui/skins2/src/generic_layout.hpp
+++ b/modules/gui/skins2/src/generic_layout.hpp
@@ -104,9 +104,6 @@ public:
virtual int getMinHeight() const { return m_minHeight; }
virtual int getMaxHeight() const { return m_maxHeight; }
- /// specific refresh window (if video controls)
- virtual void computeRefresh( int x, int y, int width, int height );
-
/// Resize the layout
virtual void resize( int width, int height );
diff --git a/modules/gui/skins2/src/top_window.cpp b/modules/gui/skins2/src/top_window.cpp
index 1b355eb..c6c7142 100644
--- a/modules/gui/skins2/src/top_window.cpp
+++ b/modules/gui/skins2/src/top_window.cpp
@@ -72,24 +72,6 @@ TopWindow::~TopWindow()
}
-void TopWindow::processEvent( EvtRefresh &rEvtRefresh )
-{
- // We override the behaviour defined in GenericWindow, because we don't
- // want to draw on a video control!
- if( m_pActiveLayout == NULL )
- {
- GenericWindow::processEvent( rEvtRefresh );
- }
- else
- {
- m_pActiveLayout->computeRefresh( rEvtRefresh.getXStart(),
- rEvtRefresh.getYStart(),
- rEvtRefresh.getWidth(),
- rEvtRefresh.getHeight() );
- }
-}
-
-
void TopWindow::processEvent( EvtFocus &rEvtFocus )
{
// fprintf(stderr, rEvtFocus.getAsString().c_str());
diff --git a/modules/gui/skins2/src/top_window.hpp b/modules/gui/skins2/src/top_window.hpp
index 653e415..254bdc7 100644
--- a/modules/gui/skins2/src/top_window.hpp
+++ b/modules/gui/skins2/src/top_window.hpp
@@ -48,7 +48,6 @@ public:
virtual ~TopWindow();
/// Methods to process OS events.
- virtual void processEvent( EvtRefresh &rEvtRefresh );
virtual void processEvent( EvtFocus &rEvtFocus );
virtual void processEvent( EvtMenu &rEvtMenu );
virtual void processEvent( EvtMotion &rEvtMotion );
diff --git a/modules/gui/skins2/win32/win32_graphics.cpp b/modules/gui/skins2/win32/win32_graphics.cpp
index bee4a09..8a6536c 100644
--- a/modules/gui/skins2/win32/win32_graphics.cpp
+++ b/modules/gui/skins2/win32/win32_graphics.cpp
@@ -328,7 +328,7 @@ void Win32Graphics::copyToWindow( OSWindow &rWindow, int xSrc, int ySrc,
{
// Initialize painting
HWND hWnd = ((Win32Window&)rWindow).getHandle();
- HDC wndDC = GetWindowDC( hWnd );
+ HDC wndDC = GetDC( hWnd );
HDC srcDC = m_hDC;
// Draw image on window
diff --git a/modules/gui/skins2/win32/win32_tooltip.cpp b/modules/gui/skins2/win32/win32_tooltip.cpp
index 34d4487..0958584 100644
--- a/modules/gui/skins2/win32/win32_tooltip.cpp
+++ b/modules/gui/skins2/win32/win32_tooltip.cpp
@@ -64,7 +64,7 @@ void Win32Tooltip::show( int left, int top, OSGraphics &rText )
SetWindowPos( m_hWnd, HWND_TOPMOST, left, top, width, height, 0 );
ShowWindow( m_hWnd, SW_SHOW );
- HDC wndDC = GetWindowDC( m_hWnd );
+ HDC wndDC = GetDC( m_hWnd );
BitBlt( wndDC, 0, 0, width, height, srcDC, 0, 0, SRCCOPY );
ReleaseDC( m_hWnd, wndDC );
}
More information about the vlc-devel
mailing list