windowscodecs: Fix reading the mask bits in CreateBitmapFromHICON.

Dmitry Timoshkov dmitry at baikal.ru
Mon Jan 14 22:47:47 CST 2013


biHeight has to specify full height of hbmMask, otherwise GetDIBits fails
to read lower half of hbmMask when hbmColor == 0.
---
 dlls/windowscodecs/imgfactory.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/dlls/windowscodecs/imgfactory.c b/dlls/windowscodecs/imgfactory.c
index 8762c81..3e574d5 100644
--- a/dlls/windowscodecs/imgfactory.c
+++ b/dlls/windowscodecs/imgfactory.c
@@ -642,7 +642,7 @@ static HRESULT WINAPI ComponentFactory_CreateBitmapFromHICON(IWICComponentFactor
     memset(&bi, 0, sizeof(bi));
     bi.bmiHeader.biSize = sizeof(bi.bmiHeader);
     bi.bmiHeader.biWidth = width;
-    bi.bmiHeader.biHeight = -height;
+    bi.bmiHeader.biHeight = info.hbmColor ? -height: -height * 2;
     bi.bmiHeader.biPlanes = 1;
     bi.bmiHeader.biBitCount = 32;
     bi.bmiHeader.biCompression = BI_RGB;
@@ -701,8 +701,6 @@ static HRESULT WINAPI ComponentFactory_CreateBitmapFromHICON(IWICComponentFactor
 
                 for (x = 0; x < width; x++, rgba++, bits++)
                 {
-                    if (!info.hbmColor) *rgba = ~*rgba;
-
                     if (*bits)
                         *rgba = 0;
                     else
-- 
1.8.0.2




More information about the wine-patches mailing list