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:
@@ -220,6 +220,8 @@ double wxBitmapBase::GetScaleFactor() const
|
||||
return 1.0;
|
||||
}
|
||||
|
||||
#ifdef wxHAS_DPI_INDEPENDENT_PIXELS
|
||||
|
||||
double wxBitmapBase::GetScaledWidth() const
|
||||
{
|
||||
return GetWidth() / GetScaleFactor();
|
||||
@@ -235,6 +237,25 @@ wxSize wxBitmapBase::GetScaledSize() const
|
||||
return wxSize(wxRound(GetScaledWidth()), wxRound(GetScaledHeight()));
|
||||
}
|
||||
|
||||
#else // !wxHAS_DPI_INDEPENDENT_PIXELS
|
||||
|
||||
double wxBitmapBase::GetScaledWidth() const
|
||||
{
|
||||
return GetWidth();
|
||||
}
|
||||
|
||||
double wxBitmapBase::GetScaledHeight() const
|
||||
{
|
||||
return GetHeight();
|
||||
}
|
||||
|
||||
wxSize wxBitmapBase::GetScaledSize() const
|
||||
{
|
||||
return GetSize();
|
||||
}
|
||||
|
||||
#endif // wxHAS_DPI_INDEPENDENT_PIXELS/!wxHAS_DPI_INDEPENDENT_PIXELS
|
||||
|
||||
#endif // wxUSE_BITMAP_BASE
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
@@ -1387,17 +1387,17 @@ double wxBitmap::GetScaleFactor() const
|
||||
|
||||
double wxBitmap::GetScaledWidth() const
|
||||
{
|
||||
return GetWidth() / GetScaleFactor();
|
||||
return GetWidth();
|
||||
}
|
||||
|
||||
double wxBitmap::GetScaledHeight() const
|
||||
{
|
||||
return GetHeight() / GetScaleFactor();
|
||||
return GetHeight();
|
||||
}
|
||||
|
||||
wxSize wxBitmap::GetScaledSize() const
|
||||
{
|
||||
return GetSize() / GetScaleFactor();
|
||||
return GetSize();
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user