SYSTEM: Add a system method for retrieving the screen framebuffer
This commit is contained in:
parent
e6a31b2150
commit
31715787ca
14 changed files with 47 additions and 17 deletions
|
@ -59,7 +59,9 @@ public:
|
|||
// ResidualVM specific method
|
||||
virtual void launcherInitSize(uint w, uint h) = 0;
|
||||
// ResidualVM specific method
|
||||
virtual Graphics::PixelBuffer setupScreen(uint screenW, uint screenH, bool fullscreen, bool accel3d) = 0;
|
||||
virtual void setupScreen(uint screenW, uint screenH, bool fullscreen, bool accel3d) = 0;
|
||||
// ResidualVM specific method
|
||||
virtual Graphics::PixelBuffer getScreenPixelBuffer() = 0;
|
||||
|
||||
virtual int16 getHeight() = 0;
|
||||
virtual int16 getWidth() = 0;
|
||||
|
|
|
@ -184,7 +184,7 @@ void SurfaceSdlGraphicsManager::launcherInitSize(uint w, uint h) {
|
|||
setupScreen(w, h, false, false);
|
||||
}
|
||||
|
||||
Graphics::PixelBuffer SurfaceSdlGraphicsManager::setupScreen(uint screenW, uint screenH, bool fullscreen, bool accel3d) {
|
||||
void SurfaceSdlGraphicsManager::setupScreen(uint screenW, uint screenH, bool fullscreen, bool accel3d) {
|
||||
uint32 sdlflags;
|
||||
int bpp;
|
||||
|
||||
|
@ -446,8 +446,14 @@ Graphics::PixelBuffer SurfaceSdlGraphicsManager::setupScreen(uint screenW, uint
|
|||
#endif
|
||||
if (_fullscreen && !accel3d) {
|
||||
_subScreen = SDL_CreateRGBSurface(SDL_SWSURFACE, fbW, fbH, bpp, _screen->format->Rmask, _screen->format->Gmask, _screen->format->Bmask, _screen->format->Amask);
|
||||
}
|
||||
}
|
||||
|
||||
Graphics::PixelBuffer SurfaceSdlGraphicsManager::getScreenPixelBuffer() {
|
||||
if (_subScreen) {
|
||||
return Graphics::PixelBuffer(_screenFormat, (byte *)_subScreen->pixels);
|
||||
}
|
||||
|
||||
return Graphics::PixelBuffer(_screenFormat, (byte *)_screen->pixels);
|
||||
}
|
||||
|
||||
|
|
|
@ -76,7 +76,8 @@ public:
|
|||
#endif
|
||||
virtual void initSize(uint w, uint h, const Graphics::PixelFormat *format = NULL);
|
||||
virtual void launcherInitSize(uint w, uint h); // ResidualVM specific method
|
||||
Graphics::PixelBuffer setupScreen(uint screenW, uint screenH, bool fullscreen, bool accel3d); // ResidualVM specific method
|
||||
virtual void setupScreen(uint screenW, uint screenH, bool fullscreen, bool accel3d); // ResidualVM specific method
|
||||
virtual Graphics::PixelBuffer getScreenPixelBuffer(); // ResidualVM specific method
|
||||
virtual int getScreenChangeID() const { return _screenChangeCount; }
|
||||
|
||||
virtual void beginGFXTransaction();
|
||||
|
|
|
@ -104,8 +104,13 @@ void ModularBackend::launcherInitSize(uint w, uint h) {
|
|||
}
|
||||
|
||||
// ResidualVM specific method
|
||||
Graphics::PixelBuffer ModularBackend::setupScreen(uint screenW, uint screenH, bool fullscreen, bool accel3d) {
|
||||
return _graphicsManager->setupScreen(screenW, screenH, fullscreen, accel3d);
|
||||
void ModularBackend::setupScreen(uint screenW, uint screenH, bool fullscreen, bool accel3d) {
|
||||
_graphicsManager->setupScreen(screenW, screenH, fullscreen, accel3d);
|
||||
}
|
||||
|
||||
// ResidualVM specific method
|
||||
Graphics::PixelBuffer ModularBackend::getScreenPixelBuffer() {
|
||||
return _graphicsManager->getScreenPixelBuffer();
|
||||
}
|
||||
|
||||
void ModularBackend::initSize(uint w, uint h, const Graphics::PixelFormat *format ) {
|
||||
|
|
|
@ -73,7 +73,8 @@ public:
|
|||
#endif
|
||||
virtual void initSize(uint width, uint height, const Graphics::PixelFormat *format = NULL);
|
||||
virtual void launcherInitSize(uint w, uint h); // ResidualVM specific method
|
||||
virtual Graphics::PixelBuffer setupScreen(uint screenW, uint screenH, bool fullscreen, bool accel3d); // ResidualVM specific method
|
||||
virtual void setupScreen(uint screenW, uint screenH, bool fullscreen, bool accel3d); // ResidualVM specific method
|
||||
virtual Graphics::PixelBuffer getScreenPixelBuffer(); // ResidualVM specific method
|
||||
virtual int getScreenChangeID() const;
|
||||
|
||||
virtual void beginGFXTransaction();
|
||||
|
|
|
@ -303,10 +303,11 @@ public:
|
|||
// ResidualVM specific method
|
||||
virtual void launcherInitSize(uint w, uint h);
|
||||
bool lockMouse(bool lock);
|
||||
Graphics::PixelBuffer setupScreen(uint screenW, uint screenH, bool fullscreen, bool accel3d) {
|
||||
return setupScreen(screenW, screenH, fullscreen, accel3d, true);
|
||||
void setupScreen(uint screenW, uint screenH, bool fullscreen, bool accel3d) {
|
||||
setupScreen(screenW, screenH, fullscreen, accel3d, true);
|
||||
}
|
||||
Graphics::PixelBuffer setupScreen(uint screenW, uint screenH, bool fullscreen, bool accel3d, bool isGame);
|
||||
void setupScreen(uint screenW, uint screenH, bool fullscreen, bool accel3d, bool isGame);
|
||||
Graphics::PixelBuffer getScreenPixelBuffer();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -459,7 +459,7 @@ void OSystem_Android::copyRectToScreen(const void *buf, int pitch,
|
|||
|
||||
|
||||
// ResidualVM specific method
|
||||
Graphics::PixelBuffer OSystem_Android::setupScreen(uint screenW, uint screenH, bool fullscreen, bool accel3d, bool isGame) {
|
||||
void OSystem_Android::setupScreen(uint screenW, uint screenH, bool fullscreen, bool accel3d, bool isGame) {
|
||||
_opengl = accel3d;
|
||||
initViewport();
|
||||
|
||||
|
@ -481,6 +481,10 @@ Graphics::PixelBuffer OSystem_Android::setupScreen(uint screenW, uint screenH, b
|
|||
_game_pbuf.create(_game_texture->getPixelFormat(),
|
||||
_game_texture->width() * _game_texture->height(), DisposeAfterUse::YES);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Graphics::PixelBuffer OSystem_Android::getScreenPixelBuffer() {
|
||||
return _game_pbuf;
|
||||
}
|
||||
|
||||
|
|
|
@ -666,7 +666,14 @@ public:
|
|||
* @param fullscreen the new screen will be displayed in fullscreeen mode
|
||||
*/
|
||||
|
||||
virtual Graphics::PixelBuffer setupScreen(uint screenW, uint screenH, bool fullscreen, bool accel3d) = 0;
|
||||
virtual void setupScreen(uint screenW, uint screenH, bool fullscreen, bool accel3d) = 0;
|
||||
|
||||
/**
|
||||
* Return a Graphics::PixelBuffer representing the framebuffer.
|
||||
* The caller can then perform arbitrary graphics transformations
|
||||
* on the framebuffer (blitting, scrolling, etc.).
|
||||
*/
|
||||
virtual Graphics::PixelBuffer getScreenPixelBuffer() = 0;
|
||||
|
||||
/**
|
||||
* Suggest textures to render at the side of the game window.
|
||||
|
|
|
@ -130,8 +130,9 @@ GfxOpenGL::~GfxOpenGL() {
|
|||
}
|
||||
|
||||
byte *GfxOpenGL::setupScreen(int screenW, int screenH, bool fullscreen) {
|
||||
_pixelFormat = g_system->setupScreen(screenW, screenH, fullscreen, true).getFormat();
|
||||
g_system->setupScreen(screenW, screenH, fullscreen, true);
|
||||
|
||||
_pixelFormat = g_system->getScreenPixelBuffer().getFormat();
|
||||
_screenWidth = screenW;
|
||||
_screenHeight = screenH;
|
||||
_scaleW = _screenWidth / (float)_gameWidth;
|
||||
|
|
|
@ -405,8 +405,9 @@ void GfxOpenGLS::setupShaders() {
|
|||
}
|
||||
|
||||
byte *GfxOpenGLS::setupScreen(int screenW, int screenH, bool fullscreen) {
|
||||
_pixelFormat = g_system->setupScreen(screenW, screenH, fullscreen, true).getFormat();
|
||||
g_system->setupScreen(screenW, screenH, fullscreen, true);
|
||||
|
||||
_pixelFormat = g_system->getScreenPixelBuffer().getFormat();
|
||||
_screenWidth = screenW;
|
||||
_screenHeight = screenH;
|
||||
_scaleW = _screenWidth / (float)_gameWidth;
|
||||
|
|
|
@ -78,7 +78,9 @@ GfxTinyGL::~GfxTinyGL() {
|
|||
}
|
||||
|
||||
byte *GfxTinyGL::setupScreen(int screenW, int screenH, bool fullscreen) {
|
||||
Graphics::PixelBuffer buf = g_system->setupScreen(screenW, screenH, fullscreen, false);
|
||||
g_system->setupScreen(screenW, screenH, fullscreen, false);
|
||||
|
||||
Graphics::PixelBuffer buf = g_system->getScreenPixelBuffer();
|
||||
byte *buffer = buf.getRawBuffer();
|
||||
|
||||
_screenWidth = screenW;
|
||||
|
|
|
@ -34,7 +34,6 @@
|
|||
|
||||
#include "graphics/colormasks.h"
|
||||
#include "graphics/opengl/context.h"
|
||||
#include "graphics/pixelbuffer.h"
|
||||
#include "graphics/surface.h"
|
||||
|
||||
#include "engines/myst3/gfx.h"
|
||||
|
|
|
@ -49,7 +49,6 @@
|
|||
#if defined(USE_GLES2) || defined(USE_OPENGL_SHADERS)
|
||||
|
||||
#include "graphics/colormasks.h"
|
||||
#include "graphics/pixelbuffer.h"
|
||||
#include "graphics/surface.h"
|
||||
|
||||
#include "math/glmath.h"
|
||||
|
|
|
@ -68,9 +68,10 @@ void TinyGLRenderer::init() {
|
|||
debug("Initializing Software 3D Renderer");
|
||||
|
||||
bool fullscreen = ConfMan.getBool("fullscreen");
|
||||
Graphics::PixelBuffer screenBuffer = _system->setupScreen(kOriginalWidth, kOriginalHeight, fullscreen, false);
|
||||
_system->setupScreen(kOriginalWidth, kOriginalHeight, fullscreen, false);
|
||||
computeScreenViewport();
|
||||
|
||||
Graphics::PixelBuffer screenBuffer = _system->getScreenPixelBuffer();
|
||||
_fb = new TinyGL::FrameBuffer(kOriginalWidth, kOriginalHeight, screenBuffer);
|
||||
TinyGL::glInit(_fb, 512);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue