[Scummvm-git-logs] scummvm master -> 85618c29b6ca9e2f2771ff4408871b40ce785ec9

bluegr noreply at scummvm.org
Thu Jul 16 20:01:15 UTC 2026


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://api.github.com/repos/scummvm/scummvm .

Summary:
85618c29b6 STARK: Fix loading PNGs without an alpha channel


Commit: 85618c29b6ca9e2f2771ff4408871b40ce785ec9
    https://github.com/scummvm/scummvm/commit/85618c29b6ca9e2f2771ff4408871b40ce785ec9
Author: Victor Gomez (victor.gomez.spain at gmail.com)
Date: 2026-07-16T23:01:12+03:00

Commit Message:
STARK: Fix loading PNGs without an alpha channel

Changed paths:
    engines/stark/visual/image.cpp


diff --git a/engines/stark/visual/image.cpp b/engines/stark/visual/image.cpp
index f8c377eae64..4b09e5a23b0 100644
--- a/engines/stark/visual/image.cpp
+++ b/engines/stark/visual/image.cpp
@@ -101,16 +101,24 @@ bool VisualImageXMG::loadPNG(Common::SeekableReadStream *stream) {
 }
 
 Graphics::Surface *VisualImageXMG::multiplyColorWithAlpha(const Graphics::Surface *source) {
-	assert(source->format == Gfx::Driver::getRGBAPixelFormat());
+	const Graphics::Surface *surface = source;
+	Graphics::Surface *convertedSurface = nullptr;
+
+	if (source->format != Gfx::Driver::getRGBAPixelFormat()) {
+		convertedSurface = source->convertTo(Gfx::Driver::getRGBAPixelFormat());
+		surface = convertedSurface;
+	}
+
+	assert(surface->format == Gfx::Driver::getRGBAPixelFormat());
 
 	Graphics::Surface *dest = new Graphics::Surface();
-	dest->create(source->w, source->h, Gfx::Driver::getRGBAPixelFormat());
+	dest->create(surface->w, surface->h, Gfx::Driver::getRGBAPixelFormat());
 
-	for (int y = 0; y < source->h; y++) {
-		const uint8 *src = (const uint8 *) source->getBasePtr(0, y);
-		uint8 *dst = (uint8 *) dest->getBasePtr(0, y);
+	for (int y = 0; y < surface->h; y++) {
+		const uint8 *src = (const uint8 *)surface->getBasePtr(0, y);
+		uint8 *dst = (uint8 *)dest->getBasePtr(0, y);
 
-		for (int x = 0; x < source->w; x++) {
+		for (int x = 0; x < surface->w; x++) {
 			uint8 a, r, g, b;
 			r = *src++;
 			g = *src++;
@@ -130,6 +138,11 @@ Graphics::Surface *VisualImageXMG::multiplyColorWithAlpha(const Graphics::Surfac
 		}
 	}
 
+	if (convertedSurface) {
+		convertedSurface->free();
+		delete convertedSurface;
+	}
+
 	return dest;
 }
 




More information about the Scummvm-git-logs mailing list