[Scummvm-git-logs] scummvm master -> 782bfa88add330fad8d7cc15f79fff2ed3428742

aquadran aquadran at gmail.com
Mon Nov 2 17:42:06 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:
782bfa88ad EMI: Fix screenshot when saving on ES2 (#2587)


Commit: 782bfa88add330fad8d7cc15f79fff2ed3428742
    https://github.com/scummvm/scummvm/commit/782bfa88add330fad8d7cc15f79fff2ed3428742
Author: Matthieu Milan (usineur0 at gmail.com)
Date: 2020-11-02T18:42:01+01:00

Commit Message:
EMI: Fix screenshot when saving on ES2 (#2587)

Changed paths:
    engines/grim/gfx_opengl_shaders.cpp


diff --git a/engines/grim/gfx_opengl_shaders.cpp b/engines/grim/gfx_opengl_shaders.cpp
index 437deac72c..8e0d8e3669 100644
--- a/engines/grim/gfx_opengl_shaders.cpp
+++ b/engines/grim/gfx_opengl_shaders.cpp
@@ -2116,8 +2116,18 @@ static void readPixels(int x, int y, int width, int height, byte *buffer) {
 
 Bitmap *GfxOpenGLS::getScreenshot(int w, int h, bool useStored) {
 	Graphics::PixelBuffer src(Graphics::PixelFormat(4, 8, 8, 8, 8, 0, 8, 16, 24), _screenWidth * _screenHeight, DisposeAfterUse::YES);
-#ifndef USE_GLES2
 	if (useStored) {
+#ifdef USE_GLES2
+		GLuint frameBuffer;
+		glGenFramebuffers(1, &frameBuffer);
+		glBindFramebuffer(GL_FRAMEBUFFER, frameBuffer);
+		glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, _storedDisplay, 0);
+
+		readPixels(0, 0, _screenWidth, _screenHeight, src.getRawBuffer());
+
+		glBindFramebuffer(GL_FRAMEBUFFER, 0);
+		glDeleteFramebuffers(1, &frameBuffer);
+#else
 		glBindTexture(GL_TEXTURE_2D, _storedDisplay);
 		char *buffer = new char[_screenWidth * _screenHeight * 4];
 
@@ -2127,9 +2137,8 @@ Bitmap *GfxOpenGLS::getScreenshot(int w, int h, bool useStored) {
 			memcpy(&(rawBuf[(_screenHeight - i - 1) * _screenWidth * 4]), &buffer[4 * _screenWidth * i], _screenWidth * 4);
 		}
 		delete[] buffer;
-	} else
 #endif
-	{
+	} else {
 		readPixels(0, 0, _screenWidth, _screenHeight, src.getRawBuffer());
 	}
 	return createScreenshotBitmap(src, w, h, true);




More information about the Scummvm-git-logs mailing list