OLEAUT32: fix for icon rendering in OLEPicture
Alex Villacís Lasso
a_villacis at palosanto.com
Tue Aug 17 18:30:01 CDT 2004
From olepicture.c, function OLEPictureImpl_SetBitmap():
/* The width and height are stored in HIMETRIC units (0.01 mm),
so we take our pixel width divide by pixels per inch and
multiply by 25.4 * 100 */
Icon resources should be treated just like bitmaps, and therefore should
get the HIMETRIC transformation.
Otherwise they do not show up properly at render time. This problem is
evident in Visual Basic 6, and probably
in VB-compiled applications with icon resources. This patch adds the
transformation and corrects the problem
in Visual Basic 6.
Changelog:
* Apply HIMETRIC transformation on icons, just like bitmaps
-------------- next part --------------
diff -urN wine-20040813/dlls/oleaut32/olepicture.c wine-20040813-patch/dlls/oleaut32/olepicture.c
--- wine-20040813/dlls/oleaut32/olepicture.c 2004-08-12 18:00:54.000000000 -0500
+++ wine-20040813-patch/dlls/oleaut32/olepicture.c 2004-08-17 17:54:19.000000000 -0500
@@ -1264,6 +1264,7 @@
case 0x0000: { /* ICON , first word is dwReserved */
HICON hicon;
CURSORICONFILEDIR *cifd = (CURSORICONFILEDIR*)xbuf;
+ HDC hdcRef;
int i;
/*
@@ -1309,8 +1310,12 @@
} else {
This->desc.picType = PICTYPE_ICON;
This->desc.u.icon.hicon = hicon;
- This->himetricWidth = cifd->idEntries[i].bWidth;
- This->himetricHeight = cifd->idEntries[i].bHeight;
+ This->origWidth = cifd->idEntries[i].bWidth;
+ This->origHeight = cifd->idEntries[i].bHeight;
+ hdcRef = CreateCompatibleDC(0);
+ This->himetricWidth =(cifd->idEntries[i].bWidth *2540)/GetDeviceCaps(hdcRef, LOGPIXELSX);
+ This->himetricHeight=(cifd->idEntries[i].bHeight*2540)/GetDeviceCaps(hdcRef, LOGPIXELSY);
+ DeleteDC(hdcRef);
hr = S_OK;
}
break;
More information about the wine-patches
mailing list