From bf85ad820c48da5e1820f56496817d36161ec61f Mon Sep 17 00:00:00 2001 From: Patrik Dahlstrom Date: Thu, 9 Nov 2017 22:39:42 +0000 Subject: SDL: fix various OSD message artifacts On the OpenPandora handheld, the OSD message would not render unless you moved the cursor in the area where it was supposed to show. Additionally, the OSD message was not transparent like in v1.8. This commit fixes both these issues. --- backends/graphics/surfacesdl/surfacesdl-graphics.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'backends/graphics') diff --git a/backends/graphics/surfacesdl/surfacesdl-graphics.cpp b/backends/graphics/surfacesdl/surfacesdl-graphics.cpp index 262ea84096..90f9f7e1a1 100644 --- a/backends/graphics/surfacesdl/surfacesdl-graphics.cpp +++ b/backends/graphics/surfacesdl/surfacesdl-graphics.cpp @@ -2293,6 +2293,11 @@ void SurfaceSdlGraphicsManager::displayMessageOnOSD(const char *msg) { // Init the OSD display parameters, and the fade out _osdMessageAlpha = SDL_ALPHA_TRANSPARENT + kOSDInitialAlpha * (SDL_ALPHA_OPAQUE - SDL_ALPHA_TRANSPARENT) / 100; _osdMessageFadeStartTime = SDL_GetTicks() + kOSDFadeOutDelay; + // Enable alpha blending + SDL_SetAlpha(_osdMessageSurface, SDL_RLEACCEL | SDL_SRCALPHA, _osdMessageAlpha); + + // Ensure a full redraw takes place next time the screen is updated + _forceRedraw = true; } SDL_Rect SurfaceSdlGraphicsManager::getOSDMessageRect() const { @@ -2381,7 +2386,7 @@ 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; } - SDL_SetAlpha(_osdMessageSurface, SDL_RLEACCEL | SDL_SRCCOLORKEY | SDL_SRCALPHA, _osdMessageAlpha); + SDL_SetAlpha(_osdMessageSurface, SDL_RLEACCEL | SDL_SRCALPHA, _osdMessageAlpha); _forceRedraw = true; } -- cgit v1.2.3