Fix palette icon scaling on Windows, also extend KiBitmapBundle because we use bundles wrong

wxBitmapBundle assumes the smallest bitmap added is the intended "original" size for a particular use case.
And generally that is probably true. However, we re-use icons in some places where we intend for them to start at 16
or start at 24. This is problematic when GetPreferredBitmapSizeFor is called for calculations because it'll return the
16*scale number instead of 24*scale number. So let's just allow passing in a min height restriction to KiBitmapBundle
for when we reuse bitmaps.
This commit is contained in:
Mark Roszko
2025-01-31 10:37:00 -05:00
parent 636c6c4efb
commit 50e2a12e17
6 changed files with 20 additions and 14 deletions
+3 -3
View File
@@ -336,14 +336,14 @@ void BITMAP_BUTTON::OnPaint( wxPaintEvent& aEvent )
wxPoint drawBmpPos( m_padding, m_padding );
wxBitmap bmpImg;
double scale = KIPLATFORM::UI::GetPixelScaleFactor( this );
double scale = KIPLATFORM::UI::GetContentScaleFactor( this );
wxSize bmSize;
if( m_isToolbarButton )
{
int size = Pgm().GetCommonSettings()->m_Appearance.toolbar_icon_size;
bmSize = wxSize( size, size );
bmpImg = bmp.GetBitmap( bmSize * scale );
bmSize = wxSize( size, size ) * scale;
bmpImg = bmp.GetBitmap( bmSize );
// wxBitmapBundle::GetBitmap thinks we need this rescaled to match the base size
if( bmpImg.IsOk() )