diff options
Diffstat (limited to 'engines/prince/font.cpp')
-rw-r--r-- | engines/prince/font.cpp | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/engines/prince/font.cpp b/engines/prince/font.cpp index 8c72f1b912..aac790dfe0 100644 --- a/engines/prince/font.cpp +++ b/engines/prince/font.cpp @@ -46,7 +46,6 @@ bool Font::load(Common::SeekableReadStream &stream) { } int Font::getFontHeight() const { - debug("Font::getFontHeight %d", _fontData[5]); return _fontData[5]; } @@ -70,15 +69,20 @@ int Font::getCharWidth(byte chr) const { return getChrData(chr)._width; } -void Font::drawChar(Graphics::Surface *dst, byte chr, int x, int y, uint32 color) const { +void Font::drawChar(Graphics::Surface *dst, byte chr, int posX, int posY, uint32 color) const { const ChrData chrData = getChrData(chr); - const byte *src = chrData._pixels; - byte *target = (byte *)dst->getBasePtr(x, y); - for (int i = 0; i < chrData._height; i++) { - memcpy(target, src, chrData._width); - src += chrData._width; - target += dst->pitch; + for (int y = 0; y < chrData._height; ++y) { + for (int x = 0; x < chrData._width; ++x) { + byte d = chrData._pixels[x + (chrData._width * y)]; + if (d == 0) d = 255; + else if (d == 1) d = 0; + else if (d == 2) d = color; + else if (d == 3) d = 0; + if (d != 255) { + *(byte*)dst->getBasePtr(posX + x, posY + y) = d; + } + } } } |