diff options
author | MikalaiR <nikolay.romanovich@narod.ru> | 2015-12-29 19:59:31 +0000 |
---|---|---|
committer | MikalaiR <nikolay.romanovich@narod.ru> | 2015-12-29 19:59:31 +0000 |
commit | 544fb33475eb7ea1735f9e19f78dcf3c5e1ceb66 (patch) | |
tree | 9bcf88888f81aeb7e17ad20d9e7fd6fefa684725 /plugins/Toaster/src/images.h | |
parent | 99034f294331209fbfa1d5efacf7fb25f88e227d (diff) |
Toaster: memleaks fix, code clenup
git-svn-id: http://svn.miranda-ng.org/main/trunk@15967 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Toaster/src/images.h')
-rw-r--r-- | plugins/Toaster/src/images.h | 65 |
1 files changed, 0 insertions, 65 deletions
diff --git a/plugins/Toaster/src/images.h b/plugins/Toaster/src/images.h deleted file mode 100644 index 01b05720d1..0000000000 --- a/plugins/Toaster/src/images.h +++ /dev/null @@ -1,65 +0,0 @@ -extern wchar_t wszTempDir[];
-
-class ToasterImage
-{
- HBITMAP _hBitmap;
- ptrT tszId;
-
-public:
- __inline explicit ToasterImage(HICON hIcon) : _hBitmap(NULL), tszId(CMString(FORMAT, _T("%p"), hIcon).Detach())
- {
- ICONINFO icon = { 0 };
- if (GetIconInfo(hIcon, &icon))
- {
- _hBitmap = icon.hbmColor;
- DeleteObject(icon.hbmMask);
- }
- }
-
- __inline explicit ToasterImage(HBITMAP bmp) : _hBitmap(bmp), tszId(CMString(FORMAT, _T("%p"), bmp).Detach())
- {
- }
-
- __inline explicit ToasterImage(const char *szProto) : _hBitmap(NULL), tszId(mir_a2t(szProto))
- {
- ICONINFO icon = { 0 };
- if (GetIconInfo(Skin_LoadProtoIcon(szProto, ID_STATUS_ONLINE, 1), &icon))
- {
- _hBitmap = icon.hbmColor;
- DeleteObject(icon.hbmMask);
- }
- }
-
- __inline ~ToasterImage()
- {
- DeleteObject(_hBitmap);
- }
-
- wchar_t* Save()
- {
- wchar_t wszSavePath[MAX_PATH];
- mir_snwprintf(wszSavePath, L"%s\\MirandaToaster.%s.png", wszTempDir, tszId);
-
- if (!(GetFileAttributes(wszSavePath) < 0xFFFFFFF))
- {
- IMGSRVC_INFO isi = { sizeof(isi) };
- isi.wszName = mir_wstrdup(wszSavePath);
- isi.hbm = _hBitmap;
- isi.dwMask = IMGI_HBITMAP;
- isi.fif = FREE_IMAGE_FORMAT::FIF_PNG;
- __try
- {
- CallService(MS_IMG_SAVE, (WPARAM)&isi, IMGL_WCHAR);
- }
- __except (EXCEPTION_EXECUTE_HANDLER)
- {
- return nullptr;
- }
- }
- return mir_wstrdup(wszSavePath);
- }
-
- __inline operator wchar_t*()
- { return Save();
- }
-};
\ No newline at end of file |