summaryrefslogtreecommitdiff
path: root/plugins/TipperYM
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2013-03-04 19:57:39 +0000
committerGeorge Hazan <george.hazan@gmail.com>2013-03-04 19:57:39 +0000
commitcfdcb484e0920e7c4cbd36b413b17d83a106dac6 (patch)
tree81cba6784e0fcc882c90b2057535228bdaba4341 /plugins/TipperYM
parent011c86b22aa67f25d751f731501eaaec9600f44c (diff)
fix for crash in Tipper
git-svn-id: http://svn.miranda-ng.org/main/trunk@3888 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/TipperYM')
-rw-r--r--plugins/TipperYM/src/bitmap_func.cpp4
-rw-r--r--plugins/TipperYM/src/mir_smileys.cpp46
2 files changed, 19 insertions, 31 deletions
diff --git a/plugins/TipperYM/src/bitmap_func.cpp b/plugins/TipperYM/src/bitmap_func.cpp
index 52ab9a2cc9..4e747fb90a 100644
--- a/plugins/TipperYM/src/bitmap_func.cpp
+++ b/plugins/TipperYM/src/bitmap_func.cpp
@@ -479,8 +479,8 @@ void SaveAlpha(LPRECT lpRect)
if (lpRect->left < 0) lpRect->left = 0;
if (lpRect->top < 0) lpRect->top = 0;
- if (lpRect->right > skin.iWidth) lpRect->right = skin.iWidth;
- if (lpRect->bottom > skin.iHeight) lpRect->bottom = skin.iHeight;
+ if (lpRect->right - lpRect->left > skin.iWidth) lpRect->right = lpRect->left + skin.iWidth;
+ if (lpRect->bottom - lpRect->top > skin.iHeight) lpRect->bottom = lpRect->top + skin.iHeight;
int x = lpRect->left;
int y = lpRect->top;
diff --git a/plugins/TipperYM/src/mir_smileys.cpp b/plugins/TipperYM/src/mir_smileys.cpp
index f736bf991c..1a26a370dd 100644
--- a/plugins/TipperYM/src/mir_smileys.cpp
+++ b/plugins/TipperYM/src/mir_smileys.cpp
@@ -73,52 +73,40 @@ void Smileys_FreeParse(SMILEYPARSEINFO parseInfo)
// parseInfo is optional (pass NULL and it will be calculated and deleted inside function
int Smileys_DrawText(HDC hDC, LPCTSTR lpString, int nCount, LPRECT lpRect, UINT uFormat, const char *protocol, SMILEYPARSEINFO parseInfo)
{
- int result;
-
if (nCount == -1)
nCount = (int)lstrlen(lpString);
- if (uFormat & DT_CALCRECT)
- {
+ if (uFormat & DT_CALCRECT) {
SIZE text_size = GetTextSize(hDC, lpString, parseInfo, uFormat, parseInfo->max_height, (lpRect->right - lpRect->left));
lpRect->bottom = text_size.cy;
- if (text_size.cx < lpRect->right - lpRect->left)
- {
+ if (text_size.cx < lpRect->right - lpRect->left) {
if (uFormat & DT_RIGHT)
lpRect->left = lpRect->right - text_size.cx;
else
lpRect->right = lpRect->left + text_size.cx;
}
- result = text_size.cy;
+ return text_size.cy;
}
- else
- {
- // Draw
- if (parseInfo->pieces == NULL)
- {
- result = DrawText(hDC, lpString, nCount, lpRect, uFormat);
- }
- else
- {
- RECT rc = *lpRect;
- SIZE text_size = GetTextSize(hDC, lpString, parseInfo, uFormat, parseInfo->max_height, (lpRect->right - lpRect->left));
- if (text_size.cx < rc.right - rc.left)
- {
- if (uFormat & DT_RIGHT)
- rc.left = rc.right - text_size.cx;
- else
- rc.right = rc.left + text_size.cx;
- }
- result = text_size.cy;
- DrawTextSmiley(hDC, rc, lpString, nCount, parseInfo, uFormat, parseInfo->max_height);
- }
+ // Draw
+ if (parseInfo->pieces == NULL)
+ return DrawText(hDC, lpString, nCount, lpRect, uFormat);
+
+ RECT rc = *lpRect;
+ SIZE text_size = GetTextSize(hDC, lpString, parseInfo, uFormat, parseInfo->max_height, (lpRect->right - lpRect->left));
+
+ if (text_size.cx < rc.right - rc.left) {
+ if (uFormat & DT_RIGHT)
+ rc.left = rc.right - text_size.cx;
+ else
+ rc.right = rc.left + text_size.cx;
}
- return result;
+ DrawTextSmiley(hDC, rc, lpString, nCount, parseInfo, uFormat, parseInfo->max_height);
+ return text_size.cy;
}
SIZE GetTextSize(HDC hdcMem, const TCHAR *szText, SMILEYPARSEINFO info, UINT uTextFormat, int max_smiley_height, int max_width)