summaryrefslogtreecommitdiff
path: root/lib/Thumbnail/thumbnail.cpp
diff options
context:
space:
mode:
authorDaniel Wilhelm <daniel@wili.li>2014-04-18 17:23:19 +0200
committerDaniel Wilhelm <daniel@wili.li>2014-04-18 17:23:19 +0200
commit0887aee8c54d0ed51bb2031431e2bcdafebb4c6e (patch)
tree69537ceb9787bb25ac363cc4e6cdaf0804d78363 /lib/Thumbnail/thumbnail.cpp
parent5.12 (diff)
downloadFreeFileSync-0887aee8c54d0ed51bb2031431e2bcdafebb4c6e.tar.gz
FreeFileSync-0887aee8c54d0ed51bb2031431e2bcdafebb4c6e.tar.bz2
FreeFileSync-0887aee8c54d0ed51bb2031431e2bcdafebb4c6e.zip
5.13
Diffstat (limited to 'lib/Thumbnail/thumbnail.cpp')
-rw-r--r--lib/Thumbnail/thumbnail.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/lib/Thumbnail/thumbnail.cpp b/lib/Thumbnail/thumbnail.cpp
index 0c7162b9..284d1093 100644
--- a/lib/Thumbnail/thumbnail.cpp
+++ b/lib/Thumbnail/thumbnail.cpp
@@ -118,8 +118,13 @@ thumb::HICON thumb::getThumbnail(const wchar_t* filename, int requestedSize) //r
&bmpInfo) == 0) //__out LPVOID lpvObject
return nullptr;
- HBITMAP bitmapMask = ::CreateCompatibleBitmap(::GetDC(nullptr), bmpInfo.bmWidth, bmpInfo.bmHeight);
- if (bitmapMask == 0)
+ HDC hDC = ::GetDC(nullptr);
+ if (!hDC)
+ return nullptr;
+ ZEN_ON_SCOPE_EXIT(::ReleaseDC(nullptr, hDC));
+
+ HBITMAP bitmapMask = ::CreateCompatibleBitmap(hDC, bmpInfo.bmWidth, bmpInfo.bmHeight);
+ if (!bitmapMask)
return nullptr;
ZEN_ON_SCOPE_EXIT(::DeleteObject(bitmapMask));
@@ -156,7 +161,7 @@ thumb::HICON thumb::getIconByIndex(int iconIndex, int shilIconType) //return 0 o
::HICON hIcon = nullptr; //perf: 1,5 ms - the dominant block
{
HRESULT hr = imageList->GetIcon(iconIndex, // [in] int i,
- hasAlpha ? ILD_IMAGE : ILD_NORMAL, // [in] UINT flags,
+ (hasAlpha ? ILD_IMAGE : ILD_NORMAL), // [in] UINT flags,
//ILD_IMAGE -> do not draw mask - fixes glitch with ILD_NORMAL where both mask *and* alpha channel are applied, e.g. for ffs_batch and folder icon
//other flags: http://msdn.microsoft.com/en-us/library/windows/desktop/bb775230(v=vs.85).aspx
&hIcon); // [out] HICON *picon
bgstack15