Make wxOSX wxBitmap::CopyFromIcon() work as in the other ports

Just use the same object, as wxIcon is the same thing as wxBitmap
anyhow, instead of re-creating another wxBitmap which can be subtly
different from the original one.

Notably, converting an icon with default scale factor of 1 to bitmap
when using a high DPI display resulted in a bitmap with the same
physical size but scale factor of 2, as wxOSXGetImageScaleFactor()
returned 2 in this case, i.e. changed the logical bitmap size.

This couldn't be anything other than a bug, so fix this and, at the same
time, simplify the code and make it consistent with the other ports.
This commit is contained in:
Vadim Zeitlin 2021-10-25 23:28:05 +02:00
parent c119e84370
commit 568411347b

View File

@ -784,7 +784,8 @@ wxBitmapRefData::~wxBitmapRefData()
bool wxBitmap::CopyFromIcon(const wxIcon& icon)
{
return Create( icon.OSXGetImage() );
*this = icon;
return IsOk();
}
wxBitmap::wxBitmap(const char bits[], int the_width, int the_height, int no_bits)