From 9990cb50e4726561b6d5c210cb7da83c48c35ec0 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Thu, 14 Feb 2002 22:05:14 +0000 Subject: [PATCH] undid my fix for loading 16x16 icons which results in ugly results when loaing 32x32 ones because LoadImage() scales them badly git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@14220 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/msw/gdiimage.cpp | 28 +++++++++++----------------- 1 file changed, 11 insertions(+), 17 deletions(-) diff --git a/src/msw/gdiimage.cpp b/src/msw/gdiimage.cpp index ba85991599..87fb6add43 100644 --- a/src/msw/gdiimage.cpp +++ b/src/msw/gdiimage.cpp @@ -511,21 +511,21 @@ bool wxICOResourceHandler::LoadIcon(wxIcon *icon, // try to load the icon from this program first to allow overriding the // standard icons (although why one would want to do it considering that // we already have wxApp::GetStdIcon() is unclear) + + // note that we can't just always call LoadImage() because it seems to do + // some icon rescaling internally which results in very ugly 16x16 icons #if defined(__WIN32__) && !defined(__SC__) - if ( !hasSize ) + if ( hasSize ) { - // use the actual size of the resource (as we don't specify - // LR_DEFAULTSIZE) - desiredWidth = - desiredHeight = 0; + hicon = (HICON)::LoadImage(wxGetInstance(), name, IMAGE_ICON, + desiredWidth, desiredHeight, + LR_DEFAULTCOLOR); } - - hicon = (HICON)::LoadImage(wxGetInstance(), name, IMAGE_ICON, - desiredWidth, desiredHeight, - LR_DEFAULTCOLOR); -#else // !Win32 - hicon = ::LoadIcon(wxGetInstance(), name); + else #endif // Win32/!Win32 + { + hicon = ::LoadIcon(wxGetInstance(), name); + } // next check if it's not a standard icon if ( !hicon && !hasSize ) @@ -554,12 +554,6 @@ bool wxICOResourceHandler::LoadIcon(wxIcon *icon, wxSize size = GetHiconSize(hicon); icon->SetSize(size.x, size.y); - // Override the found values with desired values - if ( hasSize ) - { - icon->SetSize(desiredWidth, desiredHeight); - } - icon->SetHICON((WXHICON)hicon); return icon->Ok(); -- 2.45.2