aboutsummaryrefslogtreecommitdiff
path: root/backends/graphics
diff options
context:
space:
mode:
authorCameron Cawley2019-03-01 18:43:17 +0000
committerBastien Bouclet2019-03-02 07:29:22 +0100
commit205df5dbdfc75d051d1d74e997dbd88208cbbdf1 (patch)
treea0f11f001c978053fd0e27f1bfc1ad501f6866c5 /backends/graphics
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 'backends/graphics')
-rw-r--r--backends/graphics/opengl/opengl-graphics.cpp4
-rw-r--r--backends/graphics/surfacesdl/surfacesdl-graphics.cpp4
2 files changed, 8 insertions, 0 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);