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

@@ -745,6 +745,11 @@ bool wxBitmap::Create(int width, int height, const wxDC& dc)
return false;
}
bool wxBitmap::CreateScaled(int w, int h, int d, double logicalScale)
{
return Create(wxRound(w*logicalScale), wxRound(h*logicalScale), d);
}
bool wxBitmap::DoCreate(int w, int h, int d, WXHDC hdc)
{
UnRef();
@@ -1357,6 +1362,39 @@ bool wxBitmap::InitFromHBITMAP(WXHBITMAP bmp, int width, int height, int depth)
return IsOk();
}
// ----------------------------------------------------------------------------
// scale factor-related functions
// ----------------------------------------------------------------------------
// Note: currently we don't use scale factor at all and don't even store it
// because this seems useless, but we define these functions out of line here
// and not inline in the header to make it possible to change this later
// without breaking ABI if necessary.
void wxBitmap::SetScaleFactor(double WXUNUSED(scale))
{
}
double wxBitmap::GetScaleFactor() const
{
return 1.0;
}
double wxBitmap::GetScaledWidth() const
{
return GetWidth();
}
double wxBitmap::GetScaledHeight() const
{
return GetHeight();
}
wxSize wxBitmap::GetScaledSize() const
{
return GetSize();
}
// ----------------------------------------------------------------------------
// raw bitmap access support
// ----------------------------------------------------------------------------