[Scummvm-git-logs] scummvm master -> 0ac6d90ca46c01544e22377de138a6e672aa1ad7
bluegr
noreply at scummvm.org
Tue Sep 8 06:22:13 UTC 2026
This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://api.github.com/repos/scummvm/scummvm .
Summary:
1ce6a9973b SURFACESDL: Fix setting the colour key for mouse cursors with SDL3
0ac6d90ca4 SURFACESDL: Fix setting the blend mode for the OSD with SDL3
Commit: 1ce6a9973b337059905b04d16871d64cd8031c55
https://github.com/scummvm/scummvm/commit/1ce6a9973b337059905b04d16871d64cd8031c55
Author: Cameron Cawley (ccawley2011 at gmail.com)
Date: 2026-09-08T09:22:09+03:00
Commit Message:
SURFACESDL: Fix setting the colour key for mouse cursors with SDL3
Changed paths:
backends/graphics/surfacesdl/surfacesdl-graphics.cpp
backends/graphics/surfacesdl/surfacesdl-graphics.h
diff --git a/backends/graphics/surfacesdl/surfacesdl-graphics.cpp b/backends/graphics/surfacesdl/surfacesdl-graphics.cpp
index 02abddf9133..b20c86d4cb4 100644
--- a/backends/graphics/surfacesdl/surfacesdl-graphics.cpp
+++ b/backends/graphics/surfacesdl/surfacesdl-graphics.cpp
@@ -57,7 +57,6 @@
// SDL surface flags which got removed in SDL2.
#if SDL_VERSION_ATLEAST(2, 0, 0)
-#define SDL_SRCCOLORKEY 0
#define SDL_SRCALPHA 0
#define SDL_FULLSCREEN 0x40000000
#endif
@@ -2312,8 +2311,10 @@ void SurfaceSdlGraphicsManager::setMouseCursor(const void *buf, uint w, uint h,
if (keycolorChanged) {
#if SDL_VERSION_ATLEAST(3, 0, 0)
- uint32 flags = _disableMouseKeyColor ? 0 : SDL_SRCCOLORKEY | SDL_SRCALPHA;
- SDL_SetSurfaceColorKey(_mouseOrigSurface, flags, _mouseKeyColor);
+ SDL_SetSurfaceColorKey(_mouseOrigSurface, !_disableMouseKeyColor, _mouseKeyColor);
+ SDL_SetSurfaceRLE(_mouseOrigSurface, !_disableMouseKeyColor);
+#elif SDL_VERSION_ATLEAST(2, 0, 0)
+ SDL_SetColorKey(_mouseOrigSurface, !_disableMouseKeyColor, _mouseKeyColor);
SDL_SetSurfaceRLE(_mouseOrigSurface, !_disableMouseKeyColor);
#else
uint32 flags = _disableMouseKeyColor ? 0 : SDL_RLEACCEL | SDL_SRCCOLORKEY | SDL_SRCALPHA;
@@ -2429,8 +2430,10 @@ void SurfaceSdlGraphicsManager::blitCursor() {
SDL_SetColors(_mouseSurface, _cursorPaletteDisabled ? _currentPalette : _cursorPalette, 0, 256);
#if SDL_VERSION_ATLEAST(3, 0, 0)
- uint32 flags = _disableMouseKeyColor ? 0 : SDL_SRCCOLORKEY | SDL_SRCALPHA;
- SDL_SetSurfaceColorKey(_mouseSurface, flags, _mouseKeyColor);
+ SDL_SetSurfaceColorKey(_mouseSurface, !_disableMouseKeyColor, _mouseKeyColor);
+ SDL_SetSurfaceRLE(_mouseSurface, !_disableMouseKeyColor);
+#elif SDL_VERSION_ATLEAST(2, 0, 0)
+ SDL_SetColorKey(_mouseSurface, !_disableMouseKeyColor, _mouseKeyColor);
SDL_SetSurfaceRLE(_mouseSurface, !_disableMouseKeyColor);
#else
uint32 flags = _disableMouseKeyColor ? 0 : SDL_RLEACCEL | SDL_SRCCOLORKEY | SDL_SRCALPHA;
@@ -3241,14 +3244,6 @@ int SurfaceSdlGraphicsManager::SDL_SetAlpha(SDL_Surface *surface, Uint32 flag, U
return 0;
}
-int SurfaceSdlGraphicsManager::SDL_SetColorKey(SDL_Surface *surface, Uint32 flag, Uint32 key) {
-#if SDL_VERSION_ATLEAST(3, 0, 0)
- return SDL_SetSurfaceColorKey(surface, flag, key) ? -1 : 0;
-#else
- return ::SDL_SetColorKey(surface, flag ? SDL_TRUE : SDL_FALSE, key) ? -1 : 0;
-#endif
-}
-
#if defined(USE_IMGUI) && (defined(USE_IMGUI_SDLRENDERER2) || defined(USE_IMGUI_SDLRENDERER3))
void *SurfaceSdlGraphicsManager::getImGuiTexture(const Graphics::Surface &image, const byte *palette, int palCount) {
diff --git a/backends/graphics/surfacesdl/surfacesdl-graphics.h b/backends/graphics/surfacesdl/surfacesdl-graphics.h
index b45e2483bce..eb69e86412d 100644
--- a/backends/graphics/surfacesdl/surfacesdl-graphics.h
+++ b/backends/graphics/surfacesdl/surfacesdl-graphics.h
@@ -204,7 +204,6 @@ protected:
virtual void SDL_UpdateRects(SDL_Surface *screen, int numrects, SDL_Rect *rects);
int SDL_SetColors(SDL_Surface *surface, SDL_Color *colors, int firstcolor, int ncolors);
int SDL_SetAlpha(SDL_Surface *surface, Uint32 flag, Uint8 alpha);
- int SDL_SetColorKey(SDL_Surface *surface, Uint32 flag, Uint32 key);
#endif
/** Unseen game screen */
Commit: 0ac6d90ca46c01544e22377de138a6e672aa1ad7
https://github.com/scummvm/scummvm/commit/0ac6d90ca46c01544e22377de138a6e672aa1ad7
Author: Cameron Cawley (ccawley2011 at gmail.com)
Date: 2026-09-08T09:22:09+03:00
Commit Message:
SURFACESDL: Fix setting the blend mode for the OSD with SDL3
Changed paths:
backends/graphics/surfacesdl/surfacesdl-graphics.cpp
backends/graphics/surfacesdl/surfacesdl-graphics.h
diff --git a/backends/graphics/surfacesdl/surfacesdl-graphics.cpp b/backends/graphics/surfacesdl/surfacesdl-graphics.cpp
index b20c86d4cb4..ad7bc1a82fd 100644
--- a/backends/graphics/surfacesdl/surfacesdl-graphics.cpp
+++ b/backends/graphics/surfacesdl/surfacesdl-graphics.cpp
@@ -57,7 +57,6 @@
// SDL surface flags which got removed in SDL2.
#if SDL_VERSION_ATLEAST(2, 0, 0)
-#define SDL_SRCALPHA 0
#define SDL_FULLSCREEN 0x40000000
#endif
@@ -986,7 +985,11 @@ bool SurfaceSdlGraphicsManager::loadGFXMode() {
error("allocating _screen failed");
// Avoid having SDL_SRCALPHA set even if we supplied an alpha-channel in the format.
+#if SDL_VERSION_ATLEAST(2, 0, 0)
+ SDL_SetSurfaceBlendMode(_screen, SDL_BLENDMODE_NONE);
+#else
SDL_SetAlpha(_screen, 0, 255);
+#endif
// SDL 1.2 palettes default to all black,
// SDL 1.3 palettes default to all white,
@@ -2686,8 +2689,9 @@ void SurfaceSdlGraphicsManager::displayMessageOnOSD(const Common::U32String &msg
_osdMessageAlpha = SDL_ALPHA_TRANSPARENT + kOSDInitialAlpha * (SDL_ALPHA_OPAQUE - SDL_ALPHA_TRANSPARENT) / 100;
_osdMessageFadeStartTime = SDL_GetTicks() + kOSDFadeOutDelay;
// Enable alpha blending
-#if SDL_VERSION_ATLEAST(3, 0, 0)
- SDL_SetAlpha(_osdMessageSurface, SDL_SRCALPHA, _osdMessageAlpha);
+#if SDL_VERSION_ATLEAST(2, 0, 0)
+ SDL_SetSurfaceAlphaMod(_osdMessageSurface, _osdMessageAlpha);
+ SDL_SetSurfaceBlendMode(_osdMessageSurface, SDL_BLENDMODE_BLEND);
SDL_SetSurfaceRLE(_osdMessageSurface, true);
#else
SDL_SetAlpha(_osdMessageSurface, SDL_RLEACCEL | SDL_SRCALPHA, _osdMessageAlpha);
@@ -2817,8 +2821,9 @@ void SurfaceSdlGraphicsManager::updateOSD() {
const int startAlpha = SDL_ALPHA_TRANSPARENT + kOSDInitialAlpha * (SDL_ALPHA_OPAQUE - SDL_ALPHA_TRANSPARENT) / 100;
_osdMessageAlpha = startAlpha + diff * (SDL_ALPHA_TRANSPARENT - startAlpha) / kOSDFadeOutDuration;
}
-#if SDL_VERSION_ATLEAST(3, 0, 0)
- SDL_SetAlpha(_osdMessageSurface, SDL_SRCALPHA, _osdMessageAlpha);
+#if SDL_VERSION_ATLEAST(2, 0, 0)
+ SDL_SetSurfaceAlphaMod(_osdMessageSurface, _osdMessageAlpha);
+ SDL_SetSurfaceBlendMode(_osdMessageSurface, SDL_BLENDMODE_BLEND);
SDL_SetSurfaceRLE(_osdMessageSurface, true);
#else
SDL_SetAlpha(_osdMessageSurface, SDL_RLEACCEL | SDL_SRCALPHA, _osdMessageAlpha);
@@ -3209,41 +3214,6 @@ int SurfaceSdlGraphicsManager::SDL_SetColors(SDL_Surface *surface, SDL_Color *co
return 0;
}
-int SurfaceSdlGraphicsManager::SDL_SetAlpha(SDL_Surface *surface, Uint32 flag, Uint8 alpha) {
-#if SDL_VERSION_ATLEAST(3, 0, 0)
- if (!SDL_SetSurfaceAlphaMod(surface, alpha)) {
- return -1;
- }
-
- if (alpha == 255 || !flag) {
- if (!SDL_SetSurfaceBlendMode(surface, SDL_BLENDMODE_NONE)) {
- return -1;
- }
- } else {
- if (!SDL_SetSurfaceBlendMode(surface, SDL_BLENDMODE_BLEND)) {
- return -1;
- }
- }
-#else
- if (SDL_SetSurfaceAlphaMod(surface, alpha)) {
- return -1;
- }
-
- if (alpha == 255 || !flag) {
- if (SDL_SetSurfaceBlendMode(surface, SDL_BLENDMODE_NONE)) {
- return -1;
- }
- } else {
- if (SDL_SetSurfaceBlendMode(surface, SDL_BLENDMODE_BLEND)) {
- return -1;
- }
- }
-#endif
-
-
- return 0;
-}
-
#if defined(USE_IMGUI) && (defined(USE_IMGUI_SDLRENDERER2) || defined(USE_IMGUI_SDLRENDERER3))
void *SurfaceSdlGraphicsManager::getImGuiTexture(const Graphics::Surface &image, const byte *palette, int palCount) {
diff --git a/backends/graphics/surfacesdl/surfacesdl-graphics.h b/backends/graphics/surfacesdl/surfacesdl-graphics.h
index eb69e86412d..c1f66d14a96 100644
--- a/backends/graphics/surfacesdl/surfacesdl-graphics.h
+++ b/backends/graphics/surfacesdl/surfacesdl-graphics.h
@@ -203,7 +203,6 @@ protected:
virtual SDL_Surface *SDL_SetVideoMode(int width, int height, int bpp, Uint32 flags);
virtual void SDL_UpdateRects(SDL_Surface *screen, int numrects, SDL_Rect *rects);
int SDL_SetColors(SDL_Surface *surface, SDL_Color *colors, int firstcolor, int ncolors);
- int SDL_SetAlpha(SDL_Surface *surface, Uint32 flag, Uint8 alpha);
#endif
/** Unseen game screen */
More information about the Scummvm-git-logs
mailing list