[2/2] winemenubuilder: consider an ICO dimension of 0 to be 256
Damjan Jovanovic
damjan.jov at gmail.com
Tue Sep 14 00:23:35 CDT 2010
Changelog:
* winemenubuilder: consider an ICO dimension of 0 to be 256
This gets winemenubuilder to consider 0x0 (ie. 256x256 or bigger) PNGs
to be bigger than the other (<= 255x255) images, so that the high
quality PNG icons are extracted and used.
Damjan Jovanovic
-------------- next part --------------
diff --git a/programs/winemenubuilder/winemenubuilder.c b/programs/winemenubuilder/winemenubuilder.c
index dcf13ac..9d69823 100644
--- a/programs/winemenubuilder/winemenubuilder.c
+++ b/programs/winemenubuilder/winemenubuilder.c
@@ -305,6 +305,11 @@ static WCHAR* utf8_chars_to_wchars(LPCSTR string)
* FIXME: should not use stdio
*/
+static int ico_dim(int n)
+{
+ return n ? n : 256;
+}
+
static HRESULT convert_to_native_icon(IStream *icoFile, int *indeces, int numIndeces,
const CLSID *outputFormat, const char *outputFileName, LPCWSTR commentW)
{
@@ -683,12 +688,13 @@ static HRESULT write_native_icon(IStream *iconStream, const char *icon_name, LPC
for (i = 0; i < numEntries; i++)
{
- WINE_TRACE("[%d]: %d x %d @ %d\n", i, pIconDirEntry[i].bWidth, pIconDirEntry[i].bHeight, pIconDirEntry[i].wBitCount);
+ WINE_TRACE("[%d]: %d x %d @ %d\n", i, ico_dim(pIconDirEntry[i].bWidth),
+ ico_dim(pIconDirEntry[i].bHeight), pIconDirEntry[i].wBitCount);
if (pIconDirEntry[i].wBitCount >= nMaxBits &&
- (pIconDirEntry[i].bHeight * pIconDirEntry[i].bWidth) >= nMax)
+ (ico_dim(pIconDirEntry[i].bHeight) * ico_dim(pIconDirEntry[i].bWidth)) >= nMax)
{
nIndex = i;
- nMax = pIconDirEntry[i].bHeight * pIconDirEntry[i].bWidth;
+ nMax = ico_dim(pIconDirEntry[i].bHeight) * ico_dim(pIconDirEntry[i].bWidth);
nMaxBits = pIconDirEntry[i].wBitCount;
}
}
More information about the wine-patches
mailing list