diff options
author | Bastien Bouclet | 2019-01-22 15:02:05 +0100 |
---|---|---|
committer | Bastien Bouclet | 2019-04-28 07:59:14 +0200 |
commit | 0d5d04ca3a5473f24f45112bb40a009679024acc (patch) | |
tree | db509988aed8e0ef0f51052ca5154f771de8edb9 /engines/titanic/support | |
parent | 5196ae1cd49b879f0497c5ad863dfa6dfebe61c7 (diff) | |
download | scummvm-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 'engines/titanic/support')
-rw-r--r-- | engines/titanic/support/image_decoders.cpp | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/engines/titanic/support/image_decoders.cpp b/engines/titanic/support/image_decoders.cpp index 3819b85116..7c902b2c6d 100644 --- a/engines/titanic/support/image_decoders.cpp +++ b/engines/titanic/support/image_decoders.cpp @@ -20,6 +20,7 @@ * */ +#include "common/system.h" #include "titanic/support/image_decoders.h" namespace Titanic { @@ -29,7 +30,8 @@ void CJPEGDecode::decode(OSVideoSurface &surface, const CString &name) { StdCWadFile file; file.open(name); - // Use the ScucmmVM deoder to decode it + // Use the ScummVM decoder to decode it + setOutputPixelFormat(g_system->getScreenFormat()); loadStream(*file.readStream()); const Graphics::Surface *srcSurf = getSurface(); @@ -38,15 +40,14 @@ void CJPEGDecode::decode(OSVideoSurface &surface, const CString &name) { || surface.getHeight() != srcSurf->h) surface.recreate(srcSurf->w, srcSurf->h, 16); - // Convert the decoded surface to the correct pixel format, and then copy it over + // Copy the decoded surface surface.lock(); - Graphics::Surface *convertedSurface = srcSurf->convertTo(surface._rawSurface->format); - Common::copy((byte *)convertedSurface->getPixels(), (byte *)convertedSurface->getPixels() + + assert(srcSurf->format == surface._rawSurface->format); + + Common::copy((const byte *)srcSurf->getPixels(), (const byte *)srcSurf->getPixels() + surface.getPitch() * surface.getHeight(), (byte *)surface._rawSurface->getPixels()); - convertedSurface->free(); - delete convertedSurface; surface.unlock(); } |