Use non-integer scale that is exact multiple of an available one

Always rounding non-integer scale when upscaling is wrong, as we could
be able to upscale an existing x1.5 image to e.g. 300% DPI scaling with
relatively good results, so only do it if there is no available scale
that exactly divides the requested one.

Add a previously failing unit test which passes now.
This commit is contained in:
Vadim Zeitlin
2022-06-02 01:34:25 +01:00
parent d86c1a8c46
commit 6d5bd15d12
2 changed files with 37 additions and 3 deletions

View File

@@ -301,6 +301,7 @@ TEST_CASE("BitmapBundle::GetPreferredSize", "[bmpbundle]")
CHECK_THAT( BitmapAtScale(b, 3.33), SameAs(3.0, 1.5) );
CHECK_THAT( BitmapAtScale(b, 4.25), SameAs(4.0, 2.0) );
CHECK_THAT( BitmapAtScale(b, 4.50), SameAs(4.5, 1.5) );
CHECK_THAT( BitmapAtScale(b, 5 ), SameAs(5.0, 1.0) );
}