diff options
author | Matthew Hoops | 2011-01-11 20:35:30 +0000 |
---|---|---|
committer | Matthew Hoops | 2011-01-11 20:35:30 +0000 |
commit | 55c0658c8d00568ee4c87fefadd695bc560b01b6 (patch) | |
tree | e466e5db28d9e0000476151d7b9953ff22b56e34 /engines | |
parent | f3f3b3bd62992a058891e22b7feee0109aab937e (diff) | |
download | scummvm-rg350-55c0658c8d00568ee4c87fefadd695bc560b01b6.tar.gz scummvm-rg350-55c0658c8d00568ee4c87fefadd695bc560b01b6.tar.bz2 scummvm-rg350-55c0658c8d00568ee4c87fefadd695bc560b01b6.zip |
MOHAWK: Set the system palette on 8bpp videos when in 8bpp mode
svn-id: r55210
Diffstat (limited to 'engines')
-rw-r--r-- | engines/mohawk/video.cpp | 43 |
1 files changed, 24 insertions, 19 deletions
diff --git a/engines/mohawk/video.cpp b/engines/mohawk/video.cpp index 87fef72773..6abc817128 100644 --- a/engines/mohawk/video.cpp +++ b/engines/mohawk/video.cpp @@ -203,27 +203,32 @@ bool VideoManager::updateBackgroundMovies() { // Convert from 8bpp to the current screen format if necessary Graphics::PixelFormat pixelFormat = _vm->_system->getScreenFormat(); - if (frame->bytesPerPixel == 1 && pixelFormat.bytesPerPixel != 1) { - convertedFrame = new Graphics::Surface(); - const byte *palette = _videoStreams[i]->getPalette(); - assert(palette); - - convertedFrame->create(frame->w, frame->h, pixelFormat.bytesPerPixel); - - for (uint16 j = 0; j < frame->h; j++) { - for (uint16 k = 0; k < frame->w; k++) { - byte palIndex = *((byte *)frame->getBasePtr(k, j)); - byte r = palette[palIndex * 3]; - byte g = palette[palIndex * 3 + 1]; - byte b = palette[palIndex * 3 + 2]; - if (pixelFormat.bytesPerPixel == 2) - *((uint16 *)convertedFrame->getBasePtr(k, j)) = pixelFormat.RGBToColor(r, g, b); - else - *((uint32 *)convertedFrame->getBasePtr(k, j)) = pixelFormat.RGBToColor(r, g, b); + if (frame->bytesPerPixel == 1) { + if (pixelFormat.bytesPerPixel == 1) { + if (_videoStreams[i]->hasDirtyPalette()) + _videoStreams[i]->setSystemPalette(); + } else { + convertedFrame = new Graphics::Surface(); + const byte *palette = _videoStreams[i]->getPalette(); + assert(palette); + + convertedFrame->create(frame->w, frame->h, pixelFormat.bytesPerPixel); + + for (uint16 j = 0; j < frame->h; j++) { + for (uint16 k = 0; k < frame->w; k++) { + byte palIndex = *((byte *)frame->getBasePtr(k, j)); + byte r = palette[palIndex * 3]; + byte g = palette[palIndex * 3 + 1]; + byte b = palette[palIndex * 3 + 2]; + if (pixelFormat.bytesPerPixel == 2) + *((uint16 *)convertedFrame->getBasePtr(k, j)) = pixelFormat.RGBToColor(r, g, b); + else + *((uint32 *)convertedFrame->getBasePtr(k, j)) = pixelFormat.RGBToColor(r, g, b); + } } - } - frame = convertedFrame; + frame = convertedFrame; + } } // Clip the width/height to make sure we stay on the screen (Myst does this a few times) |