From b6f4e5cf59c231f5c4ad149f8786dec4b6e9e126 Mon Sep 17 00:00:00 2001 From: Artur Wieczorek Date: Sun, 4 Apr 2021 21:08:32 +0200 Subject: [PATCH] Don't use image index to get the size of the image in generic wxImageList The index parameter should be ignored as all images in the list have the same size (see docs). Native wxMSW implementation also works this way. --- src/generic/imaglist.cpp | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/src/generic/imaglist.cpp b/src/generic/imaglist.cpp index b3faf49f2e..d15d20fa33 100644 --- a/src/generic/imaglist.cpp +++ b/src/generic/imaglist.cpp @@ -277,20 +277,12 @@ bool wxGenericImageList::RemoveAll() return true; } -bool wxGenericImageList::GetSize( int index, int &width, int &height ) const +bool wxGenericImageList::GetSize( int WXUNUSED(index), int &width, int &height ) const { - wxASSERT_MSG( m_size != wxSize(0, 0), "Invalid image list" ); + width = m_size.x; + height = m_size.y; - const wxBitmap* bmp = DoGetPtr(index); - if ( !bmp ) - { - width = 0; - height = 0; - return false; - } - - width = bmp->GetScaledWidth(); - height = bmp->GetScaledHeight(); + wxCHECK_MSG( m_size != wxSize(0, 0), false, "Invalid image list" ); return true; }