[Scummvm-git-logs] scummvm master -> b19857bd8c926cd3da02e57b88c940b90ff39469

aquadran aquadran at gmail.com
Tue Oct 13 20:12:14 UTC 2020


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
b19857bd8c ENGINES: Use ScummVM's 2D API for blitting the TinyGL framebuffer (#2516)


Commit: b19857bd8c926cd3da02e57b88c940b90ff39469
    https://github.com/scummvm/scummvm/commit/b19857bd8c926cd3da02e57b88c940b90ff39469
Author: Cameron Cawley (ccawley2011 at gmail.com)
Date: 2020-10-13T22:12:10+02:00

Commit Message:
ENGINES: Use ScummVM's 2D API for blitting the TinyGL framebuffer (#2516)

* GRIM: Use ScummVM's 2D API for blitting the TinyGL framebuffer

* MYST3: Use ScummVM's 2D API for blitting the TinyGL framebuffer

* ICB: Use ScummVM's 2D API for blitting the TinyGL framebuffer

Changed paths:
    engines/grim/gfx_tinygl.cpp
    engines/grim/grim.cpp
    engines/icb/surface_manager.cpp
    engines/myst3/gfx.cpp
    engines/myst3/gfx_tinygl.cpp


diff --git a/engines/grim/gfx_tinygl.cpp b/engines/grim/gfx_tinygl.cpp
index 13bd6430a7..19685aa77f 100644
--- a/engines/grim/gfx_tinygl.cpp
+++ b/engines/grim/gfx_tinygl.cpp
@@ -78,8 +78,6 @@ GfxTinyGL::~GfxTinyGL() {
 }
 
 void GfxTinyGL::setupScreen(int screenW, int screenH, bool fullscreen) {
-	Graphics::PixelBuffer buf = g_system->getScreenPixelBuffer();
-
 	_screenWidth = screenW;
 	_screenHeight = screenH;
 	_scaleW = _screenWidth / (float)_gameWidth;
@@ -87,9 +85,9 @@ void GfxTinyGL::setupScreen(int screenW, int screenH, bool fullscreen) {
 
 	g_system->showMouse(!fullscreen);
 
-	_pixelFormat = buf.getFormat();
+	_pixelFormat = g_system->getScreenFormat();
 	debug("INFO: TinyGL front buffer pixel format: %s", _pixelFormat.toString().c_str());
-	_zb = new TinyGL::FrameBuffer(screenW, screenH, buf);
+	_zb = new TinyGL::FrameBuffer(screenW, screenH, _pixelFormat);
 	TinyGL::glInit(_zb, 256);
 	tglEnableDirtyRects(ConfMan.getBool("dirtyrects"));
 
@@ -176,6 +174,8 @@ void GfxTinyGL::clearDepthBuffer() {
 
 void GfxTinyGL::flipBuffer() {
 	TinyGL::tglPresentBuffer();
+	g_system->copyRectToScreen(_zb->getPixelBuffer(), _zb->linesize,
+	                           0, 0, _zb->xsize, _zb->ysize);
 	g_system->updateScreen();
 }
 
diff --git a/engines/grim/grim.cpp b/engines/grim/grim.cpp
index 41c9579060..35b9fa7030 100644
--- a/engines/grim/grim.cpp
+++ b/engines/grim/grim.cpp
@@ -269,7 +269,11 @@ GfxBase *GrimEngine::createRenderer(int screenW, int screenH, bool fullscreen) {
 	Graphics::RendererType matchingRendererType = Graphics::getBestMatchingAvailableRendererType(desiredRendererType);
 
 	_softRenderer = matchingRendererType == Graphics::kRendererTypeTinyGL;
-	initGraphics3d(screenW, screenH, fullscreen, !_softRenderer);
+	if (!_softRenderer) {
+		initGraphics3d(screenW, screenH, fullscreen, true);
+	} else {
+		initGraphics(screenW, screenH, nullptr);
+	}
 
 #if defined(USE_OPENGL_GAME)
 	// Check the OpenGL context actually supports shaders
diff --git a/engines/icb/surface_manager.cpp b/engines/icb/surface_manager.cpp
index c94460d2a5..8f722586bf 100644
--- a/engines/icb/surface_manager.cpp
+++ b/engines/icb/surface_manager.cpp
@@ -193,10 +193,9 @@ unsigned int _surface_manager::Init_direct_draw() {
 	Zdebug("*SURFACE_MANAGER* Initalizing the SDL video interface");
 
 	g_system->setWindowCaption("In Cold Blood (C)2000 Revolution Software Ltd");
-	initGraphics3d(640, 480, ConfMan.getBool("fullscreen"), false);
+	initGraphics(640, 480, nullptr);
 
-	Graphics::PixelBuffer pixBuff = g_system->getScreenPixelBuffer();
-	_zb = new TinyGL::FrameBuffer(640, 480, pixBuff); // TODO: delete
+	_zb = new TinyGL::FrameBuffer(640, 480, g_system->getScreenFormat()); // TODO: delete
 	TinyGL::glInit(_zb, 256);
 
 	sdl_screen = new Graphics::Surface();
@@ -413,6 +412,8 @@ void _surface_manager::Flip() {
 	Graphics::tglUploadBlitImage(blitImage, *sdl_screen, 0, false);
 	Graphics::tglBlitFast(blitImage, 0, 0);
 	TinyGL::tglPresentBuffer();
+	g_system->copyRectToScreen(_zb->getPixelBuffer(), _zb->linesize,
+	                           0, 0, _zb->xsize, _zb->ysize);
 	g_system->updateScreen();
 	Graphics::tglDeleteBlitImage(blitImage);
 #endif
diff --git a/engines/myst3/gfx.cpp b/engines/myst3/gfx.cpp
index 85afd68b50..621dc46280 100644
--- a/engines/myst3/gfx.cpp
+++ b/engines/myst3/gfx.cpp
@@ -204,7 +204,11 @@ Renderer *createRenderer(OSystem *system) {
 		width = Renderer::kOriginalWidth;
 	}
 
-	initGraphics3d(width, height, fullscreen, isAccelerated);
+	if (isAccelerated) {
+		initGraphics3d(width, height, fullscreen, true);
+	} else {
+		initGraphics(width, height, nullptr);
+	}
 
 #if defined(USE_OPENGL_GAME)
 	// Check the OpenGL context actually supports shaders
diff --git a/engines/myst3/gfx_tinygl.cpp b/engines/myst3/gfx_tinygl.cpp
index 315ef02a4d..06c9445636 100644
--- a/engines/myst3/gfx_tinygl.cpp
+++ b/engines/myst3/gfx_tinygl.cpp
@@ -63,8 +63,7 @@ void TinyGLRenderer::init() {
 
 	computeScreenViewport();
 
-	Graphics::PixelBuffer screenBuffer = _system->getScreenPixelBuffer();
-	_fb = new TinyGL::FrameBuffer(kOriginalWidth, kOriginalHeight, screenBuffer);
+	_fb = new TinyGL::FrameBuffer(kOriginalWidth, kOriginalHeight, g_system->getScreenFormat());
 	TinyGL::glInit(_fb, 512);
 	tglEnableDirtyRects(ConfMan.getBool("dirtyrects"));
 
@@ -291,6 +290,8 @@ Graphics::Surface *TinyGLRenderer::getScreenshot() {
 
 void TinyGLRenderer::flipBuffer() {
 	TinyGL::tglPresentBuffer();
+	g_system->copyRectToScreen(_fb->getPixelBuffer(), _fb->linesize,
+	                           0, 0, _fb->xsize, _fb->ysize);
 }
 
 } // End of namespace Myst3




More information about the Scummvm-git-logs mailing list