From 30cbd35e740b801313be83209eec6956feeb512d Mon Sep 17 00:00:00 2001 From: Alejandro Marzini Date: Fri, 3 Sep 2010 03:47:05 +0000 Subject: OPENGL: Fix enable aspect ratio feature. svn-id: r52502 --- backends/graphics/opengl/opengl-graphics.cpp | 7 +++++-- backends/graphics/opengl/opengl-graphics.h | 2 ++ backends/graphics/openglsdl/openglsdl-graphics.cpp | 5 +++++ 3 files changed, 12 insertions(+), 2 deletions(-) (limited to 'backends') diff --git a/backends/graphics/opengl/opengl-graphics.cpp b/backends/graphics/opengl/opengl-graphics.cpp index a920aaffbf..187a7aec26 100644 --- a/backends/graphics/opengl/opengl-graphics.cpp +++ b/backends/graphics/opengl/opengl-graphics.cpp @@ -48,7 +48,8 @@ OpenGLGraphicsManager::OpenGLGraphicsManager() _cursorVisible(false), _cursorKeyColor(0), _cursorTargetScale(1), _formatBGR(false), - _displayX(0), _displayY(0), _displayWidth(0), _displayHeight(0) { + _displayX(0), _displayY(0), _displayWidth(0), _displayHeight(0), + _aspectRatioCorrection(false) { memset(&_oldVideoMode, 0, sizeof(_oldVideoMode)); memset(&_videoMode, 0, sizeof(_videoMode)); @@ -95,7 +96,8 @@ bool OpenGLGraphicsManager::hasFeature(OSystem::Feature f) { void OpenGLGraphicsManager::setFeatureState(OSystem::Feature f, bool enable) { switch (f) { case OSystem::kFeatureAspectRatioCorrection: - setGraphicsMode(enable ? OpenGL::GFX_CONSERVE : OpenGL::GFX_NORMAL); + _videoMode.mode = OpenGL::GFX_4_3; + _aspectRatioCorrection = enable; break; default: break; @@ -1293,6 +1295,7 @@ void OpenGLGraphicsManager::switchDisplayMode(int mode) { _videoMode.mode = mode; _transactionDetails.needRefresh = true; + _aspectRatioCorrection = false; } } diff --git a/backends/graphics/opengl/opengl-graphics.h b/backends/graphics/opengl/opengl-graphics.h index f4e26f43ec..460b3806e8 100644 --- a/backends/graphics/opengl/opengl-graphics.h +++ b/backends/graphics/opengl/opengl-graphics.h @@ -189,6 +189,8 @@ protected: virtual void calculateDisplaySize(int &width, int &height); virtual void refreshDisplaySize(); + bool _aspectRatioCorrection; + /** * Returns the current target aspect ratio x 10000 */ diff --git a/backends/graphics/openglsdl/openglsdl-graphics.cpp b/backends/graphics/openglsdl/openglsdl-graphics.cpp index c10dbf0d8f..447bc77afe 100644 --- a/backends/graphics/openglsdl/openglsdl-graphics.cpp +++ b/backends/graphics/openglsdl/openglsdl-graphics.cpp @@ -315,6 +315,10 @@ bool OpenGLSdlGraphicsManager::setupFullscreenMode() { } bool OpenGLSdlGraphicsManager::loadGFXMode() { + // Force 4/3 if feature enabled + if (_aspectRatioCorrection) + _videoMode.mode = OpenGL::GFX_4_3; + _videoMode.overlayWidth = _videoMode.screenWidth * _videoMode.scaleFactor; _videoMode.overlayHeight = _videoMode.screenHeight * _videoMode.scaleFactor; @@ -587,6 +591,7 @@ bool OpenGLSdlGraphicsManager::notifyEvent(const Common::Event &event) { beginGFXTransaction(); _videoMode.mode = sdlKey - (isNormalNumber ? SDLK_1 : SDLK_KP1); _transactionDetails.needRefresh = true; + _aspectRatioCorrection = false; endGFXTransaction(); #ifdef USE_OSD if (lastMode != _videoMode.mode) -- cgit v1.2.3