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:
@@ -193,7 +193,7 @@ private:
|
||||
// necessary, so use GetScaledSize() and not GetSize().
|
||||
const wxBitmap bitmap = wxArtProvider::GetBitmap(id, client);
|
||||
if ( bitmap.IsOk() )
|
||||
return bitmap.GetScaledSize();
|
||||
return bitmap.GetDIPSize();
|
||||
|
||||
// We really need some default size, so just return this hardcoded
|
||||
// value if all else fails -- what else can we do.
|
||||
|
||||
@@ -220,6 +220,11 @@ double wxBitmapBase::GetScaleFactor() const
|
||||
return 1.0;
|
||||
}
|
||||
|
||||
wxSize wxBitmapBase::GetDIPSize() const
|
||||
{
|
||||
return GetSize() / GetScaleFactor();
|
||||
}
|
||||
|
||||
#ifdef wxHAS_DPI_INDEPENDENT_PIXELS
|
||||
|
||||
double wxBitmapBase::GetScaledWidth() const
|
||||
|
||||
@@ -1385,6 +1385,11 @@ double wxBitmap::GetScaleFactor() const
|
||||
return GetBitmapData()->m_scaleFactor;
|
||||
}
|
||||
|
||||
wxSize wxBitmap::GetDIPSize() const
|
||||
{
|
||||
return GetSize() / GetScaleFactor();
|
||||
}
|
||||
|
||||
double wxBitmap::GetScaledWidth() const
|
||||
{
|
||||
return GetWidth();
|
||||
|
||||
Reference in New Issue
Block a user