summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2018-01-26 18:59:51 +0300
committerGeorge Hazan <ghazan@miranda.im>2018-01-26 18:59:51 +0300
commitfe83051082d1509bd653b718f119f884646d20e5 (patch)
tree4d0214441d96d26cadab85b421e0921d999730b3
parentee89703abd075cacb396d86bfdf7e1dd4ce9d4d1 (diff)
MS_IMG_LOAD replaced with Bitmap_Load where possible
-rw-r--r--plugins/AVS/src/services.cpp2
-rw-r--r--plugins/AvatarHistory/src/AvatarDlg.cpp2
-rw-r--r--plugins/Popup/src/bitmap_funcs.cpp5
-rw-r--r--plugins/SplashScreen/src/bitmap_funcs.cpp2
-rw-r--r--plugins/TabSRMM/src/themes.cpp16
-rw-r--r--plugins/TabSRMM/src/themes.h1
-rw-r--r--plugins/TipperYM/src/options.cpp2
-rw-r--r--protocols/Gadu-Gadu/src/image.cpp5
8 files changed, 12 insertions, 23 deletions
diff --git a/plugins/AVS/src/services.cpp b/plugins/AVS/src/services.cpp
index 1ac14d16dc..a301e3895a 100644
--- a/plugins/AVS/src/services.cpp
+++ b/plugins/AVS/src/services.cpp
@@ -501,7 +501,7 @@ static int InternalSetMyAvatar(char *protocol, wchar_t *szFinalName, SetMyAvatar
}
else {
// Try to open if is not a flash or XML
- hBmp = (HBITMAP)CallService(MS_IMG_LOAD, (WPARAM)szFinalName, IMGL_WCHAR);
+ hBmp = Bitmap_Load(szFinalName);
if (hBmp == nullptr)
return -4;
}
diff --git a/plugins/AvatarHistory/src/AvatarDlg.cpp b/plugins/AvatarHistory/src/AvatarDlg.cpp
index a352efd61b..4bbd6495e5 100644
--- a/plugins/AvatarHistory/src/AvatarDlg.cpp
+++ b/plugins/AvatarHistory/src/AvatarDlg.cpp
@@ -462,7 +462,7 @@ bool UpdateAvatarPic(HWND hwnd)
}
SetDlgItemText(hwnd, IDC_AVATARPATH, le->filename);
- HBITMAP avpic = (HBITMAP)CallService(MS_IMG_LOAD, (WPARAM)le->filename, IMGL_WCHAR);
+ HBITMAP avpic = Bitmap_Load(le->filename);
bool found_image = (avpic != nullptr);
diff --git a/plugins/Popup/src/bitmap_funcs.cpp b/plugins/Popup/src/bitmap_funcs.cpp
index 5a07c757de..b1c5757a4d 100644
--- a/plugins/Popup/src/bitmap_funcs.cpp
+++ b/plugins/Popup/src/bitmap_funcs.cpp
@@ -730,8 +730,7 @@ bool MyBitmap::loadFromFile(const wchar_t *fn)
if (!wcsncmp(fn, L"gradient:", mir_wstrlen(L"gradient:")))
return loadFromFile_gradient(fn);
- SIZE sz;
- HBITMAP hBmpLoaded = (HBITMAP)CallService(MS_IMG_LOAD, (WPARAM)fn, IMGL_WCHAR);
+ HBITMAP hBmpLoaded = Bitmap_Load(fn);
if (!hBmpLoaded)
return false;
@@ -739,6 +738,8 @@ bool MyBitmap::loadFromFile(const wchar_t *fn)
SetBitmapDimensionEx(hBmpLoaded, bm.bmWidth, bm.bmHeight, nullptr);
HDC dcTmp = CreateCompatibleDC(nullptr);
+
+ SIZE sz;
GetBitmapDimensionEx(hBmpLoaded, &sz);
HBITMAP hBmpDcSave = (HBITMAP)SelectObject(dcTmp, hBmpLoaded);
diff --git a/plugins/SplashScreen/src/bitmap_funcs.cpp b/plugins/SplashScreen/src/bitmap_funcs.cpp
index b5d1738832..9918d28790 100644
--- a/plugins/SplashScreen/src/bitmap_funcs.cpp
+++ b/plugins/SplashScreen/src/bitmap_funcs.cpp
@@ -131,7 +131,7 @@ bool MyBitmap::loadFromFile(wchar_t *fn)
{
if (bits) free();
- HBITMAP hBmpLoaded = (HBITMAP)CallService(MS_IMG_LOAD, (WPARAM)fn, IMGL_WCHAR);
+ HBITMAP hBmpLoaded = Bitmap_Load(fn);
if (!hBmpLoaded) {
#ifdef _DEBUG
logMessage(L"MyBitmap::loadFromFile", L"Bitmap load failed");
diff --git a/plugins/TabSRMM/src/themes.cpp b/plugins/TabSRMM/src/themes.cpp
index 81df273536..1b58c8715d 100644
--- a/plugins/TabSRMM/src/themes.cpp
+++ b/plugins/TabSRMM/src/themes.cpp
@@ -752,7 +752,7 @@ static struct
void CImageItem::Create(const wchar_t *szImageFile)
{
- HBITMAP hbm = LoadPNG(szImageFile);
+ HBITMAP hbm = Bitmap_Load(szImageFile);
BITMAP bm;
m_hdc = nullptr;
@@ -997,16 +997,6 @@ void CImageItem::Colorize(HBITMAP hBitmap, BYTE dr, BYTE dg, BYTE db, BYTE alpha
}
/////////////////////////////////////////////////////////////////////////////////////////
-// load PNG image using core service(advaimg)
-
-HBITMAP TSAPI CImageItem::LoadPNG(const wchar_t *szFilename)
-{
- HBITMAP hBitmap = nullptr;
- hBitmap = (HBITMAP)CallService(MS_IMG_LOAD, (WPARAM)szFilename, IMGL_WCHAR);
- return hBitmap;
-}
-
-/////////////////////////////////////////////////////////////////////////////////////////
// set filename and load parameters from the database
// called on:
// ) init
@@ -1675,7 +1665,7 @@ void CSkin::setupAeroSkins()
mir_snwprintf(tszFilename, L"%scustom_unknown.png", tszBasePath);
if (!PathFileExists(tszFilename))
mir_snwprintf(tszFilename, L"%sunknown.png", tszBasePath);
- PluginConfig.g_hbmUnknown = (HBITMAP)CallService(MS_IMG_LOAD, (WPARAM)tszFilename, IMGL_WCHAR);
+ PluginConfig.g_hbmUnknown = Bitmap_Load(tszFilename);
if (PluginConfig.g_hbmUnknown == nullptr) {
HDC dc = GetDC(nullptr);
PluginConfig.g_hbmUnknown = CreateCompatibleBitmap(dc, 20, 20);
@@ -1807,7 +1797,7 @@ void CSkin::setupAeroSkins()
if (!PathFileExists(tszFilename))
mir_snwprintf(tszFilename, L"%stabskin_aero_button.png", tszBasePath);
- hbm = (HBITMAP)CallService(MS_IMG_LOAD, (WPARAM)tszFilename, IMGL_WCHAR);
+ hbm = Bitmap_Load(tszFilename);
CImageItem::Colorize(hbm, GetRValue(m_dwmColorRGB),
GetGValue(m_dwmColorRGB),
diff --git a/plugins/TabSRMM/src/themes.h b/plugins/TabSRMM/src/themes.h
index b21950b1d6..22d61dacf0 100644
--- a/plugins/TabSRMM/src/themes.h
+++ b/plugins/TabSRMM/src/themes.h
@@ -227,7 +227,6 @@ public:
static void TSAPI PreMultiply(HBITMAP hBitmap, int mode);
static void TSAPI SetBitmap32Alpha(HBITMAP hBitmap, BYTE bAlpha = 255);
static void TSAPI Colorize(HBITMAP hBitmap, BYTE dr, BYTE dg, BYTE db, BYTE alpha = 0);
- static HBITMAP TSAPI LoadPNG(const wchar_t *szFilename);
public:
bool m_fValid; // verified item, indicates that all parameters are valid
diff --git a/plugins/TipperYM/src/options.cpp b/plugins/TipperYM/src/options.cpp
index 3b4beff698..f9035502db 100644
--- a/plugins/TipperYM/src/options.cpp
+++ b/plugins/TipperYM/src/options.cpp
@@ -1759,7 +1759,7 @@ INT_PTR CALLBACK DlgProcOptsSkin(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l
if (opt.szPreviewFile[0]) {
HDC hdcMem = CreateCompatibleDC(dis->hDC);
- HBITMAP hbmpPreview = (HBITMAP)CallService(MS_IMG_LOAD, (WPARAM)opt.szPreviewFile, IMGL_WCHAR);
+ HBITMAP hbmpPreview = Bitmap_Load(opt.szPreviewFile);
if (hbmpPreview) {
int iWidth = dis->rcItem.right - dis->rcItem.left;
int iHeight = dis->rcItem.bottom - dis->rcItem.top;
diff --git a/protocols/Gadu-Gadu/src/image.cpp b/protocols/Gadu-Gadu/src/image.cpp
index 7cb803d91d..3056ad8c3c 100644
--- a/protocols/Gadu-Gadu/src/image.cpp
+++ b/protocols/Gadu-Gadu/src/image.cpp
@@ -1066,15 +1066,14 @@ void* GGPROTO::img_loadpicture(gg_event* e, wchar_t *szFileName)
}
// Load image from file
else
- dat->hBitmap = (HBITMAP)CallService(MS_IMG_LOAD, (WPARAM)szFileName, IMGL_WCHAR);
+ dat->hBitmap = Bitmap_Load(szFileName);
// If everything is fine return the handle
if (dat->hBitmap)
return dat;
debugLogA("img_loadpicture(): MS_IMG_LOAD(MEM) failed.");
- if (dat)
- {
+ if (dat) {
free(dat->lpData);
free(dat->lpszFileName);
free(dat);