Keep toolbar bitmap size in logical, not physical, pixels

As SetToolBitmapSize() takes logical pixels, GetToolBitmapSize() should
also return them for consistency.

Closes #19323.
This commit is contained in:
Vadim Zeitlin 2021-11-20 21:36:08 +01:00
parent 0e4edc4f5f
commit 080a236a01

View File

@ -458,12 +458,22 @@ void wxToolBarBase::AdjustToolBitmapSize()
if ( !bundles.empty() )
{
const wxSize sizePreferred = wxBitmapBundle::GetConsensusSizeFor
(
this,
bundles,
sizeOrig
);
wxSize sizePreferred = wxBitmapBundle::GetConsensusSizeFor
(
this,
bundles,
sizeOrig
);
// This size is supposed to be in logical units for the platforms where
// they differ from physical ones, so convert it.
//
// Note that this could introduce rounding problems but, in fact,
// neither wxGTK nor wxOSX (that are the only ports where contents
// scale factor may be different from 1) use this size at all
// currently, so it shouldn't matter. But if/when they are modified to
// use the size computed here, this would need to be revisited.
sizePreferred /= GetContentScaleFactor();
if ( sizePreferred != sizeOrig )
SetToolBitmapSize(sizePreferred);