From 0ca0de7698b523effaaf6cc9c608e936fa5aaf86 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Tue, 2 Dec 2014 21:55:57 +0000 Subject: 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 --- plugins/Utils/mir_smileys.cpp | 26 +++++++------------------- 1 file changed, 7 insertions(+), 19 deletions(-) (limited to 'plugins/Utils') 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); } -- cgit v1.2.3