From 987e09dce19572201f147497271cc1fef5919ece Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=A1clav=20Slav=C3=ADk?= Date: Thu, 24 Apr 2008 23:19:36 +0000 Subject: [PATCH] Fixed handling of transparent background in borderless wxBitmapButton (patch #1477883) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@53339 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- docs/changes.txt | 1 + src/mac/carbon/bmpbuttn.cpp | 15 +++++++-------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/docs/changes.txt b/docs/changes.txt index 5a301701e0..009aa9dd60 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -190,6 +190,7 @@ wxMac: - Fixed cursor for wxBusyCursor and wxContextHelp. - Fixed wxListCtrl to respect items' non-default fonts. - wxListCtrl::SetColumnWidth() now supports wxLIST_AUTOSIZE. +- Fixed handling of transparent background in borderless wxBitmapButton. 2.8.7 diff --git a/src/mac/carbon/bmpbuttn.cpp b/src/mac/carbon/bmpbuttn.cpp index cd5d1c5038..ee5ae0e3eb 100644 --- a/src/mac/carbon/bmpbuttn.cpp +++ b/src/mac/carbon/bmpbuttn.cpp @@ -14,6 +14,7 @@ #if wxUSE_BMPBUTTON #include "wx/bmpbuttn.h" +#include "wx/image.h" #ifndef WX_PRECOMP #include "wx/dcmemory.h" @@ -63,14 +64,12 @@ static wxBitmap wxMakeStdSizeBitmap(const wxBitmap& bitmap) wxASSERT_MSG( width <= sizeStd && height <= sizeStd, _T("bitmap shouldn't be cropped") ); - newBmp.Create(sizeStd, sizeStd); - wxMemoryDC dcMem; - dcMem.SelectObject(newBmp); - dcMem.Clear(); - - dcMem.DrawBitmap(bitmap, - (sizeStd - width)/2, (sizeStd-height)/2, - true); + wxImage square_image = bitmap.ConvertToImage(); + newBmp = square_image.Size + ( + wxSize(sizeStd, sizeStd), + wxPoint((sizeStd - width)/2, (sizeStd-height)/2) + ); } } //else: let the system rescale the bitmap