[Scummvm-git-logs] scummvm master -> 06c0cfd43c8c90443753c1639e0100ff1aa5bb10

aquadran noreply at scummvm.org
Thu Jun 12 10:32:33 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:
06c0cfd43c WINTERMUTE: Small correction to greyscale conversion


Commit: 06c0cfd43c8c90443753c1639e0100ff1aa5bb10
    https://github.com/scummvm/scummvm/commit/06c0cfd43c8c90443753c1639e0100ff1aa5bb10
Author: Paweł Kołodziejski (aquadran at gmail.com)
Date: 2025-06-12T12:32:28+02:00

Commit Message:
WINTERMUTE: Small correction to greyscale conversion

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


diff --git a/engines/wintermute/base/gfx/opengl/base_surface_opengl3d.cpp b/engines/wintermute/base/gfx/opengl/base_surface_opengl3d.cpp
index 1ccd415cba4..74c9a738598 100644
--- a/engines/wintermute/base/gfx/opengl/base_surface_opengl3d.cpp
+++ b/engines/wintermute/base/gfx/opengl/base_surface_opengl3d.cpp
@@ -151,7 +151,7 @@ bool BaseSurfaceOpenGL3D::create(const Common::String &filename, bool defaultCK,
 		for (int x = 0; x < _imageData->w; x++) {
 			for (int y = 0; y < _imageData->h; y++) {
 				_imageData->format.colorToARGB(_imageData->getPixel(x, y), a, r, g, b);
-				uint8 grey = (uint8)(0.2126f * r + 0.7152f * g + 0.0722f * b);
+				uint8 grey = (uint8)((0.2126f * r + 0.7152f * g + 0.0722f * b) + 0.5f);
 				_imageData->setPixel(x, y, _imageData->format.ARGBToColor(a, grey, grey, grey));
 			}
 		}
diff --git a/engines/wintermute/base/gfx/osystem/base_surface_osystem.cpp b/engines/wintermute/base/gfx/osystem/base_surface_osystem.cpp
index 09456314f57..3096343d9d2 100644
--- a/engines/wintermute/base/gfx/osystem/base_surface_osystem.cpp
+++ b/engines/wintermute/base/gfx/osystem/base_surface_osystem.cpp
@@ -132,7 +132,7 @@ bool BaseSurfaceOSystem::finishLoad() {
 		for (int x = 0; x < _surface->w; x++) {
 			for (int y = 0; y < _surface->h; y++) {
 				_surface->format.colorToARGB(_surface->getPixel(x, y), a, r, g, b);
-				uint8 grey = (uint8)(0.2126f * r + 0.7152f * g + 0.0722f * b);
+				uint8 grey = (uint8)((0.2126f * r + 0.7152f * g + 0.0722f * b) + 0.5f);
 				_surface->setPixel(x, y, _surface->format.ARGBToColor(a, grey, grey, grey));
 			}
 		}




More information about the Scummvm-git-logs mailing list