]> git.sesse.net Git - vlc/commitdiff
Fixed overlay in directx regression.
authorLaurent Aimar <fenrir@videolan.org>
Sun, 11 Oct 2009 13:18:08 +0000 (15:18 +0200)
committerLaurent Aimar <fenrir@videolan.org>
Sun, 11 Oct 2009 17:33:45 +0000 (19:33 +0200)
modules/video_output/msw/directx.c
modules/video_output/msw/events.c
modules/video_output/msw/events.h

index 7b3b2ea896e2733cbf813ba2a98e2c554ee10348..d70a95580c7133e312412608da0bbcc46827dd3d 100644 (file)
@@ -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;
 }
index c64cfda061898b52c11a56f09b45dd45d9c067d7..fdcea54b7e8175c076dda2c00049714d6bb9d265 100644 (file)
@@ -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
index 5e5204d3ef351e79456fc38f36dfda2a5a4390b0..4cc1d4ee18d3bfabc27c1675ba22ad562ed499ab 100644 (file)
@@ -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 );