diff options
author | Johannes Schickel | 2011-05-01 16:54:45 +0200 |
---|---|---|
committer | Johannes Schickel | 2011-05-01 16:54:45 +0200 |
commit | 71bdb86e028db9556611f88b3686ce93312a8131 (patch) | |
tree | 3c24233044a8e72bd8ecd73b981f50c725d5d282 /engines/mohawk/bitmap.cpp | |
parent | 89b63e3adb4692c9659f8b133727ccc1e2af75b4 (diff) | |
parent | 8ff527ac4ef4237e63c0802a22eb0f942089e6c4 (diff) | |
download | scummvm-rg350-71bdb86e028db9556611f88b3686ce93312a8131.tar.gz scummvm-rg350-71bdb86e028db9556611f88b3686ce93312a8131.tar.bz2 scummvm-rg350-71bdb86e028db9556611f88b3686ce93312a8131.zip |
Merge pull request #16 "Add a PixelFormat to Graphics::Surface.".
For further discussion check here:
https://github.com/scummvm/scummvm/pull/16
Conflicts:
graphics/png.cpp
Diffstat (limited to 'engines/mohawk/bitmap.cpp')
-rw-r--r-- | engines/mohawk/bitmap.cpp | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/engines/mohawk/bitmap.cpp b/engines/mohawk/bitmap.cpp index 05284f8b2b..02548d58fc 100644 --- a/engines/mohawk/bitmap.cpp +++ b/engines/mohawk/bitmap.cpp @@ -136,8 +136,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; } @@ -570,7 +574,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); @@ -857,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; @@ -883,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 |