Use CreateWithLogicalSize() instead of ...DIPSize() in wxOSX

These functions behave in exactly the same way in this port, but using
CreateWithLogicalSize() seems to be more clear, as we're passing it the
coordinates in logical pixels (e.g. window sizes etc) and not DIPs.

No real changes.
This commit is contained in:
Vadim Zeitlin 2024-01-09 03:10:37 +01:00
parent d254a7d752
commit 006a84db14
2 changed files with 3 additions and 3 deletions

View file

@ -585,7 +585,7 @@ wxBitmap wxWindowDCImpl::DoGetAsBitmap(const wxRect *subrect) const
const wxSize bitmapSize(subrect ? subrect->GetSize() : m_window->GetSize());
wxBitmap bitmap;
bitmap.CreateWithDIPSize(bitmapSize, m_contentScaleFactor);
bitmap.CreateWithLogicalSize(bitmapSize, m_contentScaleFactor);
NSView* view = (NSView*) m_window->GetHandle();
if ( [view isHiddenOrHasHiddenAncestor] == NO )
@ -617,7 +617,7 @@ wxBitmap wxWindowDCImpl::DoGetAsBitmap(const wxRect *subrect) const
CGRect r = CGRectMake( 0 , 0 , CGImageGetWidth(cgImageRef) , CGImageGetHeight(cgImageRef) );
// The bitmap created by wxBitmap::CreateWithDIPSize() above is scaled,
// The bitmap created by wxBitmap::CreateWithLogicalSize() above is scaled,
// so we need to adjust the coordinates for it.
r.size.width /= m_contentScaleFactor;
r.size.height /= m_contentScaleFactor;

View file

@ -973,7 +973,7 @@ wxBitmap wxBitmap::GetSubBitmap(const wxRect &rect) const
wxBitmap ret;
double scale = GetScaleFactor();
ret.CreateWithDIPSize( rect.GetSize(), scale, GetDepth() );
ret.CreateWithLogicalSize( rect.GetSize(), scale, GetDepth() );
wxASSERT_MSG( ret.IsOk(), wxT("GetSubBitmap error") );
if ( HasAlpha() )
ret.UseAlpha() ;