In wxPGProperty::SetValueImage(), use wxImage::Rescale() for scaling down the bitmap instead of wx(Memory)DC functions. Results should look much nicer and also retains alpha channel with much less effert.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@67024 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Jaakko Salli 2011-02-25 13:00:57 +00:00
parent 3a4a38c143
commit 28e27c3475

View File

@ -2097,19 +2097,13 @@ void wxPGProperty::SetValueImage( wxBitmap& bmp )
if ( imSz.y != maxSz.y ) if ( imSz.y != maxSz.y )
{ {
// Create a memory DC // Here we use high-quality wxImage scaling functions available
wxBitmap* bmpNew = new wxBitmap(maxSz.x,maxSz.y,bmp.GetDepth()); wxImage img = bmp.ConvertToImage();
wxMemoryDC dc;
dc.SelectObject(*bmpNew);
// Scale
// FIXME: This is ugly - use image or wait for scaling patch.
double scaleY = (double)maxSz.y / (double)imSz.y; double scaleY = (double)maxSz.y / (double)imSz.y;
img.Rescale(((double)bmp.GetWidth())*scaleY,
dc.SetUserScale(scaleY, scaleY); ((double)bmp.GetHeight())*scaleY,
wxIMAGE_QUALITY_HIGH);
dc.DrawBitmap(bmp, 0, 0); wxBitmap* bmpNew = new wxBitmap(img, 32);
m_valueBitmap = bmpNew; m_valueBitmap = bmpNew;
} }