diff options
author | Travis Howell | 2009-10-28 04:57:54 +0000 |
---|---|---|
committer | Travis Howell | 2009-10-28 04:57:54 +0000 |
commit | 4f5a99655caeef5479e42d0472ee3076ae14d59a (patch) | |
tree | 200996afe3bd29bf20889fd614fa6fa0c9b2c119 | |
parent | e75637ec1f77384bd8df9c2887b0b0f7661f6d11 (diff) | |
download | scummvm-rg350-4f5a99655caeef5479e42d0472ee3076ae14d59a.tar.gz scummvm-rg350-4f5a99655caeef5479e42d0472ee3076ae14d59a.tar.bz2 scummvm-rg350-4f5a99655caeef5479e42d0472ee3076ae14d59a.zip |
Fix charset masking for 16bit color games.
svn-id: r45454
-rw-r--r-- | engines/scumm/gfx.cpp | 32 |
1 files changed, 19 insertions, 13 deletions
diff --git a/engines/scumm/gfx.cpp b/engines/scumm/gfx.cpp index 9a141ef610..8fd3b1b17c 100644 --- a/engines/scumm/gfx.cpp +++ b/engines/scumm/gfx.cpp @@ -635,23 +635,29 @@ void ScummEngine::drawStripToScreen(VirtScreen *vs, int x, int width, int top, i #ifdef USE_ARM_GFX_ASM asmDrawStripToScreen(height, width, text, src, _compositeBuf, vs->pitch, width, _textSurface.pitch); #else - // We blit four pixels at a time, for improved performance. - const uint32 *src32 = (const uint32 *)src; - uint32 *dst32 = (uint32 *)_compositeBuf; - - vsPitch >>= 2; - if (_bytesPerPixel == 2) { - // Sprites always seem to be used for subtitles in 16Bit color HE games, and not - // the charset renderer, so charset masking isn't required. - for (int h = height * m; h > 0; --h) { - for (int w = width * m; w > 0; w -= 4) { - *dst32++ = *src32++; - *dst32++ = *src32++; + const byte *srcPtr = (const byte *)src; + const byte *textPtr = (byte *)_textSurface.getBasePtr(x * m, y * m); + byte *dstPtr = _compositeBuf; + + for (int h = 0; h < height * m; ++h) { + for (int w = 0; w < width * m; ++w) { + uint16 tmp = *textPtr++; + if (tmp == CHARSET_MASK_TRANSPARENCY) + tmp = READ_UINT16(srcPtr); + WRITE_UINT16(dstPtr, tmp); dstPtr += 2; + srcPtr += vs->bytesPerPixel; } - src32 += vsPitch; + srcPtr += vsPitch; + textPtr += _textSurface.pitch - width * m; } } else { + // We blit four pixels at a time, for improved performance. + const uint32 *src32 = (const uint32 *)src; + uint32 *dst32 = (uint32 *)_compositeBuf; + + vsPitch >>= 2; + const uint32 *text32 = (const uint32 *)text; const int textPitch = (_textSurface.pitch - width * m) >> 2; for (int h = height * m; h > 0; --h) { |