diff options
author | Sven Hesse | 2011-01-16 16:41:27 +0000 |
---|---|---|
committer | Sven Hesse | 2011-01-16 16:41:27 +0000 |
commit | 84cda62d1f91899674dc3458b21fa66dbdc2935c (patch) | |
tree | 3d013b16ad29f4758ae623203dd805fd21d6a39c /graphics/video/coktel_decoder.cpp | |
parent | 518e858d85dff6582bb4cadc666e9b5436b6b6ee (diff) | |
download | scummvm-rg350-84cda62d1f91899674dc3458b21fa66dbdc2935c.tar.gz scummvm-rg350-84cda62d1f91899674dc3458b21fa66dbdc2935c.tar.bz2 scummvm-rg350-84cda62d1f91899674dc3458b21fa66dbdc2935c.zip |
VIDEO: Implement internal-codec 24bpp VMDs
svn-id: r55265
Diffstat (limited to 'graphics/video/coktel_decoder.cpp')
-rw-r--r-- | graphics/video/coktel_decoder.cpp | 39 |
1 files changed, 37 insertions, 2 deletions
diff --git a/graphics/video/coktel_decoder.cpp b/graphics/video/coktel_decoder.cpp index 8abb7eb261..dd9f646735 100644 --- a/graphics/video/coktel_decoder.cpp +++ b/graphics/video/coktel_decoder.cpp @@ -2325,8 +2325,43 @@ void VMDDecoder::blit16(const Surface &srcSurf, Common::Rect &rect) { } void VMDDecoder::blit24(const Surface &srcSurf, Common::Rect &rect) { - warning("TODO: blit24"); - return; + rect = Common::Rect(rect.left / 3, rect.top, rect.right / 3, rect.bottom); + + Common::Rect srcRect = rect; + + rect.clip(_surface.w, _surface.h); + + PixelFormat pixelFormat = getPixelFormat(); + + uint16 x = _x; + if (_blitMode == 1) + x /= 9; + + const byte *src = (byte *)srcSurf.pixels + + (srcRect.top * srcSurf.pitch) + srcRect.left * _bytesPerPixel; + byte *dst = (byte *)_surface.pixels + + ((_y + rect.top) * _surface.pitch) + (x + rect.left) * _surface.bytesPerPixel; + + for (int i = 0; i < rect.height(); i++) { + const byte *srcRow = src; + byte *dstRow = dst; + + for (int j = 0; j < rect.width(); j++, srcRow += 3, dstRow += _surface.bytesPerPixel) { + byte r = srcRow[2]; + byte g = srcRow[1]; + byte b = srcRow[0]; + + uint32 c = pixelFormat.RGBToColor(r, g, b); + if ((r == 0) && (g == 0) && (b == 0)) + c = 0; + + if (_surface.bytesPerPixel == 2) + *((uint16 *)dstRow) = (uint16) c; + } + + src += srcSurf .pitch; + dst += _surface.pitch; + } } void VMDDecoder::emptySoundSlice(uint32 size) { |