Upscale the biggest bitmap in the bundle if it's too small

The changes of b20552116c (Allow wxBitmapBundle to specify its preferred
bitmap size, 2021-10-19) resulted in never rescaling the bitmaps in
standard size in high DPI at all, which isn't the right thing to do: by
default, i.e. if just a single bitmap is specified, we should scale it
up as necessary in order to show the UI elements in the correct sizes.
This commit is contained in:
Vadim Zeitlin
2021-10-25 20:22:08 +02:00
parent c119e84370
commit da73be0d77
2 changed files with 14 additions and 2 deletions

View File

@@ -57,6 +57,8 @@ TEST_CASE("BitmapBundle::GetPreferredSize", "[bmpbundle]")
const wxBitmapBundle
b = wxBitmapBundle::FromBitmaps(wxBitmap(normal), wxBitmap(bigger));
// Check that the existing bitmaps are used without scaling for most of the
// typical scaling values.
CHECK( b.GetPreferredSizeAtScale(0 ) == normal );
CHECK( b.GetPreferredSizeAtScale(1 ) == normal );
CHECK( b.GetPreferredSizeAtScale(1.25) == normal );
@@ -65,7 +67,10 @@ TEST_CASE("BitmapBundle::GetPreferredSize", "[bmpbundle]")
CHECK( b.GetPreferredSizeAtScale(1.75) == bigger );
CHECK( b.GetPreferredSizeAtScale(2 ) == bigger );
CHECK( b.GetPreferredSizeAtScale(2.5 ) == bigger );
CHECK( b.GetPreferredSizeAtScale(3 ) == bigger );
// This scale is too big to use any of the existing bitmaps, so they will
// be scaled.
CHECK( b.GetPreferredSizeAtScale(3 ) == 3*normal );
}
#ifdef wxHAS_BITMAP_SCALE_FACTOR