aboutsummaryrefslogtreecommitdiff
path: root/image/codecs
diff options
context:
space:
mode:
authorBastien Bouclet2019-01-22 15:02:05 +0100
committerBastien Bouclet2019-04-28 07:59:14 +0200
commit0d5d04ca3a5473f24f45112bb40a009679024acc (patch)
treedb509988aed8e0ef0f51052ca5154f771de8edb9 /image/codecs
parent5196ae1cd49b879f0497c5ad863dfa6dfebe61c7 (diff)
downloadscummvm-rg350-0d5d04ca3a5473f24f45112bb40a009679024acc.tar.gz
scummvm-rg350-0d5d04ca3a5473f24f45112bb40a009679024acc.tar.bz2
scummvm-rg350-0d5d04ca3a5473f24f45112bb40a009679024acc.zip
IMAGE: Allow setting the output pixel format to the JPEG decoder
Diffstat (limited to 'image/codecs')
-rw-r--r--image/codecs/mjpeg.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/image/codecs/mjpeg.cpp b/image/codecs/mjpeg.cpp
index 6e7faf1045..c5f815342b 100644
--- a/image/codecs/mjpeg.cpp
+++ b/image/codecs/mjpeg.cpp
@@ -200,6 +200,7 @@ const Graphics::Surface *MJPEGDecoder::decodeFrame(Common::SeekableReadStream &s
Common::MemoryReadStream convertedStream(data, outputSize, DisposeAfterUse::YES);
JPEGDecoder jpeg;
+ jpeg.setOutputPixelFormat(_pixelFormat);
if (!jpeg.loadStream(convertedStream)) {
warning("Failed to decode MJPEG frame");
@@ -211,7 +212,10 @@ const Graphics::Surface *MJPEGDecoder::decodeFrame(Common::SeekableReadStream &s
delete _surface;
}
- _surface = jpeg.getSurface()->convertTo(_pixelFormat);
+ _surface = new Graphics::Surface();
+ _surface->copyFrom(*jpeg.getSurface());
+
+ assert(_surface->format == _pixelFormat);
return _surface;
}