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

bluegr bluegr at gmail.com
Wed Jun 30 07:50:12 UTC 2021


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:
a51af7292e TRECISION: Fix regression from da71b6e84e - bug #12645


Commit: a51af7292ef72c1c31c61edc25ee632465dddb34
    https://github.com/scummvm/scummvm/commit/a51af7292ef72c1c31c61edc25ee632465dddb34
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2021-06-30T10:49:57+03:00

Commit Message:
TRECISION: Fix regression from da71b6e84e - bug #12645

I mistakenly removed pixel format conversion, so screen formats other
than RGB555 wouldn't work correctly. This commit should fix that

Changed paths:
    engines/trecision/graphics.cpp
    engines/trecision/graphics.h


diff --git a/engines/trecision/graphics.cpp b/engines/trecision/graphics.cpp
index 485872d9ab..51f85bc453 100644
--- a/engines/trecision/graphics.cpp
+++ b/engines/trecision/graphics.cpp
@@ -39,7 +39,7 @@
 
 namespace Trecision {
 
-GraphicsManager::GraphicsManager(TrecisionEngine *vm) : _vm(vm) {	
+GraphicsManager::GraphicsManager(TrecisionEngine *vm) : _vm(vm), _rgb555Format(2, 5, 5, 5, 0, 10, 5, 0, 0) {	
 	for (int i = 0; i < 3; ++i)
 		_bitMask[i] = 0;
 
@@ -64,15 +64,14 @@ GraphicsManager::~GraphicsManager() {
 }
 
 bool GraphicsManager::init() {
-	// Find a suitable 16-bit format
-	const Graphics::PixelFormat rgb555(2, 5, 5, 5, 0, 10, 5, 0, 0);
+	// Find a suitable 16-bit format, currently we don't support other color depths
 	Common::List<Graphics::PixelFormat> formats = g_system->getSupportedFormats();
 	for (Common::List<Graphics::PixelFormat>::iterator it = formats.begin(); it != formats.end(); ++it) {
 		if (it->bytesPerPixel != 2 || it->aBits()) {
 			it = formats.reverse_erase(it);
-		} else if (*it == rgb555) {
+		} else if (*it == _rgb555Format) {
 			formats.clear();
-			formats.push_back(rgb555);
+			formats.push_back(_rgb555Format);
 			break;
 		}
 	}
@@ -240,13 +239,12 @@ void GraphicsManager::copyToScreen(int x, int y, int w, int h) {
 }
 
 void GraphicsManager::readSurface(Common::SeekableReadStream *stream, Graphics::Surface *surface, uint16 width, uint16 height, uint16 count) {
-	Graphics::PixelFormat pixelFormat = g_system->getScreenFormat();
-	surface->create(width * count, height, pixelFormat);
+	surface->create(width * count, height, _rgb555Format);
 
 	for (uint16 i = 0; i < count; ++i) {
 		for (uint16 y = 0; y < height; ++y) {
 			void *p = surface->getBasePtr(width * i, y);
-			stream->read(p, width * pixelFormat.bytesPerPixel);
+			stream->read(p, width * _rgb555Format.bytesPerPixel);
 		}
 	}
 
@@ -350,7 +348,7 @@ void GraphicsManager::clearScreenBufferSaveSlotDescriptions() {
 
 uint16 GraphicsManager::convertToScreenFormat(uint16 color) const {
 	uint8 r, g, b;
-	g_system->getScreenFormat().colorToRGB(color, r, g, b);
+	_rgb555Format.colorToRGB(color, r, g, b);
 	return (uint16)_screenFormat.RGBToColor(r, g, b);
 }
 
diff --git a/engines/trecision/graphics.h b/engines/trecision/graphics.h
index 3137788ce1..7db36b844f 100644
--- a/engines/trecision/graphics.h
+++ b/engines/trecision/graphics.h
@@ -58,6 +58,8 @@ class GraphicsManager {
 
 	Common::List<Common::Rect> _dirtyRects;
 
+	const Graphics::PixelFormat _rgb555Format;
+
 	uint16 aliasing(uint32 val1, uint32 val2, uint8 num);
 	void drawCharPixel(uint16 y, uint16 charLeft, uint16 charRight, Common::Rect rect, Common::Rect subtitleRect, uint16 color, Graphics::Surface *externalSurface = nullptr);
 	void initCursor();




More information about the Scummvm-git-logs mailing list