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
This commit is contained in:
@@ -190,6 +190,7 @@ wxMac:
|
|||||||
- Fixed cursor for wxBusyCursor and wxContextHelp.
|
- Fixed cursor for wxBusyCursor and wxContextHelp.
|
||||||
- Fixed wxListCtrl to respect items' non-default fonts.
|
- Fixed wxListCtrl to respect items' non-default fonts.
|
||||||
- wxListCtrl::SetColumnWidth() now supports wxLIST_AUTOSIZE.
|
- wxListCtrl::SetColumnWidth() now supports wxLIST_AUTOSIZE.
|
||||||
|
- Fixed handling of transparent background in borderless wxBitmapButton.
|
||||||
|
|
||||||
|
|
||||||
2.8.7
|
2.8.7
|
||||||
|
@@ -14,6 +14,7 @@
|
|||||||
#if wxUSE_BMPBUTTON
|
#if wxUSE_BMPBUTTON
|
||||||
|
|
||||||
#include "wx/bmpbuttn.h"
|
#include "wx/bmpbuttn.h"
|
||||||
|
#include "wx/image.h"
|
||||||
|
|
||||||
#ifndef WX_PRECOMP
|
#ifndef WX_PRECOMP
|
||||||
#include "wx/dcmemory.h"
|
#include "wx/dcmemory.h"
|
||||||
@@ -63,14 +64,12 @@ static wxBitmap wxMakeStdSizeBitmap(const wxBitmap& bitmap)
|
|||||||
wxASSERT_MSG( width <= sizeStd && height <= sizeStd,
|
wxASSERT_MSG( width <= sizeStd && height <= sizeStd,
|
||||||
_T("bitmap shouldn't be cropped") );
|
_T("bitmap shouldn't be cropped") );
|
||||||
|
|
||||||
newBmp.Create(sizeStd, sizeStd);
|
wxImage square_image = bitmap.ConvertToImage();
|
||||||
wxMemoryDC dcMem;
|
newBmp = square_image.Size
|
||||||
dcMem.SelectObject(newBmp);
|
(
|
||||||
dcMem.Clear();
|
wxSize(sizeStd, sizeStd),
|
||||||
|
wxPoint((sizeStd - width)/2, (sizeStd-height)/2)
|
||||||
dcMem.DrawBitmap(bitmap,
|
);
|
||||||
(sizeStd - width)/2, (sizeStd-height)/2,
|
|
||||||
true);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//else: let the system rescale the bitmap
|
//else: let the system rescale the bitmap
|
||||||
|
Reference in New Issue
Block a user