[vlc-devel] commit: Fixed overlay in directx regression. (Laurent Aimar )

git version control git at videolan.org
Sun Oct 11 21:18:45 CEST 2009


vlc | branch: master | Laurent Aimar <fenrir at videolan.org> | Sun Oct 11 15:18:08 2009 +0200| [09bb05db572028575d8d19f2614aa9f3c543f5a1] | committer: Laurent Aimar 

Fixed overlay in directx regression.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=09bb05db572028575d8d19f2614aa9f3c543f5a1
---

 modules/video_output/msw/directx.c |    3 ++-
 modules/video_output/msw/events.c  |   19 ++++++++++++++++---
 modules/video_output/msw/events.h  |    1 +
 3 files changed, 19 insertions(+), 4 deletions(-)

diff --git a/modules/video_output/msw/directx.c b/modules/video_output/msw/directx.c
index 7b3b2ea..d70a955 100644
--- a/modules/video_output/msw/directx.c
+++ b/modules/video_output/msw/directx.c
@@ -381,7 +381,7 @@ static int Init( vout_thread_t *p_vout )
     {
         /* If it still didn't work then don't try to use an overlay */
         p_vout->output.i_chroma = i_chroma_backup;
-        p_vout->p_sys->b_using_overlay = 0;
+        p_vout->p_sys->b_using_overlay = false;
         msg_Warn( p_vout, "Could not initialize directx overlay" ) ;
         NewPictureVec( p_vout, p_vout->p_picture );
     }
@@ -397,6 +397,7 @@ static int Init( vout_thread_t *p_vout )
     else
         psz_fallback = VOUT_TITLE " (software RGB DirectX output)";
     EventThreadUpdateTitle( p_vout->p_sys->p_event, psz_fallback );
+    EventThreadUseOverlay( p_vout->p_sys->p_event, p_vout->p_sys->b_using_overlay );
 
     return VLC_SUCCESS;
 }
diff --git a/modules/video_output/msw/events.c b/modules/video_output/msw/events.c
index c64cfda..fdcea54 100644
--- a/modules/video_output/msw/events.c
+++ b/modules/video_output/msw/events.c
@@ -710,13 +710,18 @@ static long FAR PASCAL DirectXEventProc( HWND hwnd, UINT message,
 
     if( hwnd == p_event->hvideownd )
     {
+#ifdef MODULE_NAME_IS_directx
+        vlc_mutex_lock( &p_event->lock );
+        const bool use_overlay = p_event->use_overlay;
+        vlc_mutex_unlock( &p_event->lock );
+#endif
+
         switch( message )
         {
 #ifdef MODULE_NAME_IS_directx
         case WM_ERASEBKGND:
         /* For overlay, we need to erase background */
-            return !p_event->use_overlay ?
-                1 : DefWindowProc(hwnd, message, wParam, lParam);
+            return !use_overlay ? 1 : DefWindowProc(hwnd, message, wParam, lParam);
         case WM_PAINT:
         /*
         ** For overlay, DefWindowProc() will erase dirty regions
@@ -725,7 +730,7 @@ static long FAR PASCAL DirectXEventProc( HWND hwnd, UINT message,
         ** regular interval, therefore dirty regions can be ignored
         ** to minimize repaint.
         */
-            if( !p_event->use_overlay )
+            if( !use_overlay )
             {
                 ValidateRect(hwnd, NULL);
             }
@@ -987,6 +992,14 @@ void EventThreadUpdateWindowPosition( event_thread_t *p_event, bool *pb_changed,
     p_event->wnd_cfg.height = h;
     vlc_mutex_unlock( &p_event->lock );
 }
+
+void EventThreadUseOverlay( event_thread_t *p_event, bool b_used )
+{
+    vlc_mutex_lock( &p_event->lock );
+    p_event->use_overlay = b_used;
+    vlc_mutex_unlock( &p_event->lock );
+}
+
 event_thread_t *EventThreadCreate( vout_thread_t *p_vout, const vout_window_cfg_t *p_wnd_cfg )
 {
      /* Create the Vout EventThread, this thread is created by us to isolate
diff --git a/modules/video_output/msw/events.h b/modules/video_output/msw/events.h
index 5e5204d..4cc1d4e 100644
--- a/modules/video_output/msw/events.h
+++ b/modules/video_output/msw/events.h
@@ -54,3 +54,4 @@ unsigned        EventThreadRetreiveChanges( event_thread_t * );
 int             EventThreadGetWindowStyle( event_thread_t * );
 void            EventThreadUpdateWindowPosition( event_thread_t *, bool *pb_changed,
                                                  int x, int y, int w, int h );
+void            EventThreadUseOverlay( event_thread_t *, bool b_used );




More information about the vlc-devel mailing list