aboutsummaryrefslogtreecommitdiff
path: root/backends/graphics/opengl/opengl-graphics.cpp
diff options
context:
space:
mode:
authorAlejandro Marzini2010-07-20 04:32:31 +0000
committerAlejandro Marzini2010-07-20 04:32:31 +0000
commit302400a701187eba6d0dee2daa253da87b29d83f (patch)
tree14ef4ab769860d534fa56a40949eb4e31e355db9 /backends/graphics/opengl/opengl-graphics.cpp
parent014d7b791c03c0c754ebc2d4ef2f2a961420a63a (diff)
downloadscummvm-rg350-302400a701187eba6d0dee2daa253da87b29d83f.tar.gz
scummvm-rg350-302400a701187eba6d0dee2daa253da87b29d83f.tar.bz2
scummvm-rg350-302400a701187eba6d0dee2daa253da87b29d83f.zip
OPENGL: Implement fullscreen mode.
svn-id: r51049
Diffstat (limited to 'backends/graphics/opengl/opengl-graphics.cpp')
-rw-r--r--backends/graphics/opengl/opengl-graphics.cpp39
1 files changed, 12 insertions, 27 deletions
diff --git a/backends/graphics/opengl/opengl-graphics.cpp b/backends/graphics/opengl/opengl-graphics.cpp
index 413f4221f1..540e1ada0e 100644
--- a/backends/graphics/opengl/opengl-graphics.cpp
+++ b/backends/graphics/opengl/opengl-graphics.cpp
@@ -226,9 +226,9 @@ OSystem::TransactionError OpenGLGraphicsManager::endGFXTransaction() {
}
#ifdef USE_RGB_COLOR
- if (_transactionDetails.sizeChanged || _transactionDetails.formatChanged) {
+ if (_transactionDetails.sizeChanged || _transactionDetails.formatChanged || _transactionDetails.needHotswap) {
#else
- if (_transactionDetails.sizeChanged) {
+ if (_transactionDetails.sizeChanged || _transactionDetails.needHotswap) {
#endif
unloadGFXMode();
if (!loadGFXMode()) {
@@ -243,20 +243,6 @@ OSystem::TransactionError OpenGLGraphicsManager::endGFXTransaction() {
_videoMode.setup = true;
_screenChangeCount++;
}
- } else if (_transactionDetails.needHotswap) {
- //setGraphicsModeIntern();
- if (!hotswapGFXMode()) {
- if (_oldVideoMode.setup) {
- _transactionMode = kTransactionRollback;
- errors |= endGFXTransaction();
- }
- } else {
- _videoMode.setup = true;
- _screenChangeCount++;
-
- if (_transactionDetails.needUpdatescreen)
- internUpdateScreen();
- }
} else if (_transactionDetails.needUpdatescreen) {
//setGraphicsModeIntern();
internUpdateScreen();
@@ -365,13 +351,16 @@ void OpenGLGraphicsManager::clearOverlay() {
}
void OpenGLGraphicsManager::grabOverlay(OverlayColor *buf, int pitch) {
- const Graphics::Surface* surface = _overlayTexture->getSurface();
+ const Graphics::Surface *surface = _overlayTexture->getSurface();
assert(surface->bytesPerPixel == sizeof(buf[0]));
- int h = surface->h;
+ uint w = _overlayTexture->getWidth();
+ uint h = _overlayTexture->getHeight();
+ const byte *src = (byte *)surface->pixels;
do {
- //memcpy(buf, surface->pixels, surface->w * sizeof(buf[0]));
- memset(buf, 0, surface->w * sizeof(buf[0]));
+ //memset(buf, 0, w * sizeof(buf[0]));
+ memcpy(buf, src, w * sizeof(buf[0]));
buf += pitch;
+ src += surface->pitch;
} while (--h);
}
@@ -600,19 +589,19 @@ bool OpenGLGraphicsManager::loadGFXMode() {
GLenum type;
getGLPixelFormat(_screenFormat, bpp, format, type);
_gameTexture = new GLTexture(bpp, format, type);
- } else
+ } else if (_transactionDetails.newContext)
_gameTexture->refresh();
_overlayFormat = Graphics::PixelFormat(2, 4, 4, 4, 4, 12, 8, 4, 0);
if (!_overlayTexture)
_overlayTexture = new GLTexture(2, GL_RGBA, GL_UNSIGNED_SHORT_4_4_4_4);
- else
+ else if (_transactionDetails.newContext)
_overlayTexture->refresh();
if (!_cursorTexture)
_cursorTexture = new GLTexture(4, GL_RGBA, GL_UNSIGNED_BYTE);
- else
+ else if (_transactionDetails.newContext)
_cursorTexture->refresh();
_gameTexture->allocBuffer(_videoMode.screenWidth, _videoMode.screenHeight);
@@ -628,10 +617,6 @@ void OpenGLGraphicsManager::unloadGFXMode() {
}
-bool OpenGLGraphicsManager::hotswapGFXMode() {
- return false;
-}
-
void OpenGLGraphicsManager::setScale(int newScale) {
if (newScale == _videoMode.scaleFactor)
return;