aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--backends/graphics/opengl/opengl-graphics.cpp4
-rw-r--r--backends/graphics/surfacesdl/surfacesdl-graphics.cpp4
-rw-r--r--image/bmp.cpp4
-rw-r--r--image/png.cpp7
4 files changed, 18 insertions, 1 deletions
diff --git a/backends/graphics/opengl/opengl-graphics.cpp b/backends/graphics/opengl/opengl-graphics.cpp
index ad6094b9a1..6eb961a9d4 100644
--- a/backends/graphics/opengl/opengl-graphics.cpp
+++ b/backends/graphics/opengl/opengl-graphics.cpp
@@ -1214,7 +1214,11 @@ bool OpenGLGraphicsManager::saveScreenshot(const Common::String &filename) const
pixels.resize(lineSize * height);
GL_CALL(glReadPixels(0, 0, width, height, GL_RGB, GL_UNSIGNED_BYTE, &pixels.front()));
+#ifdef SCUMM_LITTLE_ENDIAN
+ const Graphics::PixelFormat format(3, 8, 8, 8, 0, 0, 8, 16, 0);
+#else
const Graphics::PixelFormat format(3, 8, 8, 8, 0, 16, 8, 0, 0);
+#endif
Graphics::Surface data;
data.init(width, height, lineSize, &pixels.front(), format);
#ifdef USE_PNG
diff --git a/backends/graphics/surfacesdl/surfacesdl-graphics.cpp b/backends/graphics/surfacesdl/surfacesdl-graphics.cpp
index 3e9aa9faab..dd334f3814 100644
--- a/backends/graphics/surfacesdl/surfacesdl-graphics.cpp
+++ b/backends/graphics/surfacesdl/surfacesdl-graphics.cpp
@@ -1476,7 +1476,11 @@ bool SurfaceSdlGraphicsManager::saveScreenshot(const char *filename) {
return false;
}
+#ifdef SCUMM_LITTLE_ENDIAN
+ const Graphics::PixelFormat format(3, 8, 8, 8, 0, 0, 8, 16, 0);
+#else
const Graphics::PixelFormat format(3, 8, 8, 8, 0, 16, 8, 0, 0);
+#endif
Graphics::Surface data;
data.init(rgbScreen->w, rgbScreen->h, rgbScreen->pitch, rgbScreen->pixels, format);
const bool success = Image::writePNG(out, data);
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) {