[Scummvm-git-logs] scummvm master -> 6464021285f2f694f60c1f322969de9c01755f8b

aquadran noreply at scummvm.org
Sat Aug 9 19:12:32 UTC 2025


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:
6464021285 WINTERMUTE: Fixed endPixelOp() in OpenGL renderer


Commit: 6464021285f2f694f60c1f322969de9c01755f8b
    https://github.com/scummvm/scummvm/commit/6464021285f2f694f60c1f322969de9c01755f8b
Author: Paweł Kołodziejski (aquadran at gmail.com)
Date: 2025-08-09T21:12:27+02:00

Commit Message:
WINTERMUTE: Fixed endPixelOp() in OpenGL renderer

Changed paths:
    engines/wintermute/base/gfx/opengl/base_surface_opengl3d.cpp
    engines/wintermute/base/gfx/opengl/base_surface_opengl3d.h


diff --git a/engines/wintermute/base/gfx/opengl/base_surface_opengl3d.cpp b/engines/wintermute/base/gfx/opengl/base_surface_opengl3d.cpp
index 004d980d842..8884d8a19da 100644
--- a/engines/wintermute/base/gfx/opengl/base_surface_opengl3d.cpp
+++ b/engines/wintermute/base/gfx/opengl/base_surface_opengl3d.cpp
@@ -35,7 +35,7 @@
 namespace Wintermute {
 
 BaseSurfaceOpenGL3D::BaseSurfaceOpenGL3D(BaseGame *game, BaseRenderer3D *renderer)
-	: BaseSurface(game), _tex(0), _renderer(renderer), _imageData(nullptr), _maskData(nullptr), _texWidth(0), _texHeight(0), _pixelOpReady(false) {
+	: BaseSurface(game), _tex(0), _renderer(renderer), _imageData(nullptr), _maskData(nullptr), _texWidth(0), _texHeight(0), _pixelOpReady(false), _surfaceModified(false) {
 }
 
 BaseSurfaceOpenGL3D::~BaseSurfaceOpenGL3D() {
@@ -68,6 +68,7 @@ bool BaseSurfaceOpenGL3D::invalidate() {
 	}
 
 	_valid = false;
+	_surfaceModified = false;
 	return true;
 }
 
@@ -269,7 +270,7 @@ bool BaseSurfaceOpenGL3D::putSurface(const Graphics::Surface &surface, bool hasA
 }
 
 bool BaseSurfaceOpenGL3D::putPixel(int x, int y, byte r, byte g, byte b, byte a) {
-	if (!_pixelOpReady) {
+	if (!_pixelOpReady || !_valid) {
 		return false;
 	}
 
@@ -283,11 +284,13 @@ bool BaseSurfaceOpenGL3D::putPixel(int x, int y, byte r, byte g, byte b, byte a)
 
 	_imageData->setPixel(x, y, _imageData->format.ARGBToColor(a, r, g, b));
 
+	_surfaceModified = true;
+
 	return true;
 }
 
 bool BaseSurfaceOpenGL3D::getPixel(int x, int y, byte *r, byte *g, byte *b, byte *a) const {
-	if (!_pixelOpReady) {
+	if (!_pixelOpReady || !_valid) {
 		return false;
 	}
 
@@ -317,6 +320,13 @@ bool BaseSurfaceOpenGL3D::startPixelOp() {
 
 bool BaseSurfaceOpenGL3D::endPixelOp() {
 	_pixelOpReady = false;
+	if (_surfaceModified) {
+		glBindTexture(GL_TEXTURE_2D, _tex);
+		glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, _texWidth, _texHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, nullptr);
+		glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, _width, _height, GL_RGBA, GL_UNSIGNED_BYTE, _imageData->getPixels());
+		glBindTexture(GL_TEXTURE_2D, 0);
+		_surfaceModified = false;
+	}
 	return true;
 }
 
diff --git a/engines/wintermute/base/gfx/opengl/base_surface_opengl3d.h b/engines/wintermute/base/gfx/opengl/base_surface_opengl3d.h
index 31835bb7679..2690b2c52f5 100644
--- a/engines/wintermute/base/gfx/opengl/base_surface_opengl3d.h
+++ b/engines/wintermute/base/gfx/opengl/base_surface_opengl3d.h
@@ -77,6 +77,7 @@ private:
 	uint _texWidth;
 	uint _texHeight;
 	bool _pixelOpReady;
+	bool _surfaceModified;
 
 	void writeAlpha(Graphics::Surface *surface, const Graphics::Surface *mask);
 };




More information about the Scummvm-git-logs mailing list