diff options
author | Eugene Sandulenko | 2016-09-02 23:56:52 +0200 |
---|---|---|
committer | Eugene Sandulenko | 2016-09-02 23:57:13 +0200 |
commit | 2d39f75b7de67f19e3086ec4c4376ac154b54f07 (patch) | |
tree | 5d93fa4f83795703a56a08afec33bcc71dde866e /backends/graphics/gph | |
parent | 029e1c0d1a7dd0e7f5e01d4c895e6674c64e4c9f (diff) | |
download | scummvm-rg350-2d39f75b7de67f19e3086ec4c4376ac154b54f07.tar.gz scummvm-rg350-2d39f75b7de67f19e3086ec4c4376ac154b54f07.tar.bz2 scummvm-rg350-2d39f75b7de67f19e3086ec4c4376ac154b54f07.zip |
GPH: Attempt to fix OSD
Diffstat (limited to 'backends/graphics/gph')
-rw-r--r-- | backends/graphics/gph/gph-graphics.cpp | 48 |
1 files changed, 29 insertions, 19 deletions
diff --git a/backends/graphics/gph/gph-graphics.cpp b/backends/graphics/gph/gph-graphics.cpp index 65cb3d1d65..e698db83f7 100644 --- a/backends/graphics/gph/gph-graphics.cpp +++ b/backends/graphics/gph/gph-graphics.cpp @@ -278,23 +278,35 @@ void GPHGraphicsManager::internUpdateScreen() { } #ifdef USE_OSD - // OSD visible (i.e. non-transparent)? - if (_osdAlpha != SDL_ALPHA_TRANSPARENT) { - // Updated alpha value - const int diff = SDL_GetTicks() - _osdFadeStartTime; - if (diff > 0) { - if (diff >= kOSDFadeOutDuration) { - // Back to full transparency - _osdAlpha = SDL_ALPHA_TRANSPARENT; - } else { - // Do a linear fade out... - const int startAlpha = SDL_ALPHA_TRANSPARENT + kOSDInitialAlpha * (SDL_ALPHA_OPAQUE - SDL_ALPHA_TRANSPARENT) / 100; - _osdAlpha = startAlpha + diff * (SDL_ALPHA_TRANSPARENT - startAlpha) / kOSDFadeOutDuration; - } - SDL_SetAlpha(_osdSurface, SDL_RLEACCEL | SDL_SRCCOLORKEY | SDL_SRCALPHA, _osdAlpha); - _forceFull = true; +// 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) { @@ -428,9 +440,7 @@ void GPHGraphicsManager::internUpdateScreen() { drawMouse(); #ifdef USE_OSD - if (_osdAlpha != SDL_ALPHA_TRANSPARENT) { - SDL_BlitSurface(_osdSurface, 0, _hwscreen, 0); - } + SDL_BlitSurface(_osdSurface, 0, _hwscreen, 0); #endif // Finally, blit all our changes to the screen SDL_UpdateRects(_hwscreen, _numDirtyRects, _dirtyRectList); @@ -459,7 +469,7 @@ void GPHGraphicsManager::hideOverlay() { bool GPHGraphicsManager::loadGFXMode() { - // We don't offer anything other than fullscreen on GPH devices so let’s not even pretend. + // We don't offer anything other than fullscreen on GPH devices so let's not even pretend. _videoMode.fullscreen = true; // Set the hardware stats to match the LCD. |