[Scummvm-git-logs] scummvm master -> 962383eb3e40d6e6e7bb6b184f4a3575e8fa10b9
ccawley2011
noreply at scummvm.org
Wed Feb 1 13:48:30 UTC 2023
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:
962383eb3e STARK: Better check for texture and bitmap formats
Commit: 962383eb3e40d6e6e7bb6b184f4a3575e8fa10b9
https://github.com/scummvm/scummvm/commit/962383eb3e40d6e6e7bb6b184f4a3575e8fa10b9
Author: Cameron Cawley (ccawley2011 at gmail.com)
Date: 2023-02-01T13:48:26Z
Commit Message:
STARK: Better check for texture and bitmap formats
Changed paths:
engines/stark/gfx/openglbitmap.cpp
engines/stark/gfx/opengltexture.cpp
engines/stark/gfx/tinyglbitmap.cpp
engines/stark/gfx/tinygltexture.cpp
diff --git a/engines/stark/gfx/openglbitmap.cpp b/engines/stark/gfx/openglbitmap.cpp
index 5fb100a5a09..d7aae1b9abc 100644
--- a/engines/stark/gfx/openglbitmap.cpp
+++ b/engines/stark/gfx/openglbitmap.cpp
@@ -60,7 +60,7 @@ void OpenGlBitmap::update(const Graphics::Surface *surface, const byte *palette)
_width = surface->w;
_height = surface->h;
- if (surface->format.bytesPerPixel != 4) {
+ if (surface->format != Driver::getRGBAPixelFormat()) {
// Convert the surface to texture format
Graphics::Surface *convertedSurface = surface->convertTo(Driver::getRGBAPixelFormat(), palette);
@@ -69,8 +69,6 @@ void OpenGlBitmap::update(const Graphics::Surface *surface, const byte *palette)
convertedSurface->free();
delete convertedSurface;
} else {
- assert(surface->format == Driver::getRGBAPixelFormat());
-
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, surface->w, surface->h, 0, GL_RGBA, GL_UNSIGNED_BYTE, surface->getPixels());
}
}
diff --git a/engines/stark/gfx/opengltexture.cpp b/engines/stark/gfx/opengltexture.cpp
index 0bb7d619c5a..2f00a283551 100644
--- a/engines/stark/gfx/opengltexture.cpp
+++ b/engines/stark/gfx/opengltexture.cpp
@@ -56,7 +56,7 @@ void OpenGlTexture::bind() const {
}
void OpenGlTexture::updateLevel(uint32 level, const Graphics::Surface *surface, const byte *palette) {
- if (surface->format.bytesPerPixel != 4) {
+ if (surface->format != Driver::getRGBAPixelFormat()) {
// Convert the surface to texture format
Graphics::Surface *convertedSurface = surface->convertTo(Driver::getRGBAPixelFormat(), palette);
@@ -65,8 +65,6 @@ void OpenGlTexture::updateLevel(uint32 level, const Graphics::Surface *surface,
convertedSurface->free();
delete convertedSurface;
} else {
- assert(surface->format == Driver::getRGBAPixelFormat());
-
glTexImage2D(GL_TEXTURE_2D, level, GL_RGBA, surface->w, surface->h, 0, GL_RGBA, GL_UNSIGNED_BYTE, surface->getPixels());
}
}
diff --git a/engines/stark/gfx/tinyglbitmap.cpp b/engines/stark/gfx/tinyglbitmap.cpp
index ec7947cadbd..9301ed754b8 100644
--- a/engines/stark/gfx/tinyglbitmap.cpp
+++ b/engines/stark/gfx/tinyglbitmap.cpp
@@ -44,14 +44,13 @@ void TinyGlBitmap::update(const Graphics::Surface *surface, const byte *palette)
_width = surface->w;
_height = surface->h;
- if (surface->format.bytesPerPixel != 4) {
+ if (surface->format != Driver::getRGBAPixelFormat()) {
// Convert the surface to bitmap format
Graphics::Surface *convertedSurface = surface->convertTo(Driver::getRGBAPixelFormat(), palette);
tglUploadBlitImage(_blitImage, *convertedSurface, 0, false);
convertedSurface->free();
delete convertedSurface;
} else {
- assert(surface->format == Driver::getRGBAPixelFormat());
// W/A for 1x1 size bitmap
// store pixel color used later fo creating scalled bitmap
if (_width == 1 && _height == 1) {
diff --git a/engines/stark/gfx/tinygltexture.cpp b/engines/stark/gfx/tinygltexture.cpp
index b3b73b4c230..337c85ebdaa 100644
--- a/engines/stark/gfx/tinygltexture.cpp
+++ b/engines/stark/gfx/tinygltexture.cpp
@@ -51,7 +51,7 @@ void TinyGlTexture::bind() const {
}
void TinyGlTexture::updateLevel(uint32 level, const Graphics::Surface *surface, const byte *palette) {
- if (surface->format.bytesPerPixel != 4) {
+ if (surface->format != Driver::getRGBAPixelFormat()) {
// Convert the surface to texture format
Graphics::Surface *convertedSurface = surface->convertTo(Driver::getRGBAPixelFormat(), palette);
More information about the Scummvm-git-logs
mailing list