Alexandre Julliard : oleaut32: Fix rendering of monochrome icons.

Alexandre Julliard julliard at winehq.org
Thu Dec 20 14:25:27 CST 2018


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

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Thu Dec 20 18:33:17 2018 +0100

oleaut32: Fix rendering of monochrome icons.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=46308
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/oleaut32/olepicture.c | 29 +++++++++++------------------
 1 file changed, 11 insertions(+), 18 deletions(-)

diff --git a/dlls/oleaut32/olepicture.c b/dlls/oleaut32/olepicture.c
index 03fd6cf..cee9a7f 100644
--- a/dlls/oleaut32/olepicture.c
+++ b/dlls/oleaut32/olepicture.c
@@ -614,7 +614,6 @@ static void render_masked_bitmap(OLEPictureImpl *This, HDC hdc,
     LONG x, LONG y, LONG cx, LONG cy, OLE_XPOS_HIMETRIC xSrc, OLE_YPOS_HIMETRIC ySrc,
     OLE_XSIZE_HIMETRIC cxSrc, OLE_YSIZE_HIMETRIC cySrc, HBITMAP hbmMask, HBITMAP hbmXor)
 {
-    HBITMAP hbmpOld;
     HDC hdcBmp;
 
     /* Set a mapping mode that maps bitmap pixels into HIMETRIC units.
@@ -630,32 +629,26 @@ static void render_masked_bitmap(OLEPictureImpl *This, HDC hdc,
 
     if (hbmMask)
     {
-        HDC hdcMask = CreateCompatibleDC(0);
-        HBITMAP hOldbm = SelectObject(hdcMask, hbmMask);
-
-        hbmpOld = SelectObject(hdcBmp, hbmXor);
-
-        SetMapMode(hdcMask, MM_ANISOTROPIC);
-        SetWindowOrgEx(hdcMask, 0, 0, NULL);
-        SetWindowExtEx(hdcMask, This->himetricWidth, This->himetricHeight, NULL);
-        SetViewportOrgEx(hdcMask, 0, This->origHeight, NULL);
-        SetViewportExtEx(hdcMask, This->origWidth, -This->origHeight, NULL);
-
         SetBkColor(hdc, RGB(255, 255, 255));
         SetTextColor(hdc, RGB(0, 0, 0));
-        StretchBlt(hdc, x, y, cx, cy, hdcMask, xSrc, ySrc, cxSrc, cySrc, SRCAND);
-        StretchBlt(hdc, x, y, cx, cy, hdcBmp, xSrc, ySrc, cxSrc, cySrc, SRCPAINT);
 
-        SelectObject(hdcMask, hOldbm);
-        DeleteDC(hdcMask);
+        SelectObject(hdcBmp, hbmMask);
+        StretchBlt(hdc, x, y, cx, cy, hdcBmp, xSrc, ySrc, cxSrc, cySrc, SRCAND);
+
+        if (hbmXor)
+        {
+            SelectObject(hdcBmp, hbmXor);
+            StretchBlt(hdc, x, y, cx, cy, hdcBmp, xSrc, ySrc, cxSrc, cySrc, SRCPAINT);
+        }
+        else StretchBlt(hdc, x, y, cx, cy, hdcBmp, xSrc, ySrc - This->himetricHeight,
+                        cxSrc, cySrc, SRCPAINT);
     }
     else
     {
-        hbmpOld = SelectObject(hdcBmp, hbmXor);
+        SelectObject(hdcBmp, hbmXor);
         StretchBlt(hdc, x, y, cx, cy, hdcBmp, xSrc, ySrc, cxSrc, cySrc, SRCCOPY);
     }
 
-    SelectObject(hdcBmp, hbmpOld);
     DeleteDC(hdcBmp);
 }
 




More information about the wine-cvs mailing list