Add wxBitmap::GetDIPSize() and use it in wxBitmapBundleImplArt

This fixes the problem with wrong standard bitmaps size when using high
DPI for the main monitor with wxMSW, as GetScaledSize() used here since
31f2892200 (Avoid bitmap scaling in wxArtProvider::GetBitmapBundle(),
2021-12-17) was not the right function to use there.

Closes #19331.
This commit is contained in:
Vadim Zeitlin
2022-01-06 19:17:28 +00:00
parent 03cf1f4359
commit 7c7ff3cd42
6 changed files with 37 additions and 2 deletions

View File

@@ -186,10 +186,16 @@ public:
wxSize GetSize() const
{ return wxSize(GetWidth(), GetHeight()); }
// support for scaled bitmaps
// Store or return the scale factor, which determines the ratio between the
// bitmap physical size and its DIP size (on all platforms). By default
// it's just 1.
virtual void SetScaleFactor(double scale);
virtual double GetScaleFactor() const;
// This function returns the size divided by the scale factor, so that a
// 64x64 bitmap with a scale factor of 2 has DIP size of 32x32 everywhere.
wxSize GetDIPSize() const;
// These functions return the corresponding metrics divided by the scale
// factor on platforms with DPI-independent pixels (e.g. GTK, Mac) and just
// the same thing as the non-scaled accessors elsewhere (e.g. MSW).

View File

@@ -188,6 +188,9 @@ public:
virtual void SetScaleFactor(double scale);
virtual double GetScaleFactor() const;
// return the size divided by scale factor
wxSize GetDIPSize() const;
// but scaled metrics accessors return the same thing as non-scaled ones,
// just as in all the other ports without wxHAS_DPI_INDEPENDENT_PIXELS.
double GetScaledWidth() const;