From 0ddfe927cec767631161a23d55b9c07fff925745 Mon Sep 17 00:00:00 2001 From: Cameron Cawley Date: Fri, 21 Jun 2019 16:12:23 +0100 Subject: OPENGLSDL: Move getSupportedFormats into OpenGLGraphicsManager --- backends/graphics/opengl/opengl-graphics.cpp | 48 +++++++++++++++++++++ backends/graphics/opengl/opengl-graphics.h | 2 +- backends/graphics/openglsdl/openglsdl-graphics.cpp | 50 ---------------------- backends/graphics/openglsdl/openglsdl-graphics.h | 5 --- 4 files changed, 49 insertions(+), 56 deletions(-) (limited to 'backends/graphics') diff --git a/backends/graphics/opengl/opengl-graphics.cpp b/backends/graphics/opengl/opengl-graphics.cpp index 6eb961a9d4..c603070751 100644 --- a/backends/graphics/opengl/opengl-graphics.cpp +++ b/backends/graphics/opengl/opengl-graphics.cpp @@ -184,6 +184,54 @@ int OpenGLGraphicsManager::getGraphicsMode() const { Graphics::PixelFormat OpenGLGraphicsManager::getScreenFormat() const { return _currentState.gameFormat; } + +Common::List OpenGLGraphicsManager::getSupportedFormats() const { + Common::List formats; + + // Our default mode is (memory layout wise) RGBA8888 which is a different + // logical layout depending on the endianness. We chose this mode because + // it is the only 32bit color mode we can safely assume to be present in + // OpenGL and OpenGL ES implementations. Thus, we need to supply different + // logical formats based on endianness. +#ifdef SCUMM_LITTLE_ENDIAN + // ABGR8888 + formats.push_back(Graphics::PixelFormat(4, 8, 8, 8, 8, 0, 8, 16, 24)); +#else + // RGBA8888 + formats.push_back(Graphics::PixelFormat(4, 8, 8, 8, 8, 24, 16, 8, 0)); +#endif + // RGB565 + formats.push_back(Graphics::PixelFormat(2, 5, 6, 5, 0, 11, 5, 0, 0)); + // RGBA5551 + formats.push_back(Graphics::PixelFormat(2, 5, 5, 5, 1, 11, 6, 1, 0)); + // RGBA4444 + formats.push_back(Graphics::PixelFormat(2, 4, 4, 4, 4, 12, 8, 4, 0)); + +#if !USE_FORCED_GLES && !USE_FORCED_GLES2 +#if !USE_FORCED_GL + if (!isGLESContext()) { +#endif +#ifdef SCUMM_LITTLE_ENDIAN + // RGBA8888 + formats.push_back(Graphics::PixelFormat(4, 8, 8, 8, 8, 24, 16, 8, 0)); +#else + // ABGR8888 + formats.push_back(Graphics::PixelFormat(4, 8, 8, 8, 8, 0, 8, 16, 24)); +#endif +#if !USE_FORCED_GL + } +#endif +#endif + + // RGB555, this is used by SCUMM HE 16 bit games. + // This is not natively supported by OpenGL ES implementations, we convert + // the pixel format internally. + formats.push_back(Graphics::PixelFormat(2, 5, 5, 5, 0, 10, 5, 0, 0)); + + formats.push_back(Graphics::PixelFormat::createFormatCLUT8()); + + return formats; +} #endif void OpenGLGraphicsManager::beginGFXTransaction() { diff --git a/backends/graphics/opengl/opengl-graphics.h b/backends/graphics/opengl/opengl-graphics.h index df968aa67e..2e1df99534 100644 --- a/backends/graphics/opengl/opengl-graphics.h +++ b/backends/graphics/opengl/opengl-graphics.h @@ -72,7 +72,7 @@ public: #ifdef USE_RGB_COLOR virtual Graphics::PixelFormat getScreenFormat() const override; - virtual Common::List getSupportedFormats() const override = 0; + virtual Common::List getSupportedFormats() const override; #endif virtual void beginGFXTransaction() override; diff --git a/backends/graphics/openglsdl/openglsdl-graphics.cpp b/backends/graphics/openglsdl/openglsdl-graphics.cpp index a7e7cb1ba0..f76a100521 100644 --- a/backends/graphics/openglsdl/openglsdl-graphics.cpp +++ b/backends/graphics/openglsdl/openglsdl-graphics.cpp @@ -330,56 +330,6 @@ void OpenGLSdlGraphicsManager::initSize(uint w, uint h, const Graphics::PixelFor return OpenGLGraphicsManager::initSize(w, h, format); } -#ifdef USE_RGB_COLOR -Common::List OpenGLSdlGraphicsManager::getSupportedFormats() const { - Common::List formats; - - // Our default mode is (memory layout wise) RGBA8888 which is a different - // logical layout depending on the endianness. We chose this mode because - // it is the only 32bit color mode we can safely assume to be present in - // OpenGL and OpenGL ES implementations. Thus, we need to supply different - // logical formats based on endianness. -#ifdef SCUMM_LITTLE_ENDIAN - // ABGR8888 - formats.push_back(Graphics::PixelFormat(4, 8, 8, 8, 8, 0, 8, 16, 24)); -#else - // RGBA8888 - formats.push_back(Graphics::PixelFormat(4, 8, 8, 8, 8, 24, 16, 8, 0)); -#endif - // RGB565 - formats.push_back(Graphics::PixelFormat(2, 5, 6, 5, 0, 11, 5, 0, 0)); - // RGBA5551 - formats.push_back(Graphics::PixelFormat(2, 5, 5, 5, 1, 11, 6, 1, 0)); - // RGBA4444 - formats.push_back(Graphics::PixelFormat(2, 4, 4, 4, 4, 12, 8, 4, 0)); - -#if !USE_FORCED_GLES && !USE_FORCED_GLES2 -#if !USE_FORCED_GL - if (!isGLESContext()) { -#endif -#ifdef SCUMM_LITTLE_ENDIAN - // RGBA8888 - formats.push_back(Graphics::PixelFormat(4, 8, 8, 8, 8, 24, 16, 8, 0)); -#else - // ABGR8888 - formats.push_back(Graphics::PixelFormat(4, 8, 8, 8, 8, 0, 8, 16, 24)); -#endif -#if !USE_FORCED_GL - } -#endif -#endif - - // RGB555, this is used by SCUMM HE 16 bit games. - // This is not natively supported by OpenGL ES implementations, we convert - // the pixel format internally. - formats.push_back(Graphics::PixelFormat(2, 5, 5, 5, 0, 10, 5, 0, 0)); - - formats.push_back(Graphics::PixelFormat::createFormatCLUT8()); - - return formats; -} -#endif - void OpenGLSdlGraphicsManager::updateScreen() { if (_ignoreResizeEvents) { --_ignoreResizeEvents; diff --git a/backends/graphics/openglsdl/openglsdl-graphics.h b/backends/graphics/openglsdl/openglsdl-graphics.h index e30c2b8e49..ff2277669e 100644 --- a/backends/graphics/openglsdl/openglsdl-graphics.h +++ b/backends/graphics/openglsdl/openglsdl-graphics.h @@ -49,11 +49,6 @@ public: virtual int getStretchMode() const override; virtual void initSize(uint w, uint h, const Graphics::PixelFormat *format) override; - -#ifdef USE_RGB_COLOR - virtual Common::List getSupportedFormats() const override; -#endif - virtual void updateScreen() override; // EventObserver API -- cgit v1.2.3