[Scummvm-git-logs] scummvm branch-2-5 -> 46844bfaabb01432e2acc296c83f322f780cbb17

aquadran noreply at scummvm.org
Tue Dec 21 07:37:27 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:
46844bfaab STARK: Software renderer BE fixes for textures


Commit: 46844bfaabb01432e2acc296c83f322f780cbb17
    https://github.com/scummvm/scummvm/commit/46844bfaabb01432e2acc296c83f322f780cbb17
Author: Paweł Kołodziejski (aquadran at gmail.com)
Date: 2021-12-21T08:37:20+01:00

Commit Message:
STARK: Software renderer BE fixes for textures

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


diff --git a/engines/stark/gfx/tinygltexture.cpp b/engines/stark/gfx/tinygltexture.cpp
index 571510a046..0c6313c7bb 100644
--- a/engines/stark/gfx/tinygltexture.cpp
+++ b/engines/stark/gfx/tinygltexture.cpp
@@ -59,15 +59,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 {
-		// Convert the surface to texture format
-		tglTexImage2D(TGL_TEXTURE_2D, 0, TGL_RGBA, surface->w, surface->h, 0, TGL_RGBA, TGL_UNSIGNED_BYTE, const_cast<void *>(surface->getPixels()));
+		if (surface->format != Graphics::PixelFormat(4, 8, 8, 8, 8, 0, 8, 16, 24)) {
+			// Convert the surface to texture format
+			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()));
+
+			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