From: Robin Dunn Date: Sat, 29 Jan 2005 01:00:01 +0000 (+0000) Subject: Don't fail assertion about image size mismatch if the size hasn't been X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/b931414d91c7240ae42a67b9fc75e18d93aff721?ds=inline Don't fail assertion about image size mismatch if the size hasn't been set yet. If the size hasn't been set then set it when the first image is added. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@31624 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/generic/imaglist.cpp b/src/generic/imaglist.cpp index 06ab88e919..54e53a6200 100644 --- a/src/generic/imaglist.cpp +++ b/src/generic/imaglist.cpp @@ -73,8 +73,8 @@ bool wxGenericImageList::Create() int wxGenericImageList::Add( const wxBitmap &bitmap ) { - wxASSERT_MSG( bitmap.GetWidth() == m_width && - bitmap.GetHeight() == m_height, + wxASSERT_MSG( (bitmap.GetWidth() == m_width && bitmap.GetHeight() == m_height) + || (m_width == 0 && m_height == 0), _T("invalid bitmap size in wxImageList: this might work ") _T("on this platform but definitely won't under Windows.") ); @@ -82,6 +82,13 @@ int wxGenericImageList::Add( const wxBitmap &bitmap ) m_images.Append( new wxIcon( (const wxIcon&) bitmap ) ); else m_images.Append( new wxBitmap(bitmap) ); + + if (m_width == 0 && m_height == 0) + { + m_width = bitmap.GetWidth(); + m_height = bitmap.GetHeight(); + } + return m_images.GetCount()-1; }