]> git.sesse.net Git - vlc/commitdiff
* skins/win32/win32_graphics.cpp: Fix for alphablending (thanks AsMaX)
authorOlivier Teulière <ipkiss@videolan.org>
Mon, 12 Apr 2004 14:07:57 +0000 (14:07 +0000)
committerOlivier Teulière <ipkiss@videolan.org>
Mon, 12 Apr 2004 14:07:57 +0000 (14:07 +0000)
modules/gui/skins2/win32/win32_graphics.cpp

index 73097daca73c3323917db4684b5a40e0b02d924b..9e2cbe517bcc38f7f0b720e3b4895430a9171d70 100755 (executable)
@@ -136,8 +136,12 @@ void Win32Graphics::drawBitmap( const GenericBitmap &rBitmap,
             uint8_t a = *(pBmpData++);
 
             // Draw the pixel
-           ((UINT32 *)pBits)[x + y * width] =
-                   (a << 24) | (r << 16) | (g << 8) | b;
+            // Note: the colours are multiplied by a/255, because of the
+            // algorithm used by Windows for the AlphaBlending
+            ((UINT32 *)pBits)[x + y * width] =
+                (a << 24) | (((r * a) >> 8) << 16) |
+                            (((g * a) >> 8) << 8) |
+                             ((b * a) >> 8);
 
             if( a > 0 )
             {