summaryrefslogtreecommitdiff
path: root/plugins/Utils
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2014-12-02 21:55:57 +0000
committerGeorge Hazan <george.hazan@gmail.com>2014-12-02 21:55:57 +0000
commit0ca0de7698b523effaaf6cc9c608e936fa5aaf86 (patch)
tree1e6ce038dc27a1ccddb5e3f863607c83eece2e98 /plugins/Utils
parentaeae01dc50a5adea8fe003c8195540b1f2b2169f (diff)
useless calls of mir_*strlen in DrawText replaced with -1
git-svn-id: http://svn.miranda-ng.org/main/trunk@11223 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Utils')
-rw-r--r--plugins/Utils/mir_smileys.cpp26
1 files changed, 7 insertions, 19 deletions
diff --git a/plugins/Utils/mir_smileys.cpp b/plugins/Utils/mir_smileys.cpp
index 051f30f2fc..8837fa573b 100644
--- a/plugins/Utils/mir_smileys.cpp
+++ b/plugins/Utils/mir_smileys.cpp
@@ -213,54 +213,42 @@ SIZE GetTextSize(HDC hdcMem, const TCHAR *szText, SortedList *plText, UINT uText
{
SIZE text_size;
- if (szText == NULL)
- {
+ if (szText == NULL) {
text_size.cy = 0;
text_size.cx = 0;
}
- else
- {
+ else {
RECT text_rc = {0, 0, 0x7FFFFFFF, 0x7FFFFFFF};
// Always need cy...
- DrawText(hdcMem,szText,mir_tstrlen(szText), &text_rc, DT_CALCRECT | uTextFormat);
+ DrawText(hdcMem, szText, -1, &text_rc, DT_CALCRECT | uTextFormat);
text_size.cy = text_rc.bottom - text_rc.top;
if (plText == NULL)
- {
text_size.cx = text_rc.right - text_rc.left;
- }
- else
- {
+ else {
if ( !(uTextFormat & DT_RESIZE_SMILEYS))
text_size.cy = max(text_size.cy, max_smiley_height);
text_size.cx = 0;
// See each item of list
- for (int i = 0; i < plText->realCount; i++)
- {
+ for (int i = 0; i < plText->realCount; i++) {
TextPiece *piece = (TextPiece *) plText->items[i];
- if (piece->type == TEXT_PIECE_TYPE_TEXT)
- {
+ if (piece->type == TEXT_PIECE_TYPE_TEXT) {
RECT text_rc = {0, 0, 0x7FFFFFFF, 0x7FFFFFFF};
DrawText(hdcMem, &szText[piece->start_pos], piece->len, &text_rc, DT_CALCRECT | uTextFormat);
text_size.cx = text_size.cx + text_rc.right - text_rc.left;
}
- else
- {
+ else {
double factor;
if ((uTextFormat & DT_RESIZE_SMILEYS) && piece->smiley_height > text_size.cy)
- {
factor = text_size.cy / (double) piece->smiley_height;
- }
else
- {
factor = 1;
- }
text_size.cx = text_size.cx + (LONG)(factor * piece->smiley_width);
}