summaryrefslogtreecommitdiff
path: root/plugins/Toaster/src/utils.h
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/Toaster/src/utils.h')
-rw-r--r--plugins/Toaster/src/utils.h28
1 files changed, 9 insertions, 19 deletions
diff --git a/plugins/Toaster/src/utils.h b/plugins/Toaster/src/utils.h
index 2aa4802b8c..524a96730e 100644
--- a/plugins/Toaster/src/utils.h
+++ b/plugins/Toaster/src/utils.h
@@ -14,22 +14,19 @@ public:
__inline explicit ToasterImage(HICON hIcon) : _hBitmap(NULL), tszId(CMStringW(FORMAT, L"%p", hIcon).Detach())
{
ICONINFO icon = { 0 };
- if (GetIconInfo(hIcon, &icon))
- {
+ if (GetIconInfo(hIcon, &icon)) {
_hBitmap = icon.hbmColor;
DeleteObject(icon.hbmMask);
}
}
__inline explicit ToasterImage(HBITMAP bmp) : _hBitmap(bmp), tszId(CMStringW(FORMAT, L"%p", bmp).Detach())
- {
- }
+ {}
__inline explicit ToasterImage(const char *szProto) : _hBitmap(NULL), tszId(mir_a2u(szProto))
{
ICONINFO icon = { 0 };
- if (GetIconInfo(Skin_LoadProtoIcon(szProto, ID_STATUS_ONLINE, 1), &icon))
- {
+ if (GetIconInfo(Skin_LoadProtoIcon(szProto, ID_STATUS_ONLINE, 1), &icon)) {
_hBitmap = icon.hbmColor;
DeleteObject(icon.hbmMask);
}
@@ -45,26 +42,19 @@ public:
wchar_t wszSavePath[MAX_PATH];
mir_snwprintf(wszSavePath, L"%s\\MirandaToaster.%s.png", wszTempDir, tszId);
- if (!(GetFileAttributes(wszSavePath) < 0xFFFFFFF))
- {
+ if (!(GetFileAttributes(wszSavePath) < 0xFFFFFFF)) {
IMGSRVC_INFO isi = { sizeof(isi) };
- isi.wszName = mir_wstrdup(wszSavePath);
+ isi.szName.w = 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;
- }
+ Image_Save(&isi, IMGL_WCHAR);
}
return mir_wstrdup(wszSavePath);
}
__inline operator wchar_t*()
- { return Save();
+ {
+ return Save();
}
-}; \ No newline at end of file
+};