aboutsummaryrefslogtreecommitdiff
path: root/image
diff options
context:
space:
mode:
authorCameron Cawley2019-03-01 18:43:17 +0000
committerBastien Bouclet2019-03-02 07:29:22 +0100
commit205df5dbdfc75d051d1d74e997dbd88208cbbdf1 (patch)
treea0f11f001c978053fd0e27f1bfc1ad501f6866c5 /image
parent8ae17b481a8f0a0c7d78e975a32e9e6df055b8df (diff)
downloadscummvm-rg350-205df5dbdfc75d051d1d74e997dbd88208cbbdf1.tar.gz
scummvm-rg350-205df5dbdfc75d051d1d74e997dbd88208cbbdf1.tar.bz2
scummvm-rg350-205df5dbdfc75d051d1d74e997dbd88208cbbdf1.zip
IMAGE: Fix taking screenshots on big endian systems
Diffstat (limited to 'image')
-rw-r--r--image/bmp.cpp4
-rw-r--r--image/png.cpp7
2 files changed, 10 insertions, 1 deletions
diff --git a/image/bmp.cpp b/image/bmp.cpp
index ce2b099797..bd3381d26c 100644
--- a/image/bmp.cpp
+++ b/image/bmp.cpp
@@ -133,7 +133,11 @@ bool BitmapDecoder::loadStream(Common::SeekableReadStream &stream) {
}
bool writeBMP(Common::WriteStream &out, const Graphics::Surface &input, const bool bottomUp) {
+#ifdef SCUMM_LITTLE_ENDIAN
+ const Graphics::PixelFormat requiredFormat_3byte(3, 8, 8, 8, 0, 16, 8, 0, 0);
+#else
const Graphics::PixelFormat requiredFormat_3byte(3, 8, 8, 8, 0, 0, 8, 16, 0);
+#endif
Graphics::Surface *tmp = NULL;
const Graphics::Surface *surface;
diff --git a/image/png.cpp b/image/png.cpp
index 86d33b6952..50a53b0a46 100644
--- a/image/png.cpp
+++ b/image/png.cpp
@@ -244,8 +244,13 @@ bool PNGDecoder::loadStream(Common::SeekableReadStream &stream) {
bool writePNG(Common::WriteStream &out, const Graphics::Surface &input, const bool bottomUp) {
#ifdef USE_PNG
- const Graphics::PixelFormat requiredFormat_3byte(3, 8, 8, 8, 0, 16, 8, 0, 0);
+#ifdef SCUMM_LITTLE_ENDIAN
+ const Graphics::PixelFormat requiredFormat_3byte(3, 8, 8, 8, 0, 0, 8, 16, 0);
const Graphics::PixelFormat requiredFormat_4byte(4, 8, 8, 8, 8, 0, 8, 16, 24);
+#else
+ const Graphics::PixelFormat requiredFormat_3byte(3, 8, 8, 8, 0, 16, 8, 0, 0);
+ const Graphics::PixelFormat requiredFormat_4byte(4, 8, 8, 8, 8, 24, 16, 8, 0);
+#endif
if (input.format.bytesPerPixel == 3) {
if (input.format != requiredFormat_3byte) {