From b89412d7e4a8473292a041f0fe6519ccd2d06621 Mon Sep 17 00:00:00 2001 From: Alejandro Marzini Date: Sat, 24 Jul 2010 05:54:51 +0000 Subject: OPENGL: Redesign blitting system. Add basics for aspect correction. Removed the extra surface in GLTexture. Now there are copies of the texture data in their original format (so engine can get the original data when lockScreen or grabOverlay is called). This copies will be updated when the engine calls a function that modifies the game screen/overlay, and the textures will be marked as dirty. When updating screen, the textures will be updated from the copies data if they are dirty. svn-id: r51234 --- backends/graphics/openglsdl/openglsdl-graphics.cpp | 29 +++++++++++++++++++--- backends/graphics/openglsdl/openglsdl-graphics.h | 3 +++ 2 files changed, 29 insertions(+), 3 deletions(-) (limited to 'backends/graphics/openglsdl') diff --git a/backends/graphics/openglsdl/openglsdl-graphics.cpp b/backends/graphics/openglsdl/openglsdl-graphics.cpp index aa0a9aa717..6f2ba0df9c 100644 --- a/backends/graphics/openglsdl/openglsdl-graphics.cpp +++ b/backends/graphics/openglsdl/openglsdl-graphics.cpp @@ -44,6 +44,28 @@ OpenGLSdlGraphicsManager::~OpenGLSdlGraphicsManager() { } + +bool OpenGLSdlGraphicsManager::hasFeature(OSystem::Feature f) { + return + (f == OSystem::kFeatureFullscreenMode) || + (f == OSystem::kFeatureIconifyWindow) || + OpenGLGraphicsManager::hasFeature(f); +} + +void OpenGLSdlGraphicsManager::setFeatureState(OSystem::Feature f, bool enable) { + switch (f) { + case OSystem::kFeatureFullscreenMode: + setFullscreenMode(enable); + break; + case OSystem::kFeatureIconifyWindow: + if (enable) + SDL_WM_IconifyWindow(); + break; + default: + OpenGLGraphicsManager::setFeatureState(f, enable); + } +} + #ifdef USE_RGB_COLOR const Graphics::PixelFormat RGBList[] = { @@ -202,9 +224,9 @@ void OpenGLSdlGraphicsManager::internUpdateScreen() { bool OpenGLSdlGraphicsManager::handleScalerHotkeys(Common::KeyCode key) { // Ctrl-Alt-a toggles aspect ratio correction - /*if (key == 'a') { + if (key == 'a') { beginGFXTransaction(); - setFeatureState(OSystem::kFeatureAspectRatioCorrection, !_videoMode.aspectRatioCorrection); + setAspectRatioCorrection(-1); endGFXTransaction(); #ifdef USE_OSD char buffer[128]; @@ -222,7 +244,7 @@ bool OpenGLSdlGraphicsManager::handleScalerHotkeys(Common::KeyCode key) { #endif internUpdateScreen(); return true; - }*/ + } // Ctrl-Alt-f toggles antialiasing if (key == 'f') { @@ -329,6 +351,7 @@ bool OpenGLSdlGraphicsManager::notifyEvent(const Common::Event &event) { _videoMode.hardwareHeight = event.mouse.y; _screenResized = true; _transactionDetails.sizeChanged = true; + _transactionDetails.newContext = true; endGFXTransaction(); return true; diff --git a/backends/graphics/openglsdl/openglsdl-graphics.h b/backends/graphics/openglsdl/openglsdl-graphics.h index b0bf12cd4d..f11782131c 100644 --- a/backends/graphics/openglsdl/openglsdl-graphics.h +++ b/backends/graphics/openglsdl/openglsdl-graphics.h @@ -42,6 +42,9 @@ public: OpenGLSdlGraphicsManager(); virtual ~OpenGLSdlGraphicsManager(); + virtual bool hasFeature(OSystem::Feature f); + virtual void setFeatureState(OSystem::Feature f, bool enable); + #ifdef USE_RGB_COLOR virtual Common::List getSupportedFormats() const; #endif -- cgit v1.2.3