summaryrefslogtreecommitdiff
path: root/plugins/Toaster/src
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2018-03-07 23:38:31 +0300
committerGeorge Hazan <ghazan@miranda.im>2018-03-07 23:38:31 +0300
commit777dc2174f34c2a4d4499c3d63ef8914ed9ecb81 (patch)
tree6d7c6c4b09287386739ba4cc7accde38ed90da8c /plugins/Toaster/src
parente9e0d8203c36c1d2e2aa4201e01bf4206804f25b (diff)
old AdvaImg services converted into Image_* functions
Diffstat (limited to 'plugins/Toaster/src')
-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
+};