diff --git a/source/paint/image.cpp b/source/paint/image.cpp index a1e2c889..800a9aab 100644 --- a/source/paint/image.cpp +++ b/source/paint/image.cpp @@ -100,7 +100,8 @@ namespace paint { close(); #if defined(NANA_WINDOWS) - HICON handle = ::CreateIconFromResource((PBYTE)data, static_cast(bytes), TRUE, 0x00030000); + // use actual resource size, stopped using CreateIconFromResource since it loads blurry image + HICON handle = ::CreateIconFromResourceEx((PBYTE)data, static_cast(bytes), TRUE, 0x00030000, 0, 0, LR_DEFAULTCOLOR); if(handle) { ICONINFO info; @@ -357,6 +358,10 @@ namespace paint else if (bytes > 9 && (0x66697845 == *reinterpret_cast(reinterpret_cast(data)+5))) //Exif ptr = std::make_shared(); #endif + // suppose icon data is bitmap data + if (!ptr && bytes > 40 /* sizeof(BITMAPINFOHEADER) */ && (40 == *reinterpret_cast(data))) { + ptr = std::make_shared(true); + } } }