aboutsummaryrefslogtreecommitdiff
path: root/backends/graphics/opengl
diff options
context:
space:
mode:
authorJohannes Schickel2011-03-17 19:47:18 +0100
committerJohannes Schickel2011-03-17 19:55:06 +0100
commit96979f73fc10679fc0112cfbc55d6b661d744b05 (patch)
treee861325c5555ff3786d1959a5b1b79575e7aa57a /backends/graphics/opengl
parent70e2c4266b20d09e4bc2d89fcd3d3fba6ddaade9 (diff)
downloadscummvm-rg350-96979f73fc10679fc0112cfbc55d6b661d744b05.tar.gz
scummvm-rg350-96979f73fc10679fc0112cfbc55d6b661d744b05.tar.bz2
scummvm-rg350-96979f73fc10679fc0112cfbc55d6b661d744b05.zip
OPENGL: Slight refactoring.
First step into making all state variables of the OpenGL backend private, to help making the backend more maintainable, by disallowing subclasses to just mess with everything...
Diffstat (limited to 'backends/graphics/opengl')
-rw-r--r--backends/graphics/opengl/opengl-graphics.cpp21
-rw-r--r--backends/graphics/opengl/opengl-graphics.h23
2 files changed, 39 insertions, 5 deletions
diff --git a/backends/graphics/opengl/opengl-graphics.cpp b/backends/graphics/opengl/opengl-graphics.cpp
index e9942b8eb4..5d23405eee 100644
--- a/backends/graphics/opengl/opengl-graphics.cpp
+++ b/backends/graphics/opengl/opengl-graphics.cpp
@@ -100,7 +100,12 @@ bool OpenGLGraphicsManager::hasFeature(OSystem::Feature f) {
void OpenGLGraphicsManager::setFeatureState(OSystem::Feature f, bool enable) {
switch (f) {
case OSystem::kFeatureAspectRatioCorrection:
- _videoMode.mode = OpenGL::GFX_4_3;
+ // TODO: If we enable aspect ratio correction, we automatically set
+ // the video mode to 4/3. That is quity messy, but since we have that
+ // messy OpenGL mode use there's not much to do about it right now...
+ // Think of a way to get rid of this mess.
+ if (enable)
+ _videoMode.mode = OpenGL::GFX_4_3;
_aspectRatioCorrection = enable;
break;
default:
@@ -109,7 +114,12 @@ void OpenGLGraphicsManager::setFeatureState(OSystem::Feature f, bool enable) {
}
bool OpenGLGraphicsManager::getFeatureState(OSystem::Feature f) {
- return false;
+ switch (f) {
+ case OSystem::kFeatureAspectRatioCorrection:
+ return _aspectRatioCorrection || (_videoMode.mode == OpenGL::GFX_4_3);
+ default:
+ return false;
+ }
}
//
@@ -1216,6 +1226,13 @@ void OpenGLGraphicsManager::setScale(int newScale) {
_transactionDetails.sizeChanged = true;
}
+void OpenGLGraphicsManager::toggleAntialiasing() {
+ assert(_transactionMode == kTransactionActive);
+
+ _videoMode.antialiasing = !_videoMode.antialiasing;
+ _transactionDetails.filterChanged = true;
+}
+
uint OpenGLGraphicsManager::getAspectRatio() {
if (_videoMode.mode == OpenGL::GFX_NORMAL)
return _videoMode.hardwareWidth * 10000 / _videoMode.hardwareHeight;
diff --git a/backends/graphics/opengl/opengl-graphics.h b/backends/graphics/opengl/opengl-graphics.h
index baebb9c95f..3eeb52fcc0 100644
--- a/backends/graphics/opengl/opengl-graphics.h
+++ b/backends/graphics/opengl/opengl-graphics.h
@@ -178,6 +178,23 @@ protected:
virtual void setScale(int newScale);
+ /**
+ * Query the scale factor.
+ */
+ inline int getScale() const { return _videoMode.scaleFactor; }
+
+ /**
+ * Toggle the antialiasing state of the current video mode.
+ *
+ * This can only be used in a GFX transaction.
+ */
+ void toggleAntialiasing();
+
+ /**
+ * Query the antialiasing state.
+ */
+ inline bool getAntialiasingState() const { return _videoMode.antialiasing; }
+
// Drawing coordinates for the current display mode and scale
int _displayX;
int _displayY;
@@ -195,13 +212,13 @@ protected:
virtual void calculateDisplaySize(int &width, int &height);
virtual void refreshDisplaySize();
- bool _aspectRatioCorrection;
-
/**
* Returns the current target aspect ratio x 10000
*/
virtual uint getAspectRatio();
+ bool _aspectRatioCorrection;
+
bool _formatBGR;
//
@@ -232,7 +249,7 @@ protected:
bool _overlayVisible;
bool _overlayNeedsRedraw;
Common::Rect _overlayDirtyRect;
-
+
virtual void refreshOverlay();
//