[Scummvm-git-logs] scummvm branch-2-7 -> 3727655bd9701edd28a1ae671dddf219a227ce1f

dwatteau noreply at scummvm.org
Wed Apr 5 15:24:04 UTC 2023


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:
2debeb4b2a MACOSX: Fix missing includes for older OSX releases
3727655bd9 GRAPHICS: Preventively remove alpha channel for screenshots


Commit: 2debeb4b2a17829b84227dc51d9248482639690a
    https://github.com/scummvm/scummvm/commit/2debeb4b2a17829b84227dc51d9248482639690a
Author: Donovan Watteau (contrib at dwatteau.fr)
Date: 2023-04-05T15:59:28+02:00

Commit Message:
MACOSX: Fix missing includes for older OSX releases

(cherry picked from commit d2e01fc70937edcc7de23f58426827f0831d095b)

Changed paths:
    backends/platform/sdl/macosx/macosx_osys_misc.mm


diff --git a/backends/platform/sdl/macosx/macosx_osys_misc.mm b/backends/platform/sdl/macosx/macosx_osys_misc.mm
index 3a6756e2315..c44388829e2 100644
--- a/backends/platform/sdl/macosx/macosx_osys_misc.mm
+++ b/backends/platform/sdl/macosx/macosx_osys_misc.mm
@@ -27,11 +27,13 @@
 #include "common/file.h"
 
 #include "backends/platform/sdl/macosx/macosx.h"
+#include "backends/platform/sdl/macosx/macosx-compat.h"
 #include "base/version.h"
 
 #include <Foundation/NSBundle.h>
 #include <Foundation/NSFileManager.h>
 #include <Foundation/NSArray.h>
+#include <Foundation/NSPathUtilities.h>
 #include <Foundation/NSUserDefaults.h>
 #include <AppKit/NSPasteboard.h>
 


Commit: 3727655bd9701edd28a1ae671dddf219a227ce1f
    https://github.com/scummvm/scummvm/commit/3727655bd9701edd28a1ae671dddf219a227ce1f
Author: Walter Agazzi (walter.agazzi at protonmail.com)
Date: 2023-04-05T16:05:32+02:00

Commit Message:
GRAPHICS: Preventively remove alpha channel for screenshots

Preserving the alpha channel for screenshots
is not really needed and causes problems in
the AGS engine (and possibily other engines)

(cherry picked from commit 2c1741e5c6ee61575988d74e850802c4f1abae41)

Changed paths:
    backends/graphics/opengl/opengl-graphics.cpp


diff --git a/backends/graphics/opengl/opengl-graphics.cpp b/backends/graphics/opengl/opengl-graphics.cpp
index 3128b18644c..035937d7b0d 100644
--- a/backends/graphics/opengl/opengl-graphics.cpp
+++ b/backends/graphics/opengl/opengl-graphics.cpp
@@ -1576,14 +1576,10 @@ bool OpenGLGraphicsManager::saveScreenshot(const Common::String &filename) const
 	const uint width  = _windowWidth;
 	const uint height = _windowHeight;
 
-	// A line of a BMP image must have a size divisible by 4.
-	// We calculate the padding bytes needed here.
-	// Since we use a 4 byte per pixel mode, we can use 0 here, since it is
-	// equal to (4 - (width * 4)) % 4. (4 - (width * Bpp)) % 4, is the usual
-	// way of computing the padding bytes required).
-	// GL_PACK_ALIGNMENT is 4, so this line padding is required for PNG too
-	const uint linePaddingSize = 0;
-	const uint lineSize        = width * 4 + linePaddingSize;
+	// GL_PACK_ALIGNMENT is 4 so each row must be aligned to 4 bytes boundary
+	// A line of a BMP image must also have a size divisible by 4.
+	// Calculate lineSize as the next multiple of 4 after the real line size
+	const uint lineSize        = (width * 3 + 3) & ~3;
 
 	Common::DumpFile out;
 	if (!out.open(filename)) {
@@ -1592,12 +1588,12 @@ bool OpenGLGraphicsManager::saveScreenshot(const Common::String &filename) const
 
 	Common::Array<uint8> pixels;
 	pixels.resize(lineSize * height);
-	GL_CALL(glReadPixels(0, 0, width, height, GL_RGBA, GL_UNSIGNED_BYTE, &pixels.front()));
+	GL_CALL(glReadPixels(0, 0, width, height, GL_RGB, GL_UNSIGNED_BYTE, &pixels.front()));
 
 #ifdef SCUMM_LITTLE_ENDIAN
-	const Graphics::PixelFormat format(4, 8, 8, 8, 8, 0, 8, 16, 24);
+	const Graphics::PixelFormat format(3, 8, 8, 8, 0, 0, 8, 16, 0);
 #else
-	const Graphics::PixelFormat format(4, 8, 8, 8, 8, 24, 16, 8, 0);
+	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);




More information about the Scummvm-git-logs mailing list