aboutsummaryrefslogtreecommitdiff
path: root/backends/graphics/surfacesdl/surfacesdl-graphics.cpp
diff options
context:
space:
mode:
authorColin Snover2017-10-16 19:24:49 -0500
committerColin Snover2017-10-17 18:41:34 -0500
commit752f4e4f0432ba3a4b992590fbd568a5862370a4 (patch)
treeccce076a3978f1c116bdb6c890d0f8007976986c /backends/graphics/surfacesdl/surfacesdl-graphics.cpp
parent8057d888a6975136d9f3c5c4492fb3efa2f3baa9 (diff)
downloadscummvm-rg350-752f4e4f0432ba3a4b992590fbd568a5862370a4.tar.gz
scummvm-rg350-752f4e4f0432ba3a4b992590fbd568a5862370a4.tar.bz2
scummvm-rg350-752f4e4f0432ba3a4b992590fbd568a5862370a4.zip
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.
Diffstat (limited to 'backends/graphics/surfacesdl/surfacesdl-graphics.cpp')
-rw-r--r--backends/graphics/surfacesdl/surfacesdl-graphics.cpp25
1 files changed, 14 insertions, 11 deletions
diff --git a/backends/graphics/surfacesdl/surfacesdl-graphics.cpp b/backends/graphics/surfacesdl/surfacesdl-graphics.cpp
index 56579de74d..b616914e53 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;
}