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

@@ -177,8 +177,7 @@ public:
virtual bool Create(int width, int height, int depth = wxBITMAP_SCREEN_DEPTH) = 0;
virtual bool Create(const wxSize& sz, int depth = wxBITMAP_SCREEN_DEPTH) = 0;
virtual bool CreateScaled(int w, int h, int d, double logicalScale)
{ return Create(wxRound(w*logicalScale), wxRound(h*logicalScale), d); }
virtual bool CreateScaled(int w, int h, int d, double logicalScale);
virtual int GetHeight() const = 0;
virtual int GetWidth() const = 0;
@@ -188,12 +187,11 @@ public:
{ return wxSize(GetWidth(), GetHeight()); }
// support for scaled bitmaps
virtual void SetScaleFactor(double WXUNUSED(scale)) { }
virtual double GetScaleFactor() const { return 1.0; }
virtual double GetScaledWidth() const { return GetWidth() / GetScaleFactor(); }
virtual double GetScaledHeight() const { return GetHeight() / GetScaleFactor(); }
virtual wxSize GetScaledSize() const
{ return wxSize(wxRound(GetScaledWidth()), wxRound(GetScaledHeight())); }
virtual void SetScaleFactor(double scale);
virtual double GetScaleFactor() const;
virtual double GetScaledWidth() const;
virtual double GetScaledHeight() const;
virtual wxSize GetScaledSize() const;
#if wxUSE_IMAGE
virtual wxImage ConvertToImage() const = 0;