From 7941e5d530430d07204384f7994efbe17dc9a8f5 Mon Sep 17 00:00:00 2001 From: Bastien Bouclet Date: Mon, 3 Oct 2016 07:16:22 +0200 Subject: [PATCH] SDL: Switch to full screen updates when the OSD is transparent Previous releases also did full screen updates for transparent OSD messages. There should be no performance regression with that regard. Computing smaller update rects is non trivial, but should be looked into if performance is an issue for OSD icons. Fixes #9598 --- .../graphics/surfacesdl/surfacesdl-graphics.cpp | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/backends/graphics/surfacesdl/surfacesdl-graphics.cpp b/backends/graphics/surfacesdl/surfacesdl-graphics.cpp index adb84bfb241..46e243c9453 100644 --- a/backends/graphics/surfacesdl/surfacesdl-graphics.cpp +++ b/backends/graphics/surfacesdl/surfacesdl-graphics.cpp @@ -2176,9 +2176,8 @@ void SurfaceSdlGraphicsManager::displayActivityIconOnOSD(const Graphics::Surface Common::StackLock lock(_graphicsMutex); // Lock the mutex until this function ends if (_osdIconSurface && !icon) { - // Add a dirty rect to clear the icon on the next update - SDL_Rect dstRect = getOSDIconRect(); - addDirtyRect(dstRect.x, dstRect.y, dstRect.w, dstRect.h, true); + // Force a redraw to clear the icon on the next update + _forceFull = true; } if (_osdIconSurface) { @@ -2249,6 +2248,7 @@ void SurfaceSdlGraphicsManager::updateOSD() { _osdMessageAlpha = startAlpha + diff * (SDL_ALPHA_TRANSPARENT - startAlpha) / kOSDFadeOutDuration; } SDL_SetAlpha(_osdMessageSurface, SDL_RLEACCEL | SDL_SRCCOLORKEY | SDL_SRCALPHA, _osdMessageAlpha); + _forceFull = true; } if (_osdMessageAlpha == SDL_ALPHA_TRANSPARENT) { @@ -2256,14 +2256,9 @@ void SurfaceSdlGraphicsManager::updateOSD() { } } - if (_osdMessageSurface) { - SDL_Rect dstRect = getOSDMessageRect(); - addDirtyRect(dstRect.x, dstRect.y, dstRect.w, dstRect.h, true); - } - if (_osdIconSurface) { - SDL_Rect dstRect = getOSDIconRect(); - addDirtyRect(dstRect.x, dstRect.y, dstRect.w, dstRect.h, true); + // Redraw the area below the icon for the transparent blit to give correct results. + _forceFull = true; } }