Move scale factor-related wxBitmap functions out of line

This will make it possible to change them later without breaking ABI,
which is probably worth paying the price of a function call (assuming
the compiler could de-virtualize this call and inline it before).

No real changes.
This commit is contained in:
Vadim Zeitlin
2021-10-24 19:19:29 +02:00
parent 2c1f4c002d
commit 1056ba19af
4 changed files with 84 additions and 16 deletions

View File

@@ -196,6 +196,39 @@ public:
wxIMPLEMENT_DYNAMIC_CLASS(wxBitmapBaseModule, wxModule);
// ----------------------------------------------------------------------------
// Trivial implementations of scale-factor related functions
// ----------------------------------------------------------------------------
bool wxBitmapBase::CreateScaled(int w, int h, int d, double logicalScale)
{
return Create(wxRound(w*logicalScale), wxRound(h*logicalScale), d);
}
void wxBitmapBase::SetScaleFactor(double WXUNUSED(scale))
{
}
double wxBitmapBase::GetScaleFactor() const
{
return 1.0;
}
double wxBitmapBase::GetScaledWidth() const
{
return GetWidth() / GetScaleFactor();
}
double wxBitmapBase::GetScaledHeight() const
{
return GetHeight() / GetScaleFactor();
}
wxSize wxBitmapBase::GetScaledSize() const
{
return wxSize(wxRound(GetScaledWidth()), wxRound(GetScaledHeight()));
}
#endif // wxUSE_BITMAP_BASE
// ----------------------------------------------------------------------------