[Scummvm-cvs-logs] scummvm master -> 4a114f218d46d4abd398bafb4095ea7498d531ee
clone2727
clone2727 at gmail.com
Mon Aug 20 23:21:42 CEST 2012
This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
8982026661 GRAPHICS: Add support for 32bpp BMPs
4a114f218d Merge pull request #264 from somaen/32bppbmp
Commit: 8982026661c5f64f67cb8565946d25f620dfb73c
https://github.com/scummvm/scummvm/commit/8982026661c5f64f67cb8565946d25f620dfb73c
Author: Einar Johan Trøan Sømåen (einarjohants at gmail.com)
Date: 2012-08-12T17:31:34-07:00
Commit Message:
GRAPHICS: Add support for 32bpp BMPs
Changed paths:
graphics/decoders/bmp.cpp
diff --git a/graphics/decoders/bmp.cpp b/graphics/decoders/bmp.cpp
index 5f764e1..f15d4e2 100644
--- a/graphics/decoders/bmp.cpp
+++ b/graphics/decoders/bmp.cpp
@@ -82,7 +82,7 @@ bool BitmapDecoder::loadStream(Common::SeekableReadStream &stream) {
/* uint16 planes = */ stream.readUint16LE();
uint16 bitsPerPixel = stream.readUint16LE();
- if (bitsPerPixel != 8 && bitsPerPixel != 24) {
+ if (bitsPerPixel != 8 && bitsPerPixel != 24 && bitsPerPixel != 32) {
warning("%dbpp bitmaps not supported", bitsPerPixel);
return false;
}
@@ -119,8 +119,8 @@ bool BitmapDecoder::loadStream(Common::SeekableReadStream &stream) {
Graphics::PixelFormat format = Graphics::PixelFormat::createFormatCLUT8();
- // BGRA for 24bpp
- if (bitsPerPixel == 24)
+ // BGRA for 24bpp and 32 bpp
+ if (bitsPerPixel == 24 || bitsPerPixel == 32)
format = Graphics::PixelFormat(4, 8, 8, 8, 8, 8, 16, 24, 0);
_surface = new Graphics::Surface();
@@ -136,7 +136,7 @@ bool BitmapDecoder::loadStream(Common::SeekableReadStream &stream) {
stream.read(dst + (height - i - 1) * width, width);
stream.skip(extraDataLength);
}
- } else {
+ } else if (bitsPerPixel == 24) {
byte *dst = (byte *)_surface->pixels + (height - 1) * _surface->pitch;
for (int32 i = 0; i < height; i++) {
@@ -153,6 +153,27 @@ bool BitmapDecoder::loadStream(Common::SeekableReadStream &stream) {
stream.skip(extraDataLength);
dst -= _surface->pitch * 2;
}
+ } else { // 32 bpp
+ byte *dst = (byte *)_surface->pixels + (height - 1) * _surface->pitch;
+
+ for (int32 i = 0; i < height; i++) {
+ for (uint32 j = 0; j < width; j++) {
+ byte b = stream.readByte();
+ byte g = stream.readByte();
+ byte r = stream.readByte();
+ // Ignore the last byte, as in v3 it is unused
+ // and should thus NOT be used as alpha.
+ // ref: http://msdn.microsoft.com/en-us/library/windows/desktop/dd183376%28v=vs.85%29.aspx
+ stream.readByte();
+ uint32 color = format.RGBToColor(r, g, b);
+
+ *((uint32 *)dst) = color;
+ dst += format.bytesPerPixel;
+ }
+
+ stream.skip(extraDataLength);
+ dst -= _surface->pitch * 2;
+ }
}
return true;
Commit: 4a114f218d46d4abd398bafb4095ea7498d531ee
https://github.com/scummvm/scummvm/commit/4a114f218d46d4abd398bafb4095ea7498d531ee
Author: clone2727 (clone2727 at gmail.com)
Date: 2012-08-20T14:21:08-07:00
Commit Message:
Merge pull request #264 from somaen/32bppbmp
GRAPHICS: Add support for 32bpp BMPs
Changed paths:
graphics/decoders/bmp.cpp
More information about the Scummvm-git-logs
mailing list