[PATCH 0/1] MR315: 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(a)gmail.com> -- https://gitlab.winehq.org/wine/wine/-/merge_requests/315
From: Jinoh Kang <jinoh.kang.kr(a)gmail.com> Increment pixel pointer for every *pixel*, not every *stride*. Signed-off-by: Jinoh Kang <jinoh.kang.kr(a)gmail.com> --- dlls/windowscodecs/imgfactory.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dlls/windowscodecs/imgfactory.c b/dlls/windowscodecs/imgfactory.c index c7e101e3d62..7a2107098c0 100644 --- a/dlls/windowscodecs/imgfactory.c +++ b/dlls/windowscodecs/imgfactory.c @@ -902,9 +902,9 @@ static HRESULT WINAPI ImagingFactory_CreateBitmapFromHICON(IWICImagingFactory2 * { /* If any pixel has a non-zero alpha, ignore hbmMask */ bits = (DWORD *)buffer; - for (x = 0; x < width && !has_alpha; x++, bits++) + for (x = 0; x < width && !has_alpha; x++) { - for (y = 0; y < height; y++) + for (y = 0; y < height; y++, bits++) { if (*bits & 0xff000000) { -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/315
This didn't initially look right to me because the loop is written in a confusing way. We should always change x in the inner loop. I think it's probably correct but I'd like to see it cleaned up a bit more. Since we don't actually care about the x and y coordinates, I would suggest a single loop over `width * height` pixels. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/315#note_2801
participants (3)
-
Esme Povirk (@madewokherd) -
Jinoh Kang -
Jinoh Kang (@iamahuman)