Make wxBitmap::Rescale() less horrible for commonly used icons
Make the results look somewhat better by using wxIMAGE_QUALITY_NEAREST which preserves sharp horizontal and vertical edges in the images which are common in the icons, with which this function is often used, instead of blurring them as wxIMAGE_QUALITY_HIGH does. This is also much (factor of ~40) faster, which shouldn't hurt neither.
This commit is contained in:
@@ -70,8 +70,11 @@ void wxBitmapHelpers::Rescale(wxBitmap& bmp, const wxSize& sizeNeeded)
|
||||
wxCHECK_RET( sizeNeeded.IsFullySpecified(), wxS("New size must be given") );
|
||||
|
||||
#if wxUSE_IMAGE
|
||||
// Note that we use "nearest" rescale mode here to preserve sharp edges in
|
||||
// the icons for which this function is often used. It's also consistent
|
||||
// with what wxDC::DrawBitmap() does, i.e. the fallback method below.
|
||||
wxImage img = bmp.ConvertToImage();
|
||||
img.Rescale(sizeNeeded.x, sizeNeeded.y, wxIMAGE_QUALITY_HIGH);
|
||||
img.Rescale(sizeNeeded.x, sizeNeeded.y, wxIMAGE_QUALITY_NEAREST);
|
||||
bmp = wxBitmap(img);
|
||||
#else // !wxUSE_IMAGE
|
||||
// Fallback method of scaling the bitmap
|
||||
|
||||
Reference in New Issue
Block a user