From fedd4d7809f3ef7f9ec446c62bbbf681a87c578e Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sun, 17 Apr 2011 16:30:02 +0200 Subject: MOHAWK: Prefer Surface::create taking a PixelFormat over the one taking a byte depth. --- engines/mohawk/bitmap.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'engines/mohawk/bitmap.cpp') 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 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; } -- cgit v1.2.3 From ca240b4936b736b8042f9868c7dfca7b9de2d92f Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sun, 17 Apr 2011 17:28:16 +0200 Subject: MOHAWK: Do not access Surface::bytesPerPixel anymore. --- engines/mohawk/bitmap.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'engines/mohawk/bitmap.cpp') diff --git a/engines/mohawk/bitmap.cpp b/engines/mohawk/bitmap.cpp index 63b29053b0..0e14947133 100644 --- a/engines/mohawk/bitmap.cpp +++ b/engines/mohawk/bitmap.cpp @@ -573,7 +573,7 @@ void MohawkBitmap::drawRaw(Graphics::Surface *surface) { byte b = _data->readByte(); byte g = _data->readByte(); byte r = _data->readByte(); - if (surface->bytesPerPixel == 2) + if (surface->format.bytesPerPixel == 2) *((uint16 *)surface->getBasePtr(x, y)) = pixelFormat.RGBToColor(r, g, b); else *((uint32 *)surface->getBasePtr(x, y)) = pixelFormat.RGBToColor(r, g, b); @@ -861,7 +861,7 @@ MohawkSurface *DOSBitmap::decodeImage(Common::SeekableReadStream *stream) { } void DOSBitmap::expandMonochromePlane(Graphics::Surface *surface, Common::SeekableReadStream *rawStream) { - assert(surface->bytesPerPixel == 1); + assert(surface->format.bytesPerPixel == 1); byte *dst = (byte *)surface->pixels; @@ -887,7 +887,7 @@ void DOSBitmap::expandMonochromePlane(Graphics::Surface *surface, Common::Seekab *(dst + j * 4 + dstPixel) = (*(dst + j * 4 + dstPixel) >> 1) | (((temp >> srcBit) & 1) << 3) void DOSBitmap::expandEGAPlanes(Graphics::Surface *surface, Common::SeekableReadStream *rawStream) { - assert(surface->bytesPerPixel == 1); + assert(surface->format.bytesPerPixel == 1); // Note that the image is in EGA planar form and not just standard 4bpp // This seems to contradict the PoP specs which seem to do -- cgit v1.2.3 From 5563b25faf27717de31c358fe26ee98557f508bb Mon Sep 17 00:00:00 2001 From: Alyssa Milburn Date: Mon, 18 Apr 2011 16:12:57 +0200 Subject: MOHAWK: Speed up drawRLE8 a bit. --- engines/mohawk/bitmap.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'engines/mohawk/bitmap.cpp') diff --git a/engines/mohawk/bitmap.cpp b/engines/mohawk/bitmap.cpp index c8111fa91b..a6ec2cf85a 100644 --- a/engines/mohawk/bitmap.cpp +++ b/engines/mohawk/bitmap.cpp @@ -608,13 +608,12 @@ void MohawkBitmap::drawRLE8(Graphics::Surface *surface, bool isLE) { if (code & 0x80) { byte val = _data->readByte(); - for (uint16 j = 0; j < runLen; j++) - *dst++ = val; + memset(dst, val, runLen); } else { - for (uint16 j = 0; j < runLen; j++) - *dst++ = _data->readByte(); + _data->read(dst, runLen); } + dst += runLen; remaining -= runLen; } -- cgit v1.2.3 From 9414d7a6e287ff8abfb5746b564e92c8f0e6de58 Mon Sep 17 00:00:00 2001 From: Ori Avtalion Date: Sun, 24 Apr 2011 11:34:27 +0300 Subject: JANITORIAL: Reduce header dependencies in shared code Some backends may break as I only compiled SDL --- engines/mohawk/bitmap.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'engines/mohawk/bitmap.cpp') diff --git a/engines/mohawk/bitmap.cpp b/engines/mohawk/bitmap.cpp index a6ec2cf85a..05284f8b2b 100644 --- a/engines/mohawk/bitmap.cpp +++ b/engines/mohawk/bitmap.cpp @@ -31,6 +31,7 @@ #include "common/memstream.h" #include "common/substream.h" #include "common/system.h" +#include "common/textconsole.h" namespace Mohawk { -- cgit v1.2.3