[Scummvm-git-logs] scummvm master -> 752f4e4f0432ba3a4b992590fbd568a5862370a4

csnover csnover at users.noreply.github.com
Wed Oct 18 01:42:38 CEST 2017


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:
752f4e4f04 SDL: Fix missing scaled cursors in SDL 2.0.4 on Windows


Commit: 752f4e4f0432ba3a4b992590fbd568a5862370a4
    https://github.com/scummvm/scummvm/commit/752f4e4f0432ba3a4b992590fbd568a5862370a4
Author: Colin Snover (github.com at zetafleet.com)
Date: 2017-10-17T18:41:34-05:00

Commit Message:
SDL: Fix missing scaled cursors in SDL 2.0.4 on Windows

This may be a problem with SDL 2.0.4 generally, not just on
Windows, but it doesn't really matter much since it can't be
broken on *any* platform.

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


diff --git a/backends/graphics/surfacesdl/surfacesdl-graphics.cpp b/backends/graphics/surfacesdl/surfacesdl-graphics.cpp
index 56579de..b616914 100644
--- a/backends/graphics/surfacesdl/surfacesdl-graphics.cpp
+++ b/backends/graphics/surfacesdl/surfacesdl-graphics.cpp
@@ -1986,9 +1986,11 @@ void SurfaceSdlGraphicsManager::blitCursor() {
 											 format->Gmask,
 											 format->Bmask,
 											 format->Amask);
-#if SDL_VERSION_ATLEAST(2, 0, 0)
-		SDL_BlitScaled(_mouseOrigSurface, nullptr, _mouseSurface, nullptr);
-#else
+
+		// At least SDL 2.0.4 on Windows apparently has a broken SDL_BlitScaled
+		// implementation, and SDL 1 has no such API at all, and our other
+		// scalers operate exclusively at 16bpp, so here is a scrappy 32bpp
+		// point scaler
 		SDL_LockSurface(_mouseOrigSurface);
 		SDL_LockSurface(_mouseSurface);
 
@@ -1996,22 +1998,23 @@ void SurfaceSdlGraphicsManager::blitCursor() {
 		byte *dst = (byte *)_mouseSurface->pixels;
 		for (int y = 0; y < _mouseOrigSurface->h; ++y) {
 			uint32 *rowDst = (uint32 *)dst;
-			for (int scaleY = 0; scaleY < cursorScale; ++scaleY) {
-				const uint32 *rowSrc = (const uint32 *)src;
-				for (int x = 0; x < _mouseOrigSurface->w; ++x) {
-					for (int scaleX = 0; scaleX < cursorScale; ++scaleX) {
-						*rowDst++ = *rowSrc;
-					}
-					++rowSrc;
+			const uint32 *rowSrc = (const uint32 *)src;
+			for (int x = 0; x < _mouseOrigSurface->w; ++x) {
+				for (int scaleX = 0; scaleX < cursorScale; ++scaleX) {
+					*rowDst++ = *rowSrc;
 				}
+				++rowSrc;
+			}
+			for (int scaleY = 0; scaleY < cursorScale - 1; ++scaleY) {
+				memcpy(dst + _mouseSurface->pitch, dst, _mouseSurface->pitch);
 				dst += _mouseSurface->pitch;
 			}
+			dst += _mouseSurface->pitch;
 			src += _mouseOrigSurface->pitch;
 		}
 
 		SDL_UnlockSurface(_mouseSurface);
 		SDL_UnlockSurface(_mouseOrigSurface);
-#endif
 		return;
 	}
 





More information about the Scummvm-git-logs mailing list