[Scummvm-git-logs] scummvm master -> e8637abc0a39ee1f472cc85138ca8c79af3b61b9

aquadran noreply at scummvm.org
Sat Aug 9 18:14:59 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:
e8637abc0a WINTERMUTE: Restore putPixel() for surface


Commit: e8637abc0a39ee1f472cc85138ca8c79af3b61b9
    https://github.com/scummvm/scummvm/commit/e8637abc0a39ee1f472cc85138ca8c79af3b61b9
Author: Paweł Kołodziejski (aquadran at gmail.com)
Date: 2025-08-09T20:14:53+02:00

Commit Message:
WINTERMUTE: Restore putPixel() for surface

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


diff --git a/engines/wintermute/base/gfx/base_surface.h b/engines/wintermute/base/gfx/base_surface.h
index 7413be72b50..84659695740 100644
--- a/engines/wintermute/base/gfx/base_surface.h
+++ b/engines/wintermute/base/gfx/base_surface.h
@@ -64,6 +64,7 @@ public:
 	}
 	virtual bool startPixelOp() = 0;
 	virtual bool endPixelOp() = 0;
+	virtual bool putPixel(int x, int y, byte r, byte g, byte b, byte a) = 0;
 	virtual bool getPixel(int x, int y, byte *r, byte *g, byte *b, byte *a = nullptr) const = 0;
 	virtual bool isTransparentAtLite(int x, int y) const = 0;
 	void setSize(int width, int height);
diff --git a/engines/wintermute/base/gfx/opengl/base_surface_opengl3d.cpp b/engines/wintermute/base/gfx/opengl/base_surface_opengl3d.cpp
index 526ad9567b3..004d980d842 100644
--- a/engines/wintermute/base/gfx/opengl/base_surface_opengl3d.cpp
+++ b/engines/wintermute/base/gfx/opengl/base_surface_opengl3d.cpp
@@ -268,6 +268,24 @@ bool BaseSurfaceOpenGL3D::putSurface(const Graphics::Surface &surface, bool hasA
 	return true;
 }
 
+bool BaseSurfaceOpenGL3D::putPixel(int x, int y, byte r, byte g, byte b, byte a) {
+	if (!_pixelOpReady) {
+		return false;
+	}
+
+	if (x < 0 || y < 0 || x >= _width || y >= _height) {
+		return false;
+	}
+
+	if (_imageData == nullptr) {
+		return false;
+	}
+
+	_imageData->setPixel(x, y, _imageData->format.ARGBToColor(a, r, g, b));
+
+	return true;
+}
+
 bool BaseSurfaceOpenGL3D::getPixel(int x, int y, byte *r, byte *g, byte *b, byte *a) const {
 	if (!_pixelOpReady) {
 		return false;
diff --git a/engines/wintermute/base/gfx/opengl/base_surface_opengl3d.h b/engines/wintermute/base/gfx/opengl/base_surface_opengl3d.h
index 77288062cd7..31835bb7679 100644
--- a/engines/wintermute/base/gfx/opengl/base_surface_opengl3d.h
+++ b/engines/wintermute/base/gfx/opengl/base_surface_opengl3d.h
@@ -49,6 +49,7 @@ public:
 	bool create(int width, int height) override;
 	bool setAlphaImage(const Common::String &filename) override;
 	bool putSurface(const Graphics::Surface &surface, bool hasAlpha = false) override;
+	bool putPixel(int x, int y, byte r, byte g, byte b, byte a) override;
 	bool getPixel(int x, int y, byte *r, byte *g, byte *b, byte *a = nullptr) const override;
 	bool startPixelOp() override;
 	bool endPixelOp() override;
diff --git a/engines/wintermute/base/gfx/osystem/base_surface_osystem.h b/engines/wintermute/base/gfx/osystem/base_surface_osystem.h
index 4448c5311b9..e3d5c0a94a3 100644
--- a/engines/wintermute/base/gfx/osystem/base_surface_osystem.h
+++ b/engines/wintermute/base/gfx/osystem/base_surface_osystem.h
@@ -71,13 +71,22 @@ public:
 		}
 		return _height;
 	}
+	bool putPixel(int x, int y, byte r, byte g, byte b, byte a) override {
+		if (!_pixelOpReady) {
+			return STATUS_FAILED;
+		}
+		if (_surface) {
+			_surface->setPixel(x, y, _surface->format.ARGBToColor(a, r, g, b));
+			return STATUS_OK;
+		}
+		return STATUS_FAILED;
+	}
 	bool getPixel(int x, int y, byte *r, byte *g, byte *b, byte *a) const override {
 		if (!_pixelOpReady) {
 			return STATUS_FAILED;
 		}
 		if (_surface) {
-			uint32 pixel = _surface->getPixel(x, y);
-			_surface->format.colorToARGB(pixel, *a, *r, *g, *b);
+			_surface->format.colorToARGB(_surface->getPixel(x, y), *a, *r, *g, *b);
 			return STATUS_OK;
 		}
 		return STATUS_FAILED;




More information about the Scummvm-git-logs mailing list