From 6a4b12865aaed86b2cff6aae03406b934cf894ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=A1clav=20Slav=C3=ADk?= Date: Tue, 4 Nov 2014 16:21:13 +0000 Subject: [PATCH] Fix simulated toggle in OS X wxToolBar wiht HiDPI bitmaps Use scaled size and scale factor when creating wxMemoryDC so that the modified output bitmap has same physical dimensions as the source one. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_3_0_BRANCH@78090 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/osx/cocoa/toolbar.mm | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/osx/cocoa/toolbar.mm b/src/osx/cocoa/toolbar.mm index 26494f229b..ca0982db0d 100644 --- a/src/osx/cocoa/toolbar.mm +++ b/src/osx/cocoa/toolbar.mm @@ -563,9 +563,10 @@ void wxToolBarTool::UpdateImages() if ( CanBeToggled() ) { - int w = m_bmpNormal.GetWidth(); - int h = m_bmpNormal.GetHeight(); - m_alternateBitmap = wxBitmap( w, h ); + int w = m_bmpNormal.GetScaledWidth(); + int h = m_bmpNormal.GetScaledHeight(); + m_alternateBitmap = wxBitmap(); + m_alternateBitmap.CreateScaled(w, h, -1, m_bmpNormal.GetScaleFactor()); wxMemoryDC dc; dc.SelectObject(m_alternateBitmap);