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

ccawley2011 noreply at scummvm.org
Tue Nov 23 23:18:40 UTC 2021


This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
3bd4e8c6a4 OPENGL: Restore cursor scaling
c0ea8e26c7 OPENGL: Fix crash when scaling small areas


Commit: 3bd4e8c6a46e0a3bebad11b85589e52c07230f0b
    https://github.com/scummvm/scummvm/commit/3bd4e8c6a46e0a3bebad11b85589e52c07230f0b
Author: Cameron Cawley (ccawley2011 at gmail.com)
Date: 2021-11-23T23:17:30Z

Commit Message:
OPENGL: Restore cursor scaling

Changed paths:
    backends/graphics/opengl/opengl-graphics.cpp


diff --git a/backends/graphics/opengl/opengl-graphics.cpp b/backends/graphics/opengl/opengl-graphics.cpp
index 133f68a3d9..0c49273aa4 100644
--- a/backends/graphics/opengl/opengl-graphics.cpp
+++ b/backends/graphics/opengl/opengl-graphics.cpp
@@ -786,6 +786,13 @@ void OpenGLGraphicsManager::setMouseCursor(const void *buf, uint w, uint h, int
 		delete _cursor;
 		_cursor = nullptr;
 
+#ifdef USE_SCALERS
+		bool wantScaler = (_currentState.scaleFactor > 1) && !dontScale
+		                && _scalerPlugins[_currentState.scalerIndex]->get<ScalerPluginObject>().canDrawCursor();
+#else
+		bool wantScaler = false;
+#endif
+
 		GLenum glIntFormat, glFormat, glType;
 
 		Graphics::PixelFormat textureFormat;
@@ -800,10 +807,14 @@ void OpenGLGraphicsManager::setMouseCursor(const void *buf, uint w, uint h, int
 		} else {
 			textureFormat = _defaultFormatAlpha;
 		}
-		// TODO: Enable SW scaling for cursors
-		_cursor = createSurface(textureFormat, true);
+		_cursor = createSurface(textureFormat, true, wantScaler);
 		assert(_cursor);
 		_cursor->enableLinearFiltering(_currentState.filtering);
+#ifdef USE_SCALERS
+		if (wantScaler) {
+			_cursor->setScaler(_currentState.scalerIndex, _currentState.scaleFactor);
+		}
+#endif
 	}
 
 	_cursor->allocate(w, h);


Commit: c0ea8e26c792c09768c30e08f0c81deba8896cc7
    https://github.com/scummvm/scummvm/commit/c0ea8e26c792c09768c30e08f0c81deba8896cc7
Author: Cameron Cawley (ccawley2011 at gmail.com)
Date: 2021-11-23T23:18:12Z

Commit Message:
OPENGL: Fix crash when scaling small areas

Changed paths:
    backends/graphics/opengl/texture.cpp


diff --git a/backends/graphics/opengl/texture.cpp b/backends/graphics/opengl/texture.cpp
index adc93e1f5a..e6b414e242 100644
--- a/backends/graphics/opengl/texture.cpp
+++ b/backends/graphics/opengl/texture.cpp
@@ -544,8 +544,13 @@ void ScaledTexture::updateGLTexture() {
 	dst = (byte *)outSurf->getBasePtr(dirtyArea.left * _scaleFactor, dirtyArea.top * _scaleFactor);
 	dstPitch = outSurf->pitch;
 
-	assert(_scaler);
-	_scaler->scale(src, srcPitch, dst, dstPitch, dirtyArea.width(), dirtyArea.height(), dirtyArea.left, dirtyArea.top);
+	if (_scaler && (uint)dirtyArea.height() >= _extraPixels) {
+		_scaler->scale(src, srcPitch, dst, dstPitch, dirtyArea.width(), dirtyArea.height(), dirtyArea.left, dirtyArea.top);
+	} else {
+		Graphics::scaleBlit(dst, src, dstPitch, srcPitch,
+		                    dirtyArea.width() * _scaleFactor, dirtyArea.height() * _scaleFactor,
+		                    dirtyArea.width(), dirtyArea.height(), outSurf->format);
+	}
 
 	dirtyArea.left   *= _scaleFactor;
 	dirtyArea.right  *= _scaleFactor;




More information about the Scummvm-git-logs mailing list