Jinoh Kang : windowscodecs: Fix non-zero alpha detection in ImagingFactory_CreateBitmapFromHICON.

Alexandre Julliard julliard at winehq.org
Wed Jun 29 16:19:57 CDT 2022


Module: wine
Branch: master
Commit: e6155827e8b72be53fc0fa031347121ed8e73b26
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=e6155827e8b72be53fc0fa031347121ed8e73b26

Author: Jinoh Kang <jinoh.kang.kr at gmail.com>
Date:   Tue Jun 28 22:41:38 2022 +0900

windowscodecs: Fix non-zero alpha detection in ImagingFactory_CreateBitmapFromHICON.

Increment pixel pointer for every *pixel*, not every *stride*.

Signed-off-by: Jinoh Kang <jinoh.kang.kr at gmail.com>

---

 dlls/windowscodecs/imgfactory.c | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/dlls/windowscodecs/imgfactory.c b/dlls/windowscodecs/imgfactory.c
index c7e101e3d62..07f5b53fefd 100644
--- a/dlls/windowscodecs/imgfactory.c
+++ b/dlls/windowscodecs/imgfactory.c
@@ -901,16 +901,14 @@ static HRESULT WINAPI ImagingFactory_CreateBitmapFromHICON(IWICImagingFactory2 *
         if (bm.bmBitsPixel == 32)
         {
             /* If any pixel has a non-zero alpha, ignore hbmMask */
-            bits = (DWORD *)buffer;
-            for (x = 0; x < width && !has_alpha; x++, bits++)
+            DWORD *ptr = (DWORD *)buffer;
+            DWORD *end = ptr + width * height;
+            while (ptr != end)
             {
-                for (y = 0; y < height; y++)
+                if (*ptr++ & 0xff000000)
                 {
-                    if (*bits & 0xff000000)
-                    {
-                        has_alpha = TRUE;
-                        break;
-                    }
+                    has_alpha = TRUE;
+                    break;
                 }
             }
         }




More information about the wine-cvs mailing list