Cleanup in llfontgl, as well as more aggressive bounds checking.

This commit is contained in:
Shyotl
2015-02-15 21:45:33 -06:00
parent 7c636c6c17
commit b7454f5f43
6 changed files with 78 additions and 140 deletions

View File

@@ -3462,12 +3462,12 @@ void LLTextEditor::drawText()
{
const LLFontGL *num_font = LLFontGL::getFontMonospace();
F32 y_top = text_y + ((F32)llmath::llround(num_font->getLineHeight()) / 2);
const LLWString ltext = utf8str_to_wstring(llformat("%*d", UI_TEXTEDITOR_LINE_NUMBER_DIGITS, cur_line_num ));
BOOL is_cur_line = getCurrentLine() == cur_line_num;
const U8 style = is_cur_line ? LLFontGL::BOLD : LLFontGL::NORMAL;
const LLColor4 fg_color = is_cur_line ? mCursorColor : mReadOnlyFgColor;
num_font->render(
ltext, // string to draw
num_font->renderUTF8(
llformat("%*d", UI_TEXTEDITOR_LINE_NUMBER_DIGITS, cur_line_num), // string to draw
0, // begin offset
3., // x
y_top, // y
@@ -3477,7 +3477,8 @@ void LLTextEditor::drawText()
style,
LLFontGL::NO_SHADOW,
S32_MAX, // max chars
UI_TEXTEDITOR_LINE_NUMBER_MARGIN); // max pixels
UI_TEXTEDITOR_LINE_NUMBER_MARGIN,
NULL); // max pixels
}
S32 seg_start = line_start;