diff options
author | Matthew Hoops | 2011-01-18 16:18:10 +0000 |
---|---|---|
committer | Matthew Hoops | 2011-01-18 16:18:10 +0000 |
commit | 503fdb61470484d952634fc1fab5200371810c3f (patch) | |
tree | 0eaacb8b39485bad12d5dae6ae4bd982a5c4dd89 /graphics/pict.cpp | |
parent | 5da1718beb7bdc1b034e12739be783873fd133df (diff) | |
download | scummvm-rg350-503fdb61470484d952634fc1fab5200371810c3f.tar.gz scummvm-rg350-503fdb61470484d952634fc1fab5200371810c3f.tar.bz2 scummvm-rg350-503fdb61470484d952634fc1fab5200371810c3f.zip |
GRAPHICS: Add a getSurface() function to JPEG to automatically convert to RGB
svn-id: r55301
Diffstat (limited to 'graphics/pict.cpp')
-rw-r--r-- | graphics/pict.cpp | 18 |
1 files changed, 1 insertions, 17 deletions
diff --git a/graphics/pict.cpp b/graphics/pict.cpp index 8525897d4c..95f659c19b 100644 --- a/graphics/pict.cpp +++ b/graphics/pict.cpp @@ -334,23 +334,7 @@ void PictDecoder::decodeCompressedQuickTime(Common::SeekableReadStream *stream) if (!_jpeg->read(jpegStream)) error("PictDecoder::decodeCompressedQuickTime(): Could not decode JPEG data"); - Surface *yComponent = _jpeg->getComponent(1); - Surface *uComponent = _jpeg->getComponent(2); - Surface *vComponent = _jpeg->getComponent(3); - - _outputSurface = new Graphics::Surface(); - _outputSurface->create(yComponent->w, yComponent->h, _pixelFormat.bytesPerPixel); - - for (uint16 i = 0; i < _outputSurface->h; i++) { - for (uint16 j = 0; j < _outputSurface->w; j++) { - byte r = 0, g = 0, b = 0; - YUV2RGB(*((byte *)yComponent->getBasePtr(j, i)), *((byte *)uComponent->getBasePtr(j, i)), *((byte *)vComponent->getBasePtr(j, i)), r, g, b); - if (_pixelFormat.bytesPerPixel == 2) - *((uint16 *)_outputSurface->getBasePtr(j, i)) = _pixelFormat.RGBToColor(r, g, b); - else - *((uint32 *)_outputSurface->getBasePtr(j, i)) = _pixelFormat.RGBToColor(r, g, b); - } - } + _outputSurface = _jpeg->getSurface(_pixelFormat); stream->seek(startPos + dataSize); delete jpegStream; |