[Scummvm-git-logs] scummvm master -> 6b4195a542083c97f696c843b9823d578b018996

criezy criezy at scummvm.org
Sat Nov 11 01:20:44 CET 2017


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

Summary:
b93fefebe8 SDL: Fix display artefacts with transparent OSD message
1d1f898c01 SDL: Preserve mouse position when switching between OpenGL and SurfaceSDL backends
6b4195a542 SDL: Use RLE acceleration for SDL2 transparent surfaces


Commit: b93fefebe8f449d7522047283bab163b8c91d8a4
    https://github.com/scummvm/scummvm/commit/b93fefebe8f449d7522047283bab163b8c91d8a4
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2017-11-11T00:11:50Z

Commit Message:
SDL: Fix display artefacts with transparent OSD message

If we do not update the area below the message, it is just blitted on top
of itself again and again and gets progressively less transparent. It also
causes artefacts when the mouse pass below the OSD message.

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 90f9f7e..4a6061c 100644
--- a/backends/graphics/surfacesdl/surfacesdl-graphics.cpp
+++ b/backends/graphics/surfacesdl/surfacesdl-graphics.cpp
@@ -2366,6 +2366,7 @@ void SurfaceSdlGraphicsManager::removeOSDMessage() {
 	// Remove the previous message
 	if (_osdMessageSurface) {
 		SDL_FreeSurface(_osdMessageSurface);
+		_forceRedraw = true;
 	}
 
 	_osdMessageSurface = NULL;
@@ -2387,7 +2388,6 @@ void SurfaceSdlGraphicsManager::updateOSD() {
 				_osdMessageAlpha = startAlpha + diff * (SDL_ALPHA_TRANSPARENT - startAlpha) / kOSDFadeOutDuration;
 			}
 			SDL_SetAlpha(_osdMessageSurface, SDL_RLEACCEL | SDL_SRCALPHA, _osdMessageAlpha);
-			_forceRedraw = true;
 		}
 
 		if (_osdMessageAlpha == SDL_ALPHA_TRANSPARENT) {
@@ -2395,8 +2395,8 @@ void SurfaceSdlGraphicsManager::updateOSD() {
 		}
 	}
 
-	if (_osdIconSurface) {
-		// Redraw the area below the icon for the transparent blit to give correct results.
+	if (_osdIconSurface || _osdMessageSurface) {
+		// Redraw the area below the icon and message for the transparent blit to give correct results.
 		_forceRedraw = true;
 	}
 }


Commit: 1d1f898c012902c719b9f31c2db39e6026b8af69
    https://github.com/scummvm/scummvm/commit/1d1f898c012902c719b9f31c2db39e6026b8af69
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2017-11-11T00:15:13Z

Commit Message:
SDL: Preserve mouse position when switching between OpenGL and SurfaceSDL backends

Since those GraphcisManager initialize the cursor position to (0,0) when
created the cursor was jumping to the top left corner and then moving
back to its initial position as soon as the mouse was moved. Now it
stays at its initial position.

There are still some issues with it when changing between OpenGL and
SurfaceSDL at the same time as toggling fullscreen. But it is not worse
than before.

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


diff --git a/backends/graphics/sdl/sdl-graphics.cpp b/backends/graphics/sdl/sdl-graphics.cpp
index f4aaa92..864fc10 100644
--- a/backends/graphics/sdl/sdl-graphics.cpp
+++ b/backends/graphics/sdl/sdl-graphics.cpp
@@ -32,7 +32,9 @@ SdlGraphicsManager::SdlGraphicsManager(SdlEventSource *source, SdlWindow *window
 #if SDL_VERSION_ATLEAST(2, 0, 0)
 	, _allowWindowSizeReset(false), _hintedWidth(0), _hintedHeight(0), _lastFlags(0)
 #endif
-{}
+{
+	SDL_GetMouseState(&_cursorX, &_cursorY);
+}
 
 void SdlGraphicsManager::activateManager() {
 	_eventSource->setGraphicsManager(this);


Commit: 6b4195a542083c97f696c843b9823d578b018996
    https://github.com/scummvm/scummvm/commit/6b4195a542083c97f696c843b9823d578b018996
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2017-11-11T00:18:57Z

Commit Message:
SDL: Use RLE acceleration for SDL2 transparent surfaces

We were already doing it for SDL1.2, but with SDL2 the SDL_RLEACCEL
is not passed to SDL and instead we need to call SDL_SetSurfaceRLE.

Changed paths:
    backends/platform/sdl/sdl.cpp


diff --git a/backends/platform/sdl/sdl.cpp b/backends/platform/sdl/sdl.cpp
index f44d876..f2bf959 100644
--- a/backends/platform/sdl/sdl.cpp
+++ b/backends/platform/sdl/sdl.cpp
@@ -754,10 +754,13 @@ int SDL_SetAlpha(SDL_Surface *surface, Uint32 flag, Uint8 alpha) {
 		if (SDL_SetSurfaceBlendMode(surface, SDL_BLENDMODE_NONE)) {
 			return -1;
 		}
+		SDL_SetSurfaceRLE(surface, 0);
 	} else {
 		if (SDL_SetSurfaceBlendMode(surface, SDL_BLENDMODE_BLEND)) {
 			return -1;
 		}
+		if (flag & SDL_RLEACCEL)
+			SDL_SetSurfaceRLE(surface, 1);
 	}
 
 	return 0;
@@ -765,7 +768,13 @@ int SDL_SetAlpha(SDL_Surface *surface, Uint32 flag, Uint8 alpha) {
 
 #undef SDL_SetColorKey
 int SDL_SetColorKey_replacement(SDL_Surface *surface, Uint32 flag, Uint32 key) {
-	return SDL_SetColorKey(surface, SDL_TRUE, key) ? -1 : 0;
+	if (SDL_SetColorKey(surface, SDL_TRUE, key)) {
+		return -1;
+	}
+
+	if (flag & SDL_RLEACCEL)
+		SDL_SetSurfaceRLE(surface, 1);
+	return 0;
 }
 #endif
 





More information about the Scummvm-git-logs mailing list