Move duplicated code to rescale the bitmap to the shared function
This commit is contained in:
@@ -1838,6 +1838,36 @@ bool wxPropertyGrid::IsSmallScreen()
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
// static
|
||||
wxBitmap wxPropertyGrid::RescaleBitmap(const wxBitmap& srcBmp,
|
||||
double scaleX, double scaleY)
|
||||
{
|
||||
int w = wxRound(srcBmp.GetWidth()*scaleX);
|
||||
int h = wxRound(srcBmp.GetHeight()*scaleY);
|
||||
|
||||
#if wxUSE_IMAGE
|
||||
// Here we use high-quality wxImage scaling functions available
|
||||
wxImage img = srcBmp.ConvertToImage();
|
||||
img.Rescale(w, h, wxIMAGE_QUALITY_HIGH);
|
||||
wxBitmap dstBmp(img);
|
||||
#else // !wxUSE_IMAGE
|
||||
wxBitmap dstBmp(w, h, srcBmp.GetDepth());
|
||||
#if defined(__WXMSW__) || defined(__WXOSX__)
|
||||
// wxBitmap::UseAlpha() is used only on wxMSW and wxOSX.
|
||||
dstBmp.UseAlpha(srcBmp.HasAlpha());
|
||||
#endif // __WXMSW__ || __WXOSX__
|
||||
{
|
||||
wxMemoryDC dc(dstBmp);
|
||||
dc.SetUserScale(scaleX, scaleY);
|
||||
dc.DrawBitmap(srcBmp, 0, 0);
|
||||
}
|
||||
#endif // wxUSE_IMAGE/!wxUSE_IMAGE
|
||||
|
||||
return dstBmp;
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
wxPGProperty* wxPropertyGrid::DoGetItemAtY( int y ) const
|
||||
{
|
||||
// Outside?
|
||||
|
Reference in New Issue
Block a user