Allow loading icons of width 256 from ICO files.

Account for the tweak of ICO file format which uses 0 if the width is 256.

See #15918.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_3_0_BRANCH@76125 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2014-03-12 22:54:32 +00:00
parent b3089993af
commit 5a1c92ea78

View File

@@ -1442,8 +1442,13 @@ bool wxICOHandler::DoLoadFile(wxImage *image, wxInputStream& stream,
alreadySeeked += stream.LastRead();
// ICO file format uses only a single byte for width and if it is 0, it
// means that the width is actually 256 pixels.
const wxUint16
widthReal = pCurrentEntry->bWidth ? pCurrentEntry->bWidth : 256;
// bHeight and bColorCount are wxUint8
if ( pCurrentEntry->bWidth >= wMax )
if ( widthReal >= wMax )
{
// see if we have more colors, ==0 indicates > 8bpp:
if ( pCurrentEntry->bColorCount == 0 )
@@ -1451,7 +1456,7 @@ bool wxICOHandler::DoLoadFile(wxImage *image, wxInputStream& stream,
if ( pCurrentEntry->bColorCount >= colmax )
{
iSel = i;
wMax = pCurrentEntry->bWidth;
wMax = widthReal;
colmax = pCurrentEntry->bColorCount;
}
}