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
This commit is contained in:
Denis Kasak 2009-08-14 16:12:17 +00:00
parent 87e64d27f7
commit fad77de234
2 changed files with 8 additions and 8 deletions

View File

@ -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);
}
}
/**

View File

@ -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;