mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-15 06:08:35 +00:00
OPENGL: Refactor screen refresh handling.
Subclasses of OpenGLGraphicsManager are now supposed to supply a refreshScreen function which handles actual screen updating (for example, buffer swapping).
This commit is contained in:
parent
3232050dfc
commit
fe2ee9ecf5
@ -431,6 +431,8 @@ void OpenGLGraphicsManager::updateScreen() {
|
||||
GLCALL(glColor4f(1.0f, 1.0f, 1.0f, 1.0f));
|
||||
}
|
||||
#endif
|
||||
|
||||
refreshScreen();
|
||||
}
|
||||
|
||||
Graphics::Surface *OpenGLGraphicsManager::lockScreen() {
|
||||
|
@ -262,6 +262,11 @@ protected:
|
||||
*/
|
||||
virtual bool loadVideoMode(uint requestedWidth, uint requestedHeight, const Graphics::PixelFormat &format) = 0;
|
||||
|
||||
/**
|
||||
* Refresh the screen contents.
|
||||
*/
|
||||
virtual void refreshScreen() = 0;
|
||||
|
||||
/**
|
||||
* Save a screenshot of the full display as BMP to the given file. This
|
||||
* uses Common::DumpFile for writing the screenshot.
|
||||
|
@ -236,13 +236,6 @@ void OpenGLSdlGraphicsManager::updateScreen() {
|
||||
}
|
||||
|
||||
OpenGLGraphicsManager::updateScreen();
|
||||
|
||||
// Swap OpenGL buffers
|
||||
#if SDL_VERSION_ATLEAST(2, 0, 0)
|
||||
SDL_GL_SwapWindow(_window->getSDLWindow());
|
||||
#else
|
||||
SDL_GL_SwapBuffers();
|
||||
#endif
|
||||
}
|
||||
|
||||
void OpenGLSdlGraphicsManager::notifyVideoExpose() {
|
||||
@ -301,6 +294,15 @@ bool OpenGLSdlGraphicsManager::loadVideoMode(uint requestedWidth, uint requested
|
||||
return setupMode(requestedWidth, requestedHeight);
|
||||
}
|
||||
|
||||
void OpenGLSdlGraphicsManager::refreshScreen() {
|
||||
// Swap OpenGL buffers
|
||||
#if SDL_VERSION_ATLEAST(2, 0, 0)
|
||||
SDL_GL_SwapWindow(_window->getSDLWindow());
|
||||
#else
|
||||
SDL_GL_SwapBuffers();
|
||||
#endif
|
||||
}
|
||||
|
||||
bool OpenGLSdlGraphicsManager::setupMode(uint width, uint height) {
|
||||
// In case we request a fullscreen mode we will use the mode the user
|
||||
// has chosen last time or the biggest mode available.
|
||||
|
@ -65,6 +65,8 @@ protected:
|
||||
virtual void setInternalMousePosition(int x, int y);
|
||||
|
||||
virtual bool loadVideoMode(uint requestedWidth, uint requestedHeight, const Graphics::PixelFormat &format);
|
||||
|
||||
virtual void refreshScreen();
|
||||
private:
|
||||
bool setupMode(uint width, uint height);
|
||||
|
||||
|
@ -127,7 +127,6 @@ void TizenGraphicsManager::setReady() {
|
||||
void TizenGraphicsManager::updateScreen() {
|
||||
if (!_initState) {
|
||||
OpenGLGraphicsManager::updateScreen();
|
||||
eglSwapBuffers(_eglDisplay, _eglSurface);
|
||||
}
|
||||
}
|
||||
|
||||
@ -203,3 +202,7 @@ bool TizenGraphicsManager::loadVideoMode(uint requestedWidth, uint requestedHeig
|
||||
// using a fixed output size we do nothing like that here.
|
||||
return true;
|
||||
}
|
||||
|
||||
void TizenGraphicsManager::refreshScreen() {
|
||||
eglSwapBuffers(_eglDisplay, _eglSurface);
|
||||
}
|
||||
|
@ -61,6 +61,8 @@ protected:
|
||||
|
||||
bool loadVideoMode(uint requestedWidth, uint requestedHeight, const Graphics::PixelFormat &format);
|
||||
|
||||
void refreshScreen();
|
||||
|
||||
const Graphics::Font *getFontOSD();
|
||||
|
||||
private:
|
||||
|
Loading…
Reference in New Issue
Block a user