aboutsummaryrefslogtreecommitdiff
path: root/backends/graphics
diff options
context:
space:
mode:
authorJohannes Schickel2014-02-12 17:15:07 +0100
committerJohannes Schickel2014-02-12 17:15:07 +0100
commit6576dd758bfaf078abfb430d4b9c99b7047e4308 (patch)
treeed10d372ae1ee401827bdf4e12b1c81dd4117faa /backends/graphics
parent1709486859db9c38f5e4287e3e7fa817f76c1ee7 (diff)
downloadscummvm-rg350-6576dd758bfaf078abfb430d4b9c99b7047e4308.tar.gz
scummvm-rg350-6576dd758bfaf078abfb430d4b9c99b7047e4308.tar.bz2
scummvm-rg350-6576dd758bfaf078abfb430d4b9c99b7047e4308.zip
OPENGL: Simplify shake offset application.
Diffstat (limited to 'backends/graphics')
-rw-r--r--backends/graphics/opengl/opengl-graphics.cpp20
1 files changed, 3 insertions, 17 deletions
diff --git a/backends/graphics/opengl/opengl-graphics.cpp b/backends/graphics/opengl/opengl-graphics.cpp
index 925b2c5a82..a0651f2eb1 100644
--- a/backends/graphics/opengl/opengl-graphics.cpp
+++ b/backends/graphics/opengl/opengl-graphics.cpp
@@ -353,15 +353,7 @@ void OpenGLGraphicsManager::updateScreen() {
const GLfloat shakeOffset = _gameScreenShakeOffset * (GLfloat)_displayHeight / _gameScreen->getHeight();
// First step: Draw the (virtual) game screen.
- glPushMatrix();
-
- // Adjust game screen shake position
- GLCALL(glTranslatef(0, shakeOffset, 0));
-
- // Draw the game screen
- _gameScreen->draw(_displayX, _displayY, _displayWidth, _displayHeight);
-
- glPopMatrix();
+ _gameScreen->draw(_displayX, _displayY + shakeOffset, _displayWidth, _displayHeight);
// Second step: Draw the overlay if visible.
if (_overlayVisible) {
@@ -370,18 +362,12 @@ void OpenGLGraphicsManager::updateScreen() {
// Third step: Draw the cursor if visible.
if (_cursorVisible && _cursor) {
- glPushMatrix();
-
// Adjust game screen shake position, but only when the overlay is not
// visible.
- if (!_overlayVisible) {
- GLCALL(glTranslatef(0, shakeOffset, 0));
- }
+ const GLfloat cursorOffset = _overlayVisible ? 0 : shakeOffset;
- _cursor->draw(_cursorX - _cursorHotspotXScaled, _cursorY - _cursorHotspotYScaled,
+ _cursor->draw(_cursorX - _cursorHotspotXScaled, _cursorY - _cursorHotspotYScaled + cursorOffset,
_cursorWidthScaled, _cursorHeightScaled);
-
- glPopMatrix();
}
#ifdef USE_OSD