aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorJohannes Schickel2011-04-17 16:30:02 +0200
committerJohannes Schickel2011-04-17 16:30:02 +0200
commitfedd4d7809f3ef7f9ec446c62bbbf681a87c578e (patch)
tree6a66a64bcef1f2fe232d8abdb63b3c0e1a37d5f6 /engines
parentb6fc71b0c5192aea09a240f84e4c380b52c1710b (diff)
downloadscummvm-rg350-fedd4d7809f3ef7f9ec446c62bbbf681a87c578e.tar.gz
scummvm-rg350-fedd4d7809f3ef7f9ec446c62bbbf681a87c578e.tar.bz2
scummvm-rg350-fedd4d7809f3ef7f9ec446c62bbbf681a87c578e.zip
MOHAWK: Prefer Surface::create taking a PixelFormat over the one taking a byte depth.
Diffstat (limited to 'engines')
-rw-r--r--engines/mohawk/bitmap.cpp8
-rw-r--r--engines/mohawk/graphics.cpp6
-rw-r--r--engines/mohawk/video.cpp2
3 files changed, 10 insertions, 6 deletions
diff --git a/engines/mohawk/bitmap.cpp b/engines/mohawk/bitmap.cpp
index c8111fa91b..63b29053b0 100644
--- a/engines/mohawk/bitmap.cpp
+++ b/engines/mohawk/bitmap.cpp
@@ -135,8 +135,12 @@ Common::Array<MohawkSurface *> MohawkBitmap::decodeImages(Common::SeekableReadSt
Graphics::Surface *MohawkBitmap::createSurface(uint16 width, uint16 height) {
Graphics::Surface *surface = new Graphics::Surface();
- byte bytesPerPixel = (getBitsPerPixel() <= 8) ? 1 : g_system->getScreenFormat().bytesPerPixel;
- surface->create(width, height, bytesPerPixel);
+ Graphics::PixelFormat format;
+ if (getBitsPerPixel() <= 8)
+ format = Graphics::PixelFormat::createFormatCLUT8();
+ else
+ format = g_system->getScreenFormat();
+ surface->create(width, height, format);
return surface;
}
diff --git a/engines/mohawk/graphics.cpp b/engines/mohawk/graphics.cpp
index 81d2b6f019..06dc16b171 100644
--- a/engines/mohawk/graphics.cpp
+++ b/engines/mohawk/graphics.cpp
@@ -77,7 +77,7 @@ void MohawkSurface::convertToTrueColor() {
Graphics::PixelFormat pixelFormat = g_system->getScreenFormat();
Graphics::Surface *surface = new Graphics::Surface();
- surface->create(_surface->w, _surface->h, pixelFormat.bytesPerPixel);
+ surface->create(_surface->w, _surface->h, pixelFormat);
for (uint16 i = 0; i < _surface->h; i++) {
for (uint16 j = 0; j < _surface->w; j++) {
@@ -292,7 +292,7 @@ MystGraphics::MystGraphics(MohawkEngine_Myst* vm) : GraphicsManager(), _vm(vm) {
// Initialize our buffer
_backBuffer = new Graphics::Surface();
- _backBuffer->create(_vm->_system->getWidth(), _vm->_system->getHeight(), _pixelFormat.bytesPerPixel);
+ _backBuffer->create(_vm->_system->getWidth(), _vm->_system->getHeight(), _pixelFormat);
}
MystGraphics::~MystGraphics() {
@@ -646,7 +646,7 @@ RivenGraphics::RivenGraphics(MohawkEngine_Riven* vm) : GraphicsManager(), _vm(vm
// The actual game graphics only take up the first 392 rows. The inventory
// occupies the rest of the screen and we don't use the buffer to hold that.
_mainScreen = new Graphics::Surface();
- _mainScreen->create(608, 392, _pixelFormat.bytesPerPixel);
+ _mainScreen->create(608, 392, _pixelFormat);
_updatesEnabled = true;
_scheduledTransition = -1; // no transition
diff --git a/engines/mohawk/video.cpp b/engines/mohawk/video.cpp
index f481b5ceb2..fc617722bc 100644
--- a/engines/mohawk/video.cpp
+++ b/engines/mohawk/video.cpp
@@ -228,7 +228,7 @@ bool VideoManager::updateMovies() {
const byte *palette = _videoStreams[i]->getPalette();
assert(palette);
- convertedFrame->create(frame->w, frame->h, pixelFormat.bytesPerPixel);
+ convertedFrame->create(frame->w, frame->h, pixelFormat);
for (uint16 j = 0; j < frame->h; j++) {
for (uint16 k = 0; k < frame->w; k++) {