wxBitmap::UseAlpha can be used only on wxMSW and wxOSX.

This method is not implemented on all ports.
This commit is contained in:
Artur Wieczorek
2016-02-25 22:56:47 +01:00
parent 85bad08373
commit 3cc8b4ae37
2 changed files with 9 additions and 3 deletions

View File

@@ -223,7 +223,10 @@ void wxArtProvider::RescaleBitmap(wxBitmap& bmp, const wxSize& sizeNeeded)
#else // !wxUSE_IMAGE #else // !wxUSE_IMAGE
// Fallback method of scaling the bitmap // Fallback method of scaling the bitmap
wxBitmap newBmp(sizeNeeded); wxBitmap newBmp(sizeNeeded);
#if defined(__WXMSW__) || defined(__WXOSX__)
// wxBitmap::UseAlpha() is used only on wxMSW and wxOSX.
newBmp.UseAlpha(bmp.HasAlpha()); newBmp.UseAlpha(bmp.HasAlpha());
#endif // __WXMSW__ || __WXOSX__
{ {
wxMemoryDC dc(newBmp); wxMemoryDC dc(newBmp);
double scX = (double)sizeNeeded.GetWidth() / bmp.GetWidth(); double scX = (double)sizeNeeded.GetWidth() / bmp.GetWidth();

View File

@@ -2209,7 +2209,7 @@ void wxPGProperty::SetValueImage( wxBitmap& bmp )
if ( imSz.y != maxSz.y ) if ( imSz.y != maxSz.y )
{ {
#if wxUSE_IMAGE #if wxUSE_IMAGE
// Here we use high-quality wxImage scaling functions available // Here we use high-quality wxImage scaling functions available
wxImage img = bmp.ConvertToImage(); wxImage img = bmp.ConvertToImage();
double scaleY = (double)maxSz.y / (double)imSz.y; double scaleY = (double)maxSz.y / (double)imSz.y;
@@ -2217,17 +2217,20 @@ void wxPGProperty::SetValueImage( wxBitmap& bmp )
wxRound(bmp.GetHeight()*scaleY), wxRound(bmp.GetHeight()*scaleY),
wxIMAGE_QUALITY_HIGH); wxIMAGE_QUALITY_HIGH);
wxBitmap* bmpNew = new wxBitmap(img); wxBitmap* bmpNew = new wxBitmap(img);
#else #else // !wxUSE_IMAGE
// This is the old, deprecated method of scaling the image // This is the old, deprecated method of scaling the image
wxBitmap* bmpNew = new wxBitmap(maxSz.x,maxSz.y,bmp.GetDepth()); wxBitmap* bmpNew = new wxBitmap(maxSz.x,maxSz.y,bmp.GetDepth());
#if defined(__WXMSW__) || defined(__WXOSX__)
// wxBitmap::UseAlpha() is used only on wxMSW and wxOSX.
bmpNew->UseAlpha(bmp.HasAlpha()); bmpNew->UseAlpha(bmp.HasAlpha());
#endif // __WXMSW__ || __WXOSX__
{ {
wxMemoryDC dc(*bmpNew); wxMemoryDC dc(*bmpNew);
double scaleY = (double)maxSz.y / (double)imSz.y; double scaleY = (double)maxSz.y / (double)imSz.y;
dc.SetUserScale(scaleY, scaleY); dc.SetUserScale(scaleY, scaleY);
dc.DrawBitmap(bmp, 0, 0); dc.DrawBitmap(bmp, 0, 0);
} }
#endif #endif // wxUSE_IMAGE/!wxUSE_IMAGE
m_valueBitmap = bmpNew; m_valueBitmap = bmpNew;
} }