From e7620ecaeb16c16fe62cad2c9bbece945cefb908 Mon Sep 17 00:00:00 2001 From: beru Date: Mon, 20 Jun 2016 14:17:59 +0900 Subject: [PATCH] an update for image::open method : loading icon memory data --- source/paint/image.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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); + } } }