Only return really scaled bitmap size under platforms using DIPs

wxBitmap::GetScaledXXX() functions are useful for obtaining the
coordinates in logical pixels, so they should only divide by the scaling
factor on the platforms where logical pixels are actually different from
the physical ones, i.e. those using DPI-independent pixels.

This ensures that their behaviour under MSW remains unchanged even after
a1e4dca067 (Store scale factor in wxMSW bitmaps too, 2021-12-16), which
is the correct way to avoid breaking wxAUI (and other) drawing.
This commit is contained in:
Vadim Zeitlin
2022-01-06 18:54:39 +00:00
parent afe3d0ebae
commit f6fbc97c7b
5 changed files with 41 additions and 9 deletions

View File

@@ -609,12 +609,18 @@ public:
/**
Returns the scaled size of the bitmap.
The scaled size of the bitmap is its size in pixels, as returned by
For the platforms using DPI-independent pixels, i.e. those where @c
wxHAS_DPI_INDEPENDENT_PIXELS is defined, such as wxOSX or wxGTK 3,
this function returns the physical size of the bitmap, as returned by
GetSize(), divided by its scale factor, as returned by
GetScaleFactor(), and so is the same as the normal size for bitmaps
with the default scale factor of 1 and always less than the physical
size for the higher resolution bitmaps supposed to be used on high DPI
screens.
GetScaleFactor(), while for the other platforms, it simply returns the
same thing as GetSize().
This ensures that the result of this function is always expressed in
the pixel coordinates appropriate for the current platform, i.e. its
return value is always in logical pixels, used for window and wxDC
coordinates, whether these pixels are the same as physical pixels,
which are returned by GetSize(), or not.
@see GetScaledWidth(), GetScaledHeight(), GetSize()