]> git.saurik.com Git - wxWidgets.git/commitdiff
Fixed handling of transparent background in borderless wxBitmapButton (patch #1477883)
authorVáclav Slavík <vslavik@fastmail.fm>
Thu, 24 Apr 2008 23:20:08 +0000 (23:20 +0000)
committerVáclav Slavík <vslavik@fastmail.fm>
Thu, 24 Apr 2008 23:20:08 +0000 (23:20 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@53340 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/mac/carbon/bmpbuttn.cpp

index aae979a8620fbad6519987b5c51791098e932f82..5757f50b845b2d53d27771ddaa4418e4039af97d 100644 (file)
@@ -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