diff options
author | Peter Kohaut | 2019-08-31 23:06:30 +0200 |
---|---|---|
committer | Peter Kohaut | 2019-08-31 23:09:19 +0200 |
commit | a7399c5111cc7ebeea284498a1ee5ac7542bb96d (patch) | |
tree | f89653b084b58ce909d4487a8251338acaf236d0 /engines/bladerunner/font.cpp | |
parent | 6fc73734c12248947ff2214ffd517a32816031c4 (diff) | |
download | scummvm-rg350-a7399c5111cc7ebeea284498a1ee5ac7542bb96d.tar.gz scummvm-rg350-a7399c5111cc7ebeea284498a1ee5ac7542bb96d.tar.bz2 scummvm-rg350-a7399c5111cc7ebeea284498a1ee5ac7542bb96d.zip |
BLADERUNNER: Use best pixel format on every platform
Updated all drawing routines to be pixel format agnostic.
Might decrease performance.
Diffstat (limited to 'engines/bladerunner/font.cpp')
-rw-r--r-- | engines/bladerunner/font.cpp | 19 |
1 files changed, 4 insertions, 15 deletions
diff --git a/engines/bladerunner/font.cpp b/engines/bladerunner/font.cpp index 68e0408585..8ab205eea1 100644 --- a/engines/bladerunner/font.cpp +++ b/engines/bladerunner/font.cpp @@ -92,7 +92,6 @@ void Font::reset() { _screenHeight = 0; _spacing = 0; _useFontColor = false; - _intersperse = 0; _characters.clear(); } @@ -118,13 +117,9 @@ void Font::drawChar(Graphics::Surface *dst, uint32 chr, int x, int y, uint32 col return; } - uint16 *dstPtr = (uint16 *)dst->getBasePtr(CLIP(x + _characters[characterIndex].x, 0, dst->w - 1), CLIP(y + _characters[characterIndex].y, 0, dst->h - 1)); uint16 *srcPtr = &_data[_characters[characterIndex].dataOffset]; int width = _characters[characterIndex].width; int height = _characters[characterIndex].height; - if (_intersperse && y & 1) { - dstPtr += dst->pitch / 2; - } int endY = height + y - 1; int currentY = y; @@ -147,23 +142,17 @@ void Font::drawChar(Graphics::Surface *dst, uint32 chr, int x, int y, uint32 col uint8 a, r, g, b; gameDataPixelFormat().colorToARGB(*srcPtr, a, r, g, b); if (!a) { // Alpha is inversed + uint32 outColor = color; if (_useFontColor) { // Ignore the alpha in the output as it is inversed in the input - *dstPtr = dst->format.RGBToColor(r, g, b); - } else { - *dstPtr = (uint16)color; + outColor = dst->format.RGBToColor(r, g, b); } + void *dstPtr = dst->getBasePtr(CLIP(currentX + _characters[characterIndex].x, 0, dst->w - 1), CLIP(currentY + _characters[characterIndex].y, 0, dst->h - 1)); + drawPixel(*dst, dstPtr, outColor); } - dstPtr++; srcPtr++; currentX++; } - dstPtr += dst->pitch / 2 - width; - if (_intersperse) { - srcPtr += width; - dstPtr += dst->pitch / 2; - currentY++; - } currentY++; } } |