Skip to content

Commit

Permalink
SDL: Fix display artefacts with transparent OSD message
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
criezy committed Nov 11, 2017
1 parent 2b00829 commit b93fefe
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions backends/graphics/surfacesdl/surfacesdl-graphics.cpp
Expand Up @@ -2366,6 +2366,7 @@ void SurfaceSdlGraphicsManager::removeOSDMessage() {
// Remove the previous message
if (_osdMessageSurface) {
SDL_FreeSurface(_osdMessageSurface);
_forceRedraw = true;
}

_osdMessageSurface = NULL;
Expand All @@ -2387,16 +2388,15 @@ 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) {
removeOSDMessage();
}
}

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;
}
}
Expand Down

0 comments on commit b93fefe

Please sign in to comment.