]> git.sesse.net Git - vlc/commitdiff
* modules/gui/skins2/win32/*: dynamically load AlphaBlend() as it isn't available...
authorGildas Bazin <gbazin@videolan.org>
Tue, 27 Jan 2004 17:01:51 +0000 (17:01 +0000)
committerGildas Bazin <gbazin@videolan.org>
Tue, 27 Jan 2004 17:01:51 +0000 (17:01 +0000)
   Parent window created outside the screen so it isn't visible.

Could somebody (AsMaX, ipkiss) have a look at the AlphaBlend() function call in win32_graphics.cpp ? I'd like to use the AlphaBlend() we got from win32_factory.cpp.

modules/gui/skins2/win32/win32_factory.cpp
modules/gui/skins2/win32/win32_factory.hpp
modules/gui/skins2/win32/win32_graphics.cpp

index ea0897bd37e7eb481a077772795a217f15fcae60..7427c9332273051c8a238ffaf10d5887a4684e7b 100644 (file)
@@ -2,7 +2,7 @@
  * win32_factory.cpp
  *****************************************************************************
  * Copyright (C) 2003 VideoLAN
- * $Id: win32_factory.cpp,v 1.1 2004/01/03 23:31:34 asmax Exp $
+ * $Id: win32_factory.cpp,v 1.2 2004/01/27 17:01:51 gbazin Exp $
  *
  * Authors: Cyril Deguet     <asmax@via.ecp.fr>
  *          Olivier Teulière <ipkiss@via.ecp.fr>
@@ -79,7 +79,7 @@ LRESULT CALLBACK Win32Proc( HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam )
 
 
 Win32Factory::Win32Factory( intf_thread_t *pIntf ):
-    OSFactory( pIntf ), TransparentBlt( NULL ),
+    OSFactory( pIntf ), TransparentBlt( NULL ), AlphaBlend( NULL ),
     SetLayeredWindowAttributes( NULL )
 {
     // see init()
@@ -124,8 +124,7 @@ bool Win32Factory::init()
 
     // Create Window
     m_hParentWindow = CreateWindowEx( WS_EX_APPWINDOW, "SkinWindowClass",
-        "VLC Media Player", WS_SYSMENU, 0, 0, 0, 0, 0, 0,
-        m_hInst, NULL );
+        "VLC media player", WS_SYSMENU, -200, -200, 0, 0, 0, 0, m_hInst, 0 );
     if( m_hParentWindow == NULL )
     {
         msg_Err( getIntf(), "Cannot create parent window" );
@@ -157,6 +156,15 @@ bool Win32Factory::init()
         msg_Dbg( getIntf(), "Couldn't find TransparentBlt(), "
                  "falling back to BitBlt()" );
     }
+    if( !m_hMsimg32 ||
+        !( AlphaBlend =
+            (BOOL (WINAPI*)( HDC, int, int, int, int, HDC, int, int,
+                              int, int, BLENDFUNCTION ))
+            GetProcAddress( m_hMsimg32, "AlphaBlend" ) ) )
+    {
+        AlphaBlend = NULL;
+        msg_Dbg( getIntf(), "Couldn't find AlphaBlend()" );
+    }
 
     // Idem for user32.dll and SetLayeredWindowAttributes()
     m_hUser32 = LoadLibrary( "user32.dll" );
index 0638f1d4cfff93719298c402aa9e8160730c8b5c..4e74f6efad965b66b3f9dbb166c799437802967f 100644 (file)
@@ -2,7 +2,7 @@
  * win32_factory.hpp
  *****************************************************************************
  * Copyright (C) 2003 VideoLAN
- * $Id: win32_factory.hpp,v 1.1 2004/01/03 23:31:34 asmax Exp $
+ * $Id: win32_factory.hpp,v 1.2 2004/01/27 17:01:51 gbazin Exp $
  *
  * Authors: Cyril Deguet     <asmax@via.ecp.fr>
  *          Olivier Teulière <ipkiss@via.ecp.fr>
@@ -80,10 +80,13 @@ class Win32Factory: public OSFactory
 
 
         /// Functions dynamically loaded from the dll, because they don't exist
-        /// on win9x
+        /// on Win9x/NT4
         // We dynamically load msimg32.dll to get a pointer to TransparentBlt()
         BOOL (WINAPI *TransparentBlt)( HDC, int, int, int, int,
                                        HDC, int, int, int, int, UINT );
+        BOOL (WINAPI *AlphaBlend)( HDC, int, int, int, int, HDC, int, int,
+                                   int, int, BLENDFUNCTION );
+
         // Idem for user32.dll and SetLayeredWindowAttributes()
         BOOL (WINAPI *SetLayeredWindowAttributes)( HWND, COLORREF,
                                                    BYTE, DWORD );
index e4173c0591ee82788d6742fa78cf34a453e2cbbf..c6b87e8e5e595b1308a0ab25024469bd65b2a861 100755 (executable)
@@ -2,7 +2,7 @@
  * win32_graphics.cpp
  *****************************************************************************
  * Copyright (C) 2003 VideoLAN
- * $Id: win32_graphics.cpp,v 1.1 2004/01/03 23:31:34 asmax Exp $
+ * $Id: win32_graphics.cpp,v 1.2 2004/01/27 17:01:51 gbazin Exp $
  *
  * Authors: Cyril Deguet     <asmax@via.ecp.fr>
  *          Olivier Teulière <ipkiss@via.ecp.fr>
@@ -179,14 +179,17 @@ void Win32Graphics::drawBitmap( const GenericBitmap &rBitmap,
     bf.AlphaFormat = AC_SRC_ALPHA;
 
     // Blend the image onto the internal DC
-    if( !AlphaBlend( m_hDC, xDest, yDest, width, height, hDC, 0, 0,
+    if( 1/*AlphaBlend*/ &&
+        !AlphaBlend( m_hDC, xDest, yDest, width, height, hDC, 0, 0,
                      width, height, bf ) )
     {
         msg_Err( getIntf(), "AlphaBlend() failed" );
     }
-
-    // Copy the image onto the internal DC
- //   BitBlt( m_hDC, xDest, yDest, width, height, hDC, 0, 0, SRCCOPY );
+    else if( 1/*!AlphaBlend*/ )
+    {
+        // Copy the image onto the internal DC
+        BitBlt( m_hDC, xDest, yDest, width, height, hDC, 0, 0, SRCCOPY );
+    }
 
     // Add the bitmap mask to the global graphics mask
     CombineRgn( m_mask, m_mask, mask, RGN_OR );