aboutsummaryrefslogtreecommitdiff
path: root/engines/sci
diff options
context:
space:
mode:
authorMartin Kiewitz2010-04-25 16:47:14 +0000
committerMartin Kiewitz2010-04-25 16:47:14 +0000
commitcc4bd9bf1cf65663a63bb8ccad04e626bbc4b9cf (patch)
treeb729ad6ac2e805bd8d3069a6fff3487a236812a0 /engines/sci
parent14ac9b54a029fe4400ee5f6bd70e39e1ff459100 (diff)
downloadscummvm-rg350-cc4bd9bf1cf65663a63bb8ccad04e626bbc4b9cf.tar.gz
scummvm-rg350-cc4bd9bf1cf65663a63bb8ccad04e626bbc4b9cf.tar.bz2
scummvm-rg350-cc4bd9bf1cf65663a63bb8ccad04e626bbc4b9cf.zip
SCI: changing setFont() call logic inside textedit controls to save 2 setFont() calls
svn-id: r48797
Diffstat (limited to 'engines/sci')
-rw-r--r--engines/sci/graphics/controls.cpp5
1 files changed, 2 insertions, 3 deletions
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