diff options
| author | Max Horn | 2002-11-05 13:33:34 +0000 |
|---|---|---|
| committer | Max Horn | 2002-11-05 13:33:34 +0000 |
| commit | d0d709627c3ce57b6137be2026d95a01125f97b9 (patch) | |
| tree | 7f7f5ef7dacfdbc065b0ee90911b18cf7bcf3f41 | |
| parent | b165ec698e10696bc7dd13253b4a3a1b1a3aebd0 (diff) | |
| download | scummvm-rg350-d0d709627c3ce57b6137be2026d95a01125f97b9.tar.gz scummvm-rg350-d0d709627c3ce57b6137be2026d95a01125f97b9.tar.bz2 scummvm-rg350-d0d709627c3ce57b6137be2026d95a01125f97b9.zip | |
clip text drawing
svn-id: r5416
| -rw-r--r-- | gui/newgui.cpp | 9 | ||||
| -rw-r--r-- | scumm/dialogs.cpp | 2 |
2 files changed, 8 insertions, 3 deletions
diff --git a/gui/newgui.cpp b/gui/newgui.cpp index ed9d20fb16..d4edecc5a7 100644 --- a/gui/newgui.cpp +++ b/gui/newgui.cpp @@ -432,6 +432,7 @@ int NewGui::getCharWidth(char c) void NewGui::drawString(const String &str, int x, int y, int w, int16 color, int align) { + const int leftX = x, rightX = x + w; int width = getStringWidth(str); if (align == kTextAlignCenter) x = x + (w - width - 1)/2; @@ -439,8 +440,12 @@ void NewGui::drawString(const String &str, int x, int y, int w, int16 color, int x = x + w - width; for (int i = 0; i < str.size(); ++i) { - drawChar(str[i], x, y, color); - x += getCharWidth(str[i]); + w = getCharWidth(str[i]); + if (x+w > rightX) + break; + if (x >= leftX) + drawChar(str[i], x, y, color); + x += w; } } diff --git a/scumm/dialogs.cpp b/scumm/dialogs.cpp index a15f469a4e..092c693b82 100644 --- a/scumm/dialogs.cpp +++ b/scumm/dialogs.cpp @@ -316,7 +316,7 @@ enum { SaveLoadDialog::SaveLoadDialog(NewGui *gui, Scumm *scumm) : ScummDialog(gui, scumm, 30, 20, 260, 124) { - addResText(10, 7, 240, 16, 1); + addResText(0, 7, 260, 16, 1); // addResText(10, 7, 240, 16, 2); // addResText(10, 7, 240, 16, 3); |
