From d118ca6c5689f8ba4fac2e96b9354e80d9a42627 Mon Sep 17 00:00:00 2001 From: VZ Date: Tue, 30 Oct 2018 09:31:15 +0100 Subject: [PATCH] Remove wxImageList::Add() overload taking wxIcon from wxOSX (#997) This is not necessary as wxIcon is implicitly convertible to wxBitmap anyhow, so calling Add(icon) works using the existing Add(wxBitmap) overload, and is actually harmful because of the wrong icon size check in this function, which used physical bitmap size instead of the logical (scaled) size. Closes #18188. --- include/wx/osx/imaglist.h | 1 - src/osx/imaglist.cpp | 18 ------------------ 2 files changed, 19 deletions(-) diff --git a/include/wx/osx/imaglist.h b/include/wx/osx/imaglist.h index 0173832e75..fdab2447bd 100644 --- a/include/wx/osx/imaglist.h +++ b/include/wx/osx/imaglist.h @@ -32,7 +32,6 @@ public: virtual bool GetSize( int index, int &width, int &height ) const; virtual wxSize GetSize() const { return wxSize(m_width, m_height); } - int Add( const wxIcon& bitmap ); int Add( const wxBitmap& bitmap ); int Add( const wxBitmap& bitmap, const wxBitmap& mask ); int Add( const wxBitmap& bitmap, const wxColour& maskColour ); diff --git a/src/osx/imaglist.cpp b/src/osx/imaglist.cpp index 32f12fb4ee..d487bd8bc6 100644 --- a/src/osx/imaglist.cpp +++ b/src/osx/imaglist.cpp @@ -53,24 +53,6 @@ bool wxImageList::Create() return true; } -int wxImageList::Add( const wxIcon &bitmap ) -{ - wxASSERT_MSG( (bitmap.GetWidth() == m_width && bitmap.GetHeight() == m_height) - || (m_width == 0 && m_height == 0), - wxT("invalid bitmap size in wxImageList: this might work ") - wxT("on this platform but definitely won't under Windows.") ); - - m_images.Append( new wxIcon( bitmap ) ); - - if (m_width == 0 && m_height == 0) - { - m_width = bitmap.GetWidth(); - m_height = bitmap.GetHeight(); - } - - return m_images.GetCount() - 1; -} - int wxImageList::Add( const wxBitmap &bitmap ) { wxASSERT_MSG( (bitmap.GetScaledWidth() >= m_width && bitmap.GetScaledHeight() == m_height)