Refactor wxBitmapBundleImplSet::GetPreferredBitmapSizeAtScale()

Extract the logic determining the scale to use in a reusable
DoGetPreferredSize() function to allow reusing it in other places.

There are no real changes here, this commit just moved the existing
code to the new function, but because it also changed it from using
wxSize to double, even git --color-moved doesn't show it as an actual
move.
This commit is contained in:
Vadim Zeitlin 2022-06-01 18:35:44 +01:00
parent 080b0f65cb
commit 78da0eed68
3 changed files with 124 additions and 39 deletions

View file

@ -224,6 +224,14 @@ wxBitmapBundle wxBitmapBundle::FromImage(const wxImage& image)
class WXDLLIMPEXP_CORE wxBitmapBundleImpl : public wxRefCounter
{
protected:
// Standard implementation of GetPreferredBitmapSizeAtScale(): choose the
// scale closest to the given one from the available bitmap scales.
//
// Note that scales *must* be sorted in increasing scale order and there
// must be at least 1 of them.
wxSize
DoGetPreferredSize(double scale, size_t n, const double *availableScales) const;
virtual ~wxBitmapBundleImpl();
public: