From fad77de23486d806f5cc94ae65e0df5953511a73 Mon Sep 17 00:00:00 2001 From: Denis Kasak Date: Fri, 14 Aug 2009 16:12:17 +0000 Subject: Sped up the game during dialogues by not updating every drawn char separately but the whole string at once. Also removed the markDirty parameter from Font::drawChar() since it's not needed anymore. svn-id: r43368 --- engines/draci/font.cpp | 14 +++++++------- engines/draci/font.h | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) (limited to 'engines/draci') diff --git a/engines/draci/font.cpp b/engines/draci/font.cpp index 2a9185e725..093b8d9d17 100644 --- a/engines/draci/font.cpp +++ b/engines/draci/font.cpp @@ -132,7 +132,7 @@ uint8 Font::getCharWidth(uint8 chr) const { * @param ty Vertical offset on the surface */ -void Font::drawChar(Surface *dst, uint8 chr, int tx, int ty, bool markDirty) const { +void Font::drawChar(Surface *dst, uint8 chr, int tx, int ty) const { assert(dst != NULL); assert(tx >= 0); assert(ty >= 0); @@ -189,11 +189,6 @@ void Font::drawChar(Surface *dst, uint8 chr, int tx, int ty, bool markDirty) con // Advance to next row ptr += dst->pitch; } - - if (markDirty) { - Common::Rect r(tx, ty, tx + xPixelsToDraw + 1, ty + yPixelsToDraw); - dst->markDirtyRect(r); - } } /** @@ -248,9 +243,14 @@ void Font::drawString(Surface *dst, const Common::String &str, break; } - drawChar(dst, str[i], curx, cury, markDirty); + drawChar(dst, str[i], curx, cury); curx += getCharWidth(str[i]) + spacing; } + + if (markDirty) { + Common::Rect r(x, y, x + widest, y + getStringHeight(str)); + dst->markDirtyRect(r); + } } /** diff --git a/engines/draci/font.h b/engines/draci/font.h index e81b344af1..5258108add 100644 --- a/engines/draci/font.h +++ b/engines/draci/font.h @@ -61,7 +61,7 @@ public: uint8 getFontHeight() const { return _fontHeight; }; uint8 getMaxCharWidth() const { return _maxCharWidth; }; uint8 getCharWidth(byte chr) const; - void drawChar(Surface *dst, uint8 chr, int tx, int ty, bool markDirty = true) const; + void drawChar(Surface *dst, uint8 chr, int tx, int ty) const; void drawString(Surface *dst, const byte *str, uint len, int x, int y, int spacing, bool markDirty = true) const; -- cgit v1.2.3