From 05bc82b6225f79ad42e6259be8e227aed6e7c0dc Mon Sep 17 00:00:00 2001 From: Bastien Bouclet Date: Tue, 13 Sep 2016 20:33:42 +0200 Subject: SDL: Switch the surface renderer to use small surfaces for OSD drawing --- backends/graphics/gph/gph-graphics.cpp | 40 +++++----------------------------- 1 file changed, 6 insertions(+), 34 deletions(-) (limited to 'backends/graphics/gph') diff --git a/backends/graphics/gph/gph-graphics.cpp b/backends/graphics/gph/gph-graphics.cpp index bd0f246286..a19512110f 100644 --- a/backends/graphics/gph/gph-graphics.cpp +++ b/backends/graphics/gph/gph-graphics.cpp @@ -277,38 +277,6 @@ void GPHGraphicsManager::internUpdateScreen() { _forceFull = true; } -#ifdef USE_OSD - // OSD visible (i.e. non-transparent)? - if (_osdMessageAlpha != SDL_ALPHA_TRANSPARENT) { - // Updated alpha value - const int diff = SDL_GetTicks() - _osdMessageFadeStartTime; - if (diff > 0) { - if (diff >= kOSDFadeOutDuration) { - // Back to full transparency - _osdMessageAlpha = SDL_ALPHA_TRANSPARENT; - } else { - // Do a linear fade out... - const int startAlpha = SDL_ALPHA_TRANSPARENT + kOSDInitialAlpha * (SDL_ALPHA_OPAQUE - SDL_ALPHA_TRANSPARENT) / 100; - _osdMessageAlpha = startAlpha + diff * (SDL_ALPHA_TRANSPARENT - startAlpha) / kOSDFadeOutDuration; - } - _forceFull = true; - } - - if (_osdMessageAlpha == SDL_ALPHA_TRANSPARENT) { - removeOSDMessage(); - } else { - if (_osdMessageSurface && _osdSurface) { - SDL_Rect dstRect; - dstRect.x = (_osdSurface->w - _osdMessageSurface->w) / 2; - dstRect.y = (_osdSurface->h - _osdMessageSurface->h) / 2; - dstRect.w = _osdMessageSurface->w; - dstRect.h = _osdMessageSurface->h; - blitOSDMessage(dstRect); - } - } - } -#endif - if (!_overlayVisible) { origSurf = _screen; srcSurf = _tmpscreen; @@ -331,6 +299,10 @@ void GPHGraphicsManager::internUpdateScreen() { if (_mouseNeedsRedraw) undrawMouse(); +#ifdef USE_OSD + updateOSD(); +#endif + // Force a full redraw if requested if (_forceFull) { _numDirtyRects = 1; @@ -440,9 +412,9 @@ void GPHGraphicsManager::internUpdateScreen() { drawMouse(); #ifdef USE_OSD - if (_osdMessageAlpha != SDL_ALPHA_TRANSPARENT) - SDL_BlitSurface(_osdSurface, 0, _hwscreen, 0); + drawOSD(); #endif + // Finally, blit all our changes to the screen SDL_UpdateRects(_hwscreen, _numDirtyRects, _dirtyRectList); } -- cgit v1.2.3