]> git.saurik.com Git - wxWidgets.git/commitdiff
In wxPGProperty::SetValueImage(), use wxImage::Rescale() for scaling down the bitmap...
authorJaakko Salli <jaakko.salli@dnainternet.net>
Fri, 25 Feb 2011 13:00:57 +0000 (13:00 +0000)
committerJaakko Salli <jaakko.salli@dnainternet.net>
Fri, 25 Feb 2011 13:00:57 +0000 (13:00 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@67024 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/propgrid/property.cpp

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