[Scummvm-cvs-logs] scummvm master -> 63cc9de1df7326bf92da3df7d2e38f86a43be506

lordhoto lordhoto at gmail.com
Fri Feb 25 04:06:08 CET 2011


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

Summary:
972cdaea35 OPENGL: Add support for RGB555 output format.
4f3a244f16 OPENGLSDL: Add RGB555 to the supported format list.
f1b16fe084 OPENGL: Implement support for non CLUT8 cursor.
63cc9de1df OPENGL: Cleanup cursor refresh code a bit.


Commit: 972cdaea358160f56880ef82b2527c1ebb320c8a
    https://github.com/scummvm/scummvm/commit/972cdaea358160f56880ef82b2527c1ebb320c8a
Author: Johannes Schickel (lordhoto at scummvm.org)
Date: 2011-02-24T18:35:55-08:00

Commit Message:
OPENGL: Add support for RGB555 output format.

Changed paths:
    backends/graphics/opengl/opengl-graphics.cpp



diff --git a/backends/graphics/opengl/opengl-graphics.cpp b/backends/graphics/opengl/opengl-graphics.cpp
index 8bca09b..ea57028 100644
--- a/backends/graphics/opengl/opengl-graphics.cpp
+++ b/backends/graphics/opengl/opengl-graphics.cpp
@@ -873,6 +873,11 @@ void OpenGLGraphicsManager::getGLPixelFormat(Graphics::PixelFormat pixelFormat,
 		intFormat = GL_RGBA;
 		glFormat = GL_RGBA;
 		gltype = GL_UNSIGNED_SHORT_5_5_5_1;
+	} else if (pixelFormat == Graphics::PixelFormat(2, 5, 5, 5, 0, 10, 5, 0, 0)) { // RGB555
+		bpp = 2;
+		intFormat = GL_RGB;
+		glFormat = GL_BGRA;
+		gltype = GL_UNSIGNED_SHORT_1_5_5_5_REV;
 	} else if (pixelFormat == Graphics::PixelFormat(2, 4, 4, 4, 4, 12, 8, 4, 0)) { // RGBA4444
 		bpp = 2;
 		intFormat = GL_RGBA;


Commit: 4f3a244f16baeaf06825dbbc7b65f453011fb07c
    https://github.com/scummvm/scummvm/commit/4f3a244f16baeaf06825dbbc7b65f453011fb07c
Author: Johannes Schickel (lordhoto at scummvm.org)
Date: 2011-02-24T18:36:45-08:00

Commit Message:
OPENGLSDL: Add RGB555 to the supported format list.

Changed paths:
    backends/graphics/openglsdl/openglsdl-graphics.cpp



diff --git a/backends/graphics/openglsdl/openglsdl-graphics.cpp b/backends/graphics/openglsdl/openglsdl-graphics.cpp
index c7ce0aa..183d0af 100644
--- a/backends/graphics/openglsdl/openglsdl-graphics.cpp
+++ b/backends/graphics/openglsdl/openglsdl-graphics.cpp
@@ -121,6 +121,7 @@ void OpenGLSdlGraphicsManager::detectSupportedFormats() {
 #endif
 		Graphics::PixelFormat(2, 5, 6, 5, 0, 11, 5, 0, 0),	// RGB565
 		Graphics::PixelFormat(2, 5, 5, 5, 1, 11, 6, 1, 0),	// RGB5551
+		Graphics::PixelFormat(2, 5, 5, 5, 0, 10, 5, 0, 0),	// RGB555
 		Graphics::PixelFormat(2, 4, 4, 4, 4, 12, 8, 4, 0),	// RGBA4444
 #ifndef USE_GLES
 		Graphics::PixelFormat(2, 4, 4, 4, 4, 8, 4, 0, 12)   // ARGB4444


Commit: f1b16fe0840336dbf87f4c6d1a767c3d2c9dd3d4
    https://github.com/scummvm/scummvm/commit/f1b16fe0840336dbf87f4c6d1a767c3d2c9dd3d4
Author: Johannes Schickel (lordhoto at scummvm.org)
Date: 2011-02-24T19:01:37-08:00

Commit Message:
OPENGL: Implement support for non CLUT8 cursor.

Currently all the cursor data is converted to RGBA8888 to allow for
easy colorkeying.

Changed paths:
    backends/graphics/opengl/opengl-graphics.cpp



diff --git a/backends/graphics/opengl/opengl-graphics.cpp b/backends/graphics/opengl/opengl-graphics.cpp
index ea57028..0bd10b6 100644
--- a/backends/graphics/opengl/opengl-graphics.cpp
+++ b/backends/graphics/opengl/opengl-graphics.cpp
@@ -754,6 +754,9 @@ void OpenGLGraphicsManager::refreshOverlay() {
 void OpenGLGraphicsManager::refreshCursor() {
 	_cursorNeedsRedraw = false;
 
+	// Allocate a texture big enough for cursor
+	_cursorTexture->allocBuffer(_cursorState.w, _cursorState.h);
+
 	if (_cursorFormat.bytesPerPixel == 1) {
 		// Create a temporary RGBA8888 surface
 		byte *surface = new byte[_cursorState.w * _cursorState.h * 4];
@@ -780,8 +783,46 @@ void OpenGLGraphicsManager::refreshCursor() {
 			dst += 4;
 		}
 
-		// Allocate a texture big enough for cursor
-		_cursorTexture->allocBuffer(_cursorState.w, _cursorState.h);
+		// Update the texture with new cursor
+		_cursorTexture->updateBuffer(surface, _cursorState.w * 4, 0, 0, _cursorState.w, _cursorState.h);
+
+		// Free the temp surface
+		delete[] surface;
+	} else {
+		// Create a temporary RGBA8888 surface
+		byte *surface = new byte[_cursorState.w * _cursorState.h * 4];
+		memset(surface, 0, _cursorState.w * _cursorState.h * 4);
+
+		// Convert the paletted cursor to RGBA8888
+		byte *dst = surface;
+
+		const bool gotNoAlpha = (_cursorFormat.aLoss == 8);
+
+		if (_cursorFormat.bytesPerPixel == 2) {
+			const uint16 *src = (uint16 *)_cursorData.pixels;
+			for (int i = 0; i < _cursorState.w * _cursorState.h; i++) {
+				// Check for keycolor
+				if (src[i] != _cursorKeyColor) {
+					_cursorFormat.colorToARGB(src[i], dst[3], dst[0], dst[1], dst[2]);
+
+					if (gotNoAlpha)
+						dst[3] = 255;
+				}
+				dst += 4;
+			}
+		} else if (_cursorFormat.bytesPerPixel == 4) {
+			const uint32 *src = (uint32 *)_cursorData.pixels;
+			for (int i = 0; i < _cursorState.w * _cursorState.h; i++) {
+				// Check for keycolor
+				if (src[i] != _cursorKeyColor) {
+					_cursorFormat.colorToARGB(src[i], dst[3], dst[0], dst[1], dst[2]);
+
+					if (gotNoAlpha)
+						dst[3] = 255;
+				}
+				dst += 4;
+			}
+		}
 
 		// Update the texture with new cursor
 		_cursorTexture->updateBuffer(surface, _cursorState.w * 4, 0, 0, _cursorState.w, _cursorState.h);


Commit: 63cc9de1df7326bf92da3df7d2e38f86a43be506
    https://github.com/scummvm/scummvm/commit/63cc9de1df7326bf92da3df7d2e38f86a43be506
Author: Johannes Schickel (lordhoto at scummvm.org)
Date: 2011-02-24T19:04:56-08:00

Commit Message:
OPENGL: Cleanup cursor refresh code a bit.

Changed paths:
    backends/graphics/opengl/opengl-graphics.cpp



diff --git a/backends/graphics/opengl/opengl-graphics.cpp b/backends/graphics/opengl/opengl-graphics.cpp
index 0bd10b6..f8e1937 100644
--- a/backends/graphics/opengl/opengl-graphics.cpp
+++ b/backends/graphics/opengl/opengl-graphics.cpp
@@ -757,11 +757,14 @@ void OpenGLGraphicsManager::refreshCursor() {
 	// Allocate a texture big enough for cursor
 	_cursorTexture->allocBuffer(_cursorState.w, _cursorState.h);
 
-	if (_cursorFormat.bytesPerPixel == 1) {
-		// Create a temporary RGBA8888 surface
-		byte *surface = new byte[_cursorState.w * _cursorState.h * 4];
-		memset(surface, 0, _cursorState.w * _cursorState.h * 4);
+	// Create a temporary RGBA8888 surface
+	byte *surface = new byte[_cursorState.w * _cursorState.h * 4];
+	memset(surface, 0, _cursorState.w * _cursorState.h * 4);
+
+	byte *dst = surface;
 
+	// Convert the paletted cursor to RGBA8888
+	if (_cursorFormat.bytesPerPixel == 1) {
 		// Select palette
 		byte *palette;
 		if (_cursorPaletteDisabled)
@@ -771,7 +774,6 @@ void OpenGLGraphicsManager::refreshCursor() {
 
 		// Convert the paletted cursor to RGBA8888
 		const byte *src = (byte *)_cursorData.pixels;
-		byte *dst = surface;
 		for (int i = 0; i < _cursorState.w * _cursorState.h; i++) {
 			// Check for keycolor
 			if (src[i] != _cursorKeyColor) {
@@ -782,22 +784,10 @@ void OpenGLGraphicsManager::refreshCursor() {
 			}
 			dst += 4;
 		}
-
-		// Update the texture with new cursor
-		_cursorTexture->updateBuffer(surface, _cursorState.w * 4, 0, 0, _cursorState.w, _cursorState.h);
-
-		// Free the temp surface
-		delete[] surface;
 	} else {
-		// Create a temporary RGBA8888 surface
-		byte *surface = new byte[_cursorState.w * _cursorState.h * 4];
-		memset(surface, 0, _cursorState.w * _cursorState.h * 4);
-
-		// Convert the paletted cursor to RGBA8888
-		byte *dst = surface;
-
 		const bool gotNoAlpha = (_cursorFormat.aLoss == 8);
 
+		// Convert the RGB cursor to RGBA8888
 		if (_cursorFormat.bytesPerPixel == 2) {
 			const uint16 *src = (uint16 *)_cursorData.pixels;
 			for (int i = 0; i < _cursorState.w * _cursorState.h; i++) {
@@ -823,13 +813,13 @@ void OpenGLGraphicsManager::refreshCursor() {
 				dst += 4;
 			}
 		}
+	}
 
-		// Update the texture with new cursor
-		_cursorTexture->updateBuffer(surface, _cursorState.w * 4, 0, 0, _cursorState.w, _cursorState.h);
+	// Update the texture with new cursor
+	_cursorTexture->updateBuffer(surface, _cursorState.w * 4, 0, 0, _cursorState.w, _cursorState.h);
 
-		// Free the temp surface
-		delete[] surface;
-	}
+	// Free the temp surface
+	delete[] surface;
 }
 
 void OpenGLGraphicsManager::refreshCursorScale() {






More information about the Scummvm-git-logs mailing list