From cc4bd9bf1cf65663a63bb8ccad04e626bbc4b9cf Mon Sep 17 00:00:00 2001 From: Martin Kiewitz Date: Sun, 25 Apr 2010 16:47:14 +0000 Subject: SCI: changing setFont() call logic inside textedit controls to save 2 setFont() calls svn-id: r48797 --- engines/sci/graphics/controls.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'engines/sci') diff --git a/engines/sci/graphics/controls.cpp b/engines/sci/graphics/controls.cpp index 855147144c..2570b4cb33 100644 --- a/engines/sci/graphics/controls.cpp +++ b/engines/sci/graphics/controls.cpp @@ -210,11 +210,11 @@ void GfxControls::kernelTexteditChange(reg_t controlObject, reg_t eventObject) { GuiResourceId fontId = GET_SEL32V(_segMan, controlObject, SELECTOR(font)); rect = Common::Rect(GET_SEL32V(_segMan, controlObject, SELECTOR(nsLeft)), GET_SEL32V(_segMan, controlObject, SELECTOR(nsTop)), GET_SEL32V(_segMan, controlObject, SELECTOR(nsRight)), GET_SEL32V(_segMan, controlObject, SELECTOR(nsBottom))); + _text16->SetFont(fontId); if (textAddChar) { // We check, if we are really able to add the new char uint16 textWidth = 0; const char *textPtr = text.c_str(); - _text16->SetFont(fontId); while (*textPtr) textWidth += _text16->_font->getCharWidth(*textPtr++); textWidth += _text16->_font->getCharWidth(eventKey); @@ -226,9 +226,8 @@ void GfxControls::kernelTexteditChange(reg_t controlObject, reg_t eventObject) { } texteditCursorErase(); _paint16->eraseRect(rect); - _text16->Box(text.c_str(), 0, rect, SCI_TEXT16_ALIGNMENT_LEFT, fontId); + _text16->Box(text.c_str(), 0, rect, SCI_TEXT16_ALIGNMENT_LEFT, -1); _paint16->bitsShow(rect); - _text16->SetFont(fontId); texteditCursorDraw(rect, text.c_str(), cursorPos); _text16->SetFont(oldFontId); // Write back string -- cgit v1.2.3