diff options
author | Alexander Tkachev | 2016-06-04 15:56:15 +0600 |
---|---|---|
committer | Alexander Tkachev | 2016-08-24 16:07:55 +0600 |
commit | 1b9987ddc9ff7a69d0de5bbbbd4aee42fff08b42 (patch) | |
tree | 35ccde24b612b888f20cf38acfe8ba991f691b9a | |
parent | b32c2be78dfa88cdb8bb90174fe6fef8757ae85a (diff) | |
download | scummvm-rg350-1b9987ddc9ff7a69d0de5bbbbd4aee42fff08b42.tar.gz scummvm-rg350-1b9987ddc9ff7a69d0de5bbbbd4aee42fff08b42.tar.bz2 scummvm-rg350-1b9987ddc9ff7a69d0de5bbbbd4aee42fff08b42.zip |
GUI: Add getOSDFormat() and make OSD 32 bpp
-rw-r--r-- | backends/base-backend.cpp | 5 | ||||
-rw-r--r-- | backends/base-backend.h | 1 | ||||
-rw-r--r-- | backends/graphics/graphics.h | 2 | ||||
-rw-r--r-- | backends/graphics/opengl/opengl-graphics.cpp | 2 | ||||
-rw-r--r-- | backends/graphics/opengl/opengl-graphics.h | 1 | ||||
-rw-r--r-- | backends/graphics/surfacesdl/surfacesdl-graphics.cpp | 27 | ||||
-rw-r--r-- | backends/graphics/surfacesdl/surfacesdl-graphics.h | 3 | ||||
-rw-r--r-- | backends/modular-backend.cpp | 4 | ||||
-rw-r--r-- | backends/modular-backend.h | 1 | ||||
-rw-r--r-- | common/system.h | 6 |
10 files changed, 47 insertions, 5 deletions
diff --git a/backends/base-backend.cpp b/backends/base-backend.cpp index 59d674461c..dfb9e284ce 100644 --- a/backends/base-backend.cpp +++ b/backends/base-backend.cpp @@ -48,6 +48,11 @@ void BaseBackend::clearOSD() { //what should I do? Remove all TimedMessageDialogs? } +Graphics::PixelFormat BaseBackend::getOSDFormat() { + warning("BaseBackend::getOSDFormat not implemented"); + return Graphics::PixelFormat(); +} + void BaseBackend::initBackend() { // Init Event manager #ifndef DISABLE_DEFAULT_EVENT_MANAGER diff --git a/backends/base-backend.h b/backends/base-backend.h index edee427ca7..2394edaf38 100644 --- a/backends/base-backend.h +++ b/backends/base-backend.h @@ -35,6 +35,7 @@ public: virtual void displayMessageOnOSD(const char *msg); virtual void copyRectToOSD(const void *buf, int pitch, int x, int y, int w, int h); virtual void clearOSD(); + virtual Graphics::PixelFormat getOSDFormat(); virtual void fillScreen(uint32 col); }; diff --git a/backends/graphics/graphics.h b/backends/graphics/graphics.h index 1063a10a9c..921dfca61c 100644 --- a/backends/graphics/graphics.h +++ b/backends/graphics/graphics.h @@ -86,6 +86,8 @@ public: virtual void displayMessageOnOSD(const char *msg) {} virtual void copyRectToOSD(const void *buf, int pitch, int x, int y, int w, int h) {} virtual void clearOSD() {} + virtual Graphics::PixelFormat getOSDFormat() { return Graphics::PixelFormat(); } + // Graphics::PaletteManager interface //virtual void setPalette(const byte *colors, uint start, uint num) = 0; diff --git a/backends/graphics/opengl/opengl-graphics.cpp b/backends/graphics/opengl/opengl-graphics.cpp index 97788be3ad..c491b03f1f 100644 --- a/backends/graphics/opengl/opengl-graphics.cpp +++ b/backends/graphics/opengl/opengl-graphics.cpp @@ -774,6 +774,8 @@ void OpenGLGraphicsManager::clearOSD() { #endif } +Graphics::PixelFormat OpenGLGraphicsManager::getOSDFormat() { return Graphics::PixelFormat(); } //TODO + void OpenGLGraphicsManager::setPalette(const byte *colors, uint start, uint num) { assert(_gameScreen->hasPalette()); diff --git a/backends/graphics/opengl/opengl-graphics.h b/backends/graphics/opengl/opengl-graphics.h index f36d5d17f2..55d2c5c826 100644 --- a/backends/graphics/opengl/opengl-graphics.h +++ b/backends/graphics/opengl/opengl-graphics.h @@ -117,6 +117,7 @@ public: virtual void displayMessageOnOSD(const char *msg); virtual void copyRectToOSD(const void *buf, int pitch, int x, int y, int w, int h); virtual void clearOSD(); + virtual Graphics::PixelFormat getOSDFormat(); // PaletteManager interface virtual void setPalette(const byte *colors, uint start, uint num); diff --git a/backends/graphics/surfacesdl/surfacesdl-graphics.cpp b/backends/graphics/surfacesdl/surfacesdl-graphics.cpp index 4a33890f42..85e39839cb 100644 --- a/backends/graphics/surfacesdl/surfacesdl-graphics.cpp +++ b/backends/graphics/surfacesdl/surfacesdl-graphics.cpp @@ -883,13 +883,26 @@ bool SurfaceSdlGraphicsManager::loadGFXMode() { _osdSurface = SDL_CreateRGBSurface(SDL_SWSURFACE | SDL_RLEACCEL | SDL_SRCCOLORKEY | SDL_SRCALPHA, _hwscreen->w, _hwscreen->h, - 16, - _hwscreen->format->Rmask, - _hwscreen->format->Gmask, - _hwscreen->format->Bmask, - _hwscreen->format->Amask); + 32, + 0xFF000000, + 0x00FF0000, + 0x0000FF00, + 0x000000FF + ); if (_osdSurface == NULL) error("allocating _osdSurface failed"); + + _osdFormat.bytesPerPixel = _osdSurface->format->BytesPerPixel; + + _osdFormat.rLoss = _osdSurface->format->Rloss; + _osdFormat.gLoss = _osdSurface->format->Gloss; + _osdFormat.bLoss = _osdSurface->format->Bloss; + _osdFormat.aLoss = _osdSurface->format->Aloss; + + _osdFormat.rShift = _osdSurface->format->Rshift; + _osdFormat.gShift = _osdSurface->format->Gshift; + _osdFormat.bShift = _osdSurface->format->Bshift; + _osdFormat.aShift = _osdSurface->format->Ashift; SDL_SetColorKey(_osdSurface, SDL_RLEACCEL | SDL_SRCCOLORKEY | SDL_SRCALPHA, kOSDColorKey); #endif @@ -2277,6 +2290,10 @@ void SurfaceSdlGraphicsManager::clearOSD() { // Ensure a full redraw takes place next time the screen is updated _forceFull = true; } + +Graphics::PixelFormat SurfaceSdlGraphicsManager::getOSDFormat() { + return _osdFormat; +} #endif bool SurfaceSdlGraphicsManager::handleScalerHotkeys(Common::KeyCode key) { diff --git a/backends/graphics/surfacesdl/surfacesdl-graphics.h b/backends/graphics/surfacesdl/surfacesdl-graphics.h index 01974cf6ab..ff721ea6fc 100644 --- a/backends/graphics/surfacesdl/surfacesdl-graphics.h +++ b/backends/graphics/surfacesdl/surfacesdl-graphics.h @@ -147,6 +147,7 @@ public: virtual void displayMessageOnOSD(const char *msg); virtual void copyRectToOSD(const void *buf, int pitch, int x, int y, int w, int h); virtual void clearOSD(); + virtual Graphics::PixelFormat getOSDFormat(); #endif // Override from Common::EventObserver @@ -175,6 +176,8 @@ protected: kOSDColorKey = 1, /** < Transparent color key */ kOSDInitialAlpha = 80 /** < Initial alpha level, in percent */ }; + /** OSD pixel format */ + Graphics::PixelFormat _osdFormat; #endif /** Hardware screen */ diff --git a/backends/modular-backend.cpp b/backends/modular-backend.cpp index 6ad80ecbb3..e1bdf15571 100644 --- a/backends/modular-backend.cpp +++ b/backends/modular-backend.cpp @@ -249,6 +249,10 @@ void ModularBackend::clearOSD() { _graphicsManager->clearOSD(); } +Graphics::PixelFormat ModularBackend::getOSDFormat() { + return _graphicsManager->getOSDFormat(); +} + void ModularBackend::quit() { exit(0); } diff --git a/backends/modular-backend.h b/backends/modular-backend.h index 06c69b55ad..9cde27915f 100644 --- a/backends/modular-backend.h +++ b/backends/modular-backend.h @@ -129,6 +129,7 @@ public: virtual void displayMessageOnOSD(const char *msg); virtual void copyRectToOSD(const void *buf, int pitch, int x, int y, int w, int h); virtual void clearOSD(); + virtual Graphics::PixelFormat getOSDFormat(); //@} diff --git a/common/system.h b/common/system.h index 6071e4582b..3cbeee7d82 100644 --- a/common/system.h +++ b/common/system.h @@ -1119,6 +1119,12 @@ public: virtual void clearOSD() = 0; /** + * Returns 'on screen display' pixel format. + */ + + virtual Graphics::PixelFormat getOSDFormat() = 0; + + /** * Return the SaveFileManager, used to store and load savestates * and other modifiable persistent game data. For more information, * refer to the SaveFileManager documentation. |