diff options
author | Denis Kasak | 2009-06-19 00:09:36 +0000 |
---|---|---|
committer | Denis Kasak | 2009-06-19 00:09:36 +0000 |
commit | 9d0b940af312efe50008ea2ac3f9e28bb3ea7daf (patch) | |
tree | b1dcc940915e5a7ed1582826f5d0d45add0acd29 /engines/draci/font.cpp | |
parent | fc461246cf58329f1de1fcbd848234a26123a668 (diff) | |
download | scummvm-rg350-9d0b940af312efe50008ea2ac3f9e28bb3ea7daf.tar.gz scummvm-rg350-9d0b940af312efe50008ea2ac3f9e28bb3ea7daf.tar.bz2 scummvm-rg350-9d0b940af312efe50008ea2ac3f9e28bb3ea7daf.zip |
Added support for the new Surface class to Font (transparency, marking dirty rectangles).
svn-id: r41656
Diffstat (limited to 'engines/draci/font.cpp')
-rw-r--r-- | engines/draci/font.cpp | 24 |
1 files changed, 8 insertions, 16 deletions
diff --git a/engines/draci/font.cpp b/engines/draci/font.cpp index 87c1cdaaa3..6dc6d7e7f6 100644 --- a/engines/draci/font.cpp +++ b/engines/draci/font.cpp @@ -33,18 +33,6 @@ namespace Draci { const Common::String kFontSmall("Small.fon"); const Common::String kFontBig("Big.fon"); -/** - * Default font colours. They all seem to remain constant except for the - * first one which varies depending on the character speaking. - * kOverFontColour is set to transparent. - * TODO: Find out what kFontColour1 should actually be when the game starts - */ -enum { - kFontColour1 = 2, kFontColour2 = 0, - kFontColour3 = 3, kFontColour4 = 4, - kOverFontColour = 255 -}; - Font::Font() { _fontHeight = 0; @@ -156,7 +144,7 @@ uint8 Font::getCharWidth(uint8 chr) const { * @param ty Vertical offset on the surface */ -void Font::drawChar(Graphics::Surface *dst, uint8 chr, int tx, int ty) const { +void Font::drawChar(Surface *dst, uint8 chr, int tx, int ty) const { assert(dst != NULL); assert(tx >= 0); assert(ty >= 0); @@ -200,13 +188,17 @@ void Font::drawChar(Graphics::Surface *dst, uint8 chr, int tx, int ty) const { break; } - // Paint pixel - ptr[x] = colour; + // Paint pixel (if not transparent) + if (colour != dst->getTransparentColour()) + ptr[x] = colour; } // Advance to next row ptr += dst->pitch; } + + Common::Rect r(tx, ty, tx + xPixelsToDraw, ty + yPixelsToDraw); + dst->markDirtyRect(r); } /** @@ -219,7 +211,7 @@ void Font::drawChar(Graphics::Surface *dst, uint8 chr, int tx, int ty) const { * @param spacing Space to leave between individual characters. Defaults to 0. */ -void Font::drawString(Graphics::Surface *dst, const Common::String &str, +void Font::drawString(Surface *dst, const Common::String &str, int x, int y, int spacing) const { assert(dst != NULL); assert(x >= 0); |