[Scummvm-git-logs] scummvm master -> 57032f9c152aff4d88bf6e8eeabc012cd7c43ed9

aquadran noreply at scummvm.org
Wed Nov 24 21:10:53 UTC 2021


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

Summary:
57032f9c15 STARK: Fixed BE issue in textures for software renderer


Commit: 57032f9c152aff4d88bf6e8eeabc012cd7c43ed9
    https://github.com/scummvm/scummvm/commit/57032f9c152aff4d88bf6e8eeabc012cd7c43ed9
Author: Paweł Kołodziejski (aquadran at gmail.com)
Date: 2021-11-24T22:10:47+01:00

Commit Message:
STARK: Fixed BE issue in textures for software renderer

Changed paths:
    engines/stark/gfx/tinygltexture.cpp


diff --git a/engines/stark/gfx/tinygltexture.cpp b/engines/stark/gfx/tinygltexture.cpp
index fd877f22c9..7a8bec652f 100644
--- a/engines/stark/gfx/tinygltexture.cpp
+++ b/engines/stark/gfx/tinygltexture.cpp
@@ -60,16 +60,24 @@ void TinyGlTexture::updateLevel(uint32 level, const Graphics::Surface *surface,
 
 	if (surface->format.bytesPerPixel != 4) {
 		// Convert the surface to texture format
-		Graphics::Surface *convertedSurface = surface->convertTo(Driver::getRGBAPixelFormat(), palette);
+		Graphics::Surface *convertedSurface = surface->convertTo(Graphics::PixelFormat(4, 8, 8, 8, 8, 0, 8, 16, 24), palette);
 
 		tglTexImage2D(TGL_TEXTURE_2D, 0, TGL_RGBA, convertedSurface->w, convertedSurface->h, 0, TGL_RGBA, TGL_UNSIGNED_BYTE, (char *)(convertedSurface->getPixels()));
 
 		convertedSurface->free();
 		delete convertedSurface;
 	} else {
-		assert(surface->format == Driver::getRGBAPixelFormat());
+		// Convert the surface to texture format
+		if (surface->format != Graphics::PixelFormat(4, 8, 8, 8, 8, 0, 8, 16, 24)) {
+			Graphics::Surface *convertedSurface = surface->convertTo(Graphics::PixelFormat(4, 8, 8, 8, 8, 0, 8, 16, 24));
+
+			tglTexImage2D(TGL_TEXTURE_2D, 0, TGL_RGBA, convertedSurface->w, convertedSurface->h, 0, TGL_RGBA, TGL_UNSIGNED_BYTE, (char *)(convertedSurface->getPixels()));
 
-		tglTexImage2D(TGL_TEXTURE_2D, 0, TGL_RGBA, surface->w, surface->h, 0, TGL_RGBA, TGL_UNSIGNED_BYTE, const_cast<void *>(surface->getPixels()));
+			convertedSurface->free();
+			delete convertedSurface;
+		} else {
+			tglTexImage2D(TGL_TEXTURE_2D, 0, TGL_RGBA, surface->w, surface->h, 0, TGL_RGBA, TGL_UNSIGNED_BYTE, const_cast<void *>(surface->getPixels()));
+		}
 	}
 }
 




More information about the Scummvm-git-logs mailing list