From 006a84db149907d34e8d3e6bbb3a9f360d4282e0 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Tue, 9 Jan 2024 03:10:37 +0100 Subject: [PATCH] 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. --- src/osx/cocoa/utils.mm | 4 ++-- src/osx/core/bitmap.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/osx/cocoa/utils.mm b/src/osx/cocoa/utils.mm index 96cf8cbfc0..b13d85b1b7 100644 --- a/src/osx/cocoa/utils.mm +++ b/src/osx/cocoa/utils.mm @@ -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; diff --git a/src/osx/core/bitmap.cpp b/src/osx/core/bitmap.cpp index 20718d0e13..e2f31c8c76 100644 --- a/src/osx/core/bitmap.cpp +++ b/src/osx/core/bitmap.cpp @@ -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() ;