]> git.sesse.net Git - vlc/commitdiff
- directx: optimize WM_PAINT event handling
authorDamien Fouilleul <damienf@videolan.org>
Wed, 25 Apr 2007 16:26:19 +0000 (16:26 +0000)
committerDamien Fouilleul <damienf@videolan.org>
Wed, 25 Apr 2007 16:26:19 +0000 (16:26 +0000)
modules/video_output/directx/events.c

index a2bfe657f9c26846320ccc3ec91c36a947909ac0..720f1a484add87f33b9686a17fc92f6c80f4c694 100644 (file)
@@ -790,7 +790,24 @@ static long FAR PASCAL DirectXEventProc( HWND hwnd, UINT message,
     }
 
     if( hwnd == p_vout->p_sys->hvideownd )
-        return DefWindowProc(hwnd, message, wParam, lParam);
+    {
+        switch( message )
+        {
+        case WM_ERASEBKGND:
+            // erase the background only if a brush is set
+            return ( 0UL == GetClassLong( hwnd, GCL_HBRBACKGROUND) ) ?
+                1 : DefWindowProc(hwnd, message, wParam, lParam);
+        case WM_PAINT:
+            if( 0UL == GetClassLong( hwnd, GCL_HBRBACKGROUND) )
+            {
+                // vout paints the whole area, no need to repaint it
+                ValidateRect(hwnd, NULL);
+            }
+            // fall through
+        default:
+            return DefWindowProc(hwnd, message, wParam, lParam);
+        }
+    }
 
     switch( message )
     {
@@ -842,8 +859,6 @@ static long FAR PASCAL DirectXEventProc( HWND hwnd, UINT message,
     case WM_PAINT:
     case WM_NCPAINT:
     case WM_ERASEBKGND:
-        /* We do not want to relay these messages to the parent window
-         * because we rely on the background color for the overlay. */
         return DefWindowProc(hwnd, message, wParam, lParam);
 
     default: