[Scummvm-git-logs] scummvm master -> 359109df103d90494bf0e5ab166292fc67eae54c

sev- sev at scummvm.org
Thu Jun 24 09:56:01 UTC 2021


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

Summary:
f9dc98b0f6 MYST3: Remove unneeded use of Graphics::ColorMasks
757a819da9 GRIM: Remove unneeded use of Graphics::createPixelFormat
10b724fd71 SWORD25: Remove unneeded use of Graphics::ColorMasks
632150171e MOHAWK: RIVEN: Remove use of Graphics::ColorMasks
cdc00c41be IOS7: Remove unneeded use of Graphics::ColorMasks
64fc110586 IPHONE: Remove unneeded use of Graphics::ColorMasks
82a85494cd GRAPHICS: Integrate Graphics::ColorMasks with Graphics::PixelFormat
359109df10 GRAPHICS: Add optimized versions of scaleBlitBilinear and rotoscaleBlitLinear


Commit: f9dc98b0f6427ae6351a889221c32a02d392de84
    https://github.com/scummvm/scummvm/commit/f9dc98b0f6427ae6351a889221c32a02d392de84
Author: Cameron Cawley (ccawley2011 at gmail.com)
Date: 2021-06-24T11:55:54+02:00

Commit Message:
MYST3: Remove unneeded use of Graphics::ColorMasks

Changed paths:
    engines/myst3/gfx.h
    engines/myst3/gfx_opengl.cpp
    engines/myst3/gfx_opengl.h
    engines/myst3/gfx_opengl_shaders.cpp
    engines/myst3/gfx_opengl_shaders.h
    engines/myst3/gfx_tinygl.cpp
    engines/myst3/gfx_tinygl.h
    engines/myst3/inventory.cpp
    engines/myst3/menu.cpp
    engines/myst3/movie.cpp
    engines/myst3/scene.cpp
    engines/myst3/subtitles.cpp
    engines/myst3/transition.cpp


diff --git a/engines/myst3/gfx.h b/engines/myst3/gfx.h
index 622feb655d..e6d3916898 100644
--- a/engines/myst3/gfx.h
+++ b/engines/myst3/gfx.h
@@ -125,7 +125,7 @@ public:
 	virtual Texture *createTexture(const Graphics::Surface *surface) = 0;
 	virtual void freeTexture(Texture *texture) = 0;
 
-	virtual void drawRect2D(const Common::Rect &rect, uint32 color) = 0;
+	virtual void drawRect2D(const Common::Rect &rect, uint8 a, uint8 r, uint8 g, uint8 b) = 0;
 	virtual void drawTexturedRect2D(const Common::Rect &screenRect, const Common::Rect &textureRect, Texture *texture,
 									float transparency = -1.0, bool additiveBlending = false) = 0;
 	virtual void drawTexturedRect3D(const Math::Vector3d &topLeft, const Math::Vector3d &bottomLeft,
diff --git a/engines/myst3/gfx_opengl.cpp b/engines/myst3/gfx_opengl.cpp
index c6568c6fa6..7f27984e39 100644
--- a/engines/myst3/gfx_opengl.cpp
+++ b/engines/myst3/gfx_opengl.cpp
@@ -25,7 +25,6 @@
 
 #if defined(USE_OPENGL_GAME) && !defined(USE_GLES2)
 
-#include "graphics/colormasks.h"
 #include "graphics/opengl/context.h"
 #include "graphics/surface.h"
 
@@ -130,10 +129,7 @@ void OpenGLRenderer::selectTargetWindow(Window *window, bool is3D, bool scaled)
 	}
 }
 
-void OpenGLRenderer::drawRect2D(const Common::Rect &rect, uint32 color) {
-	uint8 a, r, g, b;
-	Graphics::colorToARGB< Graphics::ColorMasks<8888> >(color, a, r, g, b);
-
+void OpenGLRenderer::drawRect2D(const Common::Rect &rect, uint8 a, uint8 r, uint8 g, uint8 b) {
 	glDisable(GL_TEXTURE_2D);
 	glColor4f(r / 255.0, g / 255.0, b / 255.0, a / 255.0);
 
diff --git a/engines/myst3/gfx_opengl.h b/engines/myst3/gfx_opengl.h
index db16720cd9..2af1a7c65c 100644
--- a/engines/myst3/gfx_opengl.h
+++ b/engines/myst3/gfx_opengl.h
@@ -44,7 +44,7 @@ public:
 	Texture *createTexture(const Graphics::Surface *surface) override;
 	void freeTexture(Texture *texture) override;
 
-	virtual void drawRect2D(const Common::Rect &rect, uint32 color) override;
+	virtual void drawRect2D(const Common::Rect &rect, uint8 a, uint8 r, uint8 g, uint8 b) override;
 	virtual void drawTexturedRect2D(const Common::Rect &screenRect, const Common::Rect &textureRect, Texture *texture,
 	                                float transparency = -1.0, bool additiveBlending = false) override;
 	virtual void drawTexturedRect3D(const Math::Vector3d &topLeft, const Math::Vector3d &bottomLeft,
diff --git a/engines/myst3/gfx_opengl_shaders.cpp b/engines/myst3/gfx_opengl_shaders.cpp
index 14b37ba66b..76cc4db7db 100644
--- a/engines/myst3/gfx_opengl_shaders.cpp
+++ b/engines/myst3/gfx_opengl_shaders.cpp
@@ -41,7 +41,6 @@
 
 #if defined(USE_GLES2) || defined(USE_OPENGL_SHADERS)
 
-#include "graphics/colormasks.h"
 #include "graphics/surface.h"
 
 #include "math/glmath.h"
@@ -187,10 +186,7 @@ void ShaderRenderer::selectTargetWindow(Window *window, bool is3D, bool scaled)
 	}
 }
 
-void ShaderRenderer::drawRect2D(const Common::Rect &rect, uint32 color) {
-	uint8 a, r, g, b;
-	Graphics::colorToARGB< Graphics::ColorMasks<8888> >(color, a, r, g, b);
-
+void ShaderRenderer::drawRect2D(const Common::Rect &rect,  uint8 a, uint8 r, uint8 g, uint8 b) {
 	_boxShader->use();
 	_boxShader->setUniform("textured", false);
 	_boxShader->setUniform("color", Math::Vector4d(r / 255.0, g / 255.0, b / 255.0, a / 255.0));
diff --git a/engines/myst3/gfx_opengl_shaders.h b/engines/myst3/gfx_opengl_shaders.h
index 35a8ba793f..d5e3011513 100644
--- a/engines/myst3/gfx_opengl_shaders.h
+++ b/engines/myst3/gfx_opengl_shaders.h
@@ -45,7 +45,7 @@ public:
 	virtual Texture *createTexture(const Graphics::Surface *surface) override;
 	virtual void freeTexture(Texture *texture) override;
 
-	virtual void drawRect2D(const Common::Rect &rect, uint32 color) override;
+	virtual void drawRect2D(const Common::Rect &rect, uint8 a, uint8 r, uint8 g, uint8 b) override;
 	virtual void drawTexturedRect2D(const Common::Rect &screenRect, const Common::Rect &textureRect, Texture *texture,
 	                                float transparency = -1.0, bool additiveBlending = false) override;
 	virtual void drawTexturedRect3D(const Math::Vector3d &topLeft, const Math::Vector3d &bottomLeft,
diff --git a/engines/myst3/gfx_tinygl.cpp b/engines/myst3/gfx_tinygl.cpp
index 06c9445636..013e59e414 100644
--- a/engines/myst3/gfx_tinygl.cpp
+++ b/engines/myst3/gfx_tinygl.cpp
@@ -24,7 +24,6 @@
 #include "common/rect.h"
 #include "common/textconsole.h"
 
-#include "graphics/colormasks.h"
 #include "graphics/surface.h"
 
 #include "math/vector2d.h"
@@ -135,10 +134,7 @@ void TinyGLRenderer::selectTargetWindow(Window *window, bool is3D, bool scaled)
 	}
 }
 
-void TinyGLRenderer::drawRect2D(const Common::Rect &rect, uint32 color) {
-	uint8 a, r, g, b;
-	Graphics::colorToARGB< Graphics::ColorMasks<8888> >(color, a, r, g, b);
-
+void TinyGLRenderer::drawRect2D(const Common::Rect &rect, uint8 a, uint8 r, uint8 g, uint8 b) {
 	tglDisable(TGL_TEXTURE_2D);
 	tglColor4f(r / 255.0, g / 255.0, b / 255.0, a / 255.0);
 
diff --git a/engines/myst3/gfx_tinygl.h b/engines/myst3/gfx_tinygl.h
index b61ed25495..f57a658c89 100644
--- a/engines/myst3/gfx_tinygl.h
+++ b/engines/myst3/gfx_tinygl.h
@@ -45,7 +45,7 @@ public:
 	Texture *createTexture(const Graphics::Surface *surface) override;
 	void freeTexture(Texture *texture) override;
 
-	virtual void drawRect2D(const Common::Rect &rect, uint32 color) override;
+	virtual void drawRect2D(const Common::Rect &rect, uint8 a, uint8 r, uint8 g, uint8 b) override;
 	virtual void drawTexturedRect2D(const Common::Rect &screenRect, const Common::Rect &textureRect, Texture *texture,
 	                                float transparency = -1.0, bool additiveBlending = false) override;
 	virtual void drawTexturedRect3D(const Math::Vector3d &topLeft, const Math::Vector3d &bottomLeft,
diff --git a/engines/myst3/inventory.cpp b/engines/myst3/inventory.cpp
index b7b35e1ea2..dcee924d4a 100644
--- a/engines/myst3/inventory.cpp
+++ b/engines/myst3/inventory.cpp
@@ -70,7 +70,7 @@ void Inventory::draw() {
 	if (_vm->isWideScreenModEnabled()) {
 		// Draw a black background to cover the main game frame
 		Common::Rect screen = _vm->_gfx->viewport();
-		_vm->_gfx->drawRect2D(Common::Rect(screen.width(), Renderer::kBottomBorderHeight), 0xFF000000);
+		_vm->_gfx->drawRect2D(Common::Rect(screen.width(), Renderer::kBottomBorderHeight), 0xFF, 0x00, 0x00, 0x00);
 	}
 
 	uint16 hoveredItemVar = hoveredItem();
diff --git a/engines/myst3/menu.cpp b/engines/myst3/menu.cpp
index 44b1bb13ee..197d7684ea 100644
--- a/engines/myst3/menu.cpp
+++ b/engines/myst3/menu.cpp
@@ -32,8 +32,6 @@
 
 #include "common/events.h"
 
-#include "graphics/colormasks.h"
-
 #include "gui/message.h"
 
 namespace Myst3 {
diff --git a/engines/myst3/movie.cpp b/engines/myst3/movie.cpp
index 9ba4b378fa..c790b0a932 100644
--- a/engines/myst3/movie.cpp
+++ b/engines/myst3/movie.cpp
@@ -29,8 +29,6 @@
 
 #include "common/config-manager.h"
 
-#include "graphics/colormasks.h"
-
 namespace Myst3 {
 
 Movie::Movie(Myst3Engine *vm, uint16 id) :
diff --git a/engines/myst3/scene.cpp b/engines/myst3/scene.cpp
index 563265a605..83809f2c44 100644
--- a/engines/myst3/scene.cpp
+++ b/engines/myst3/scene.cpp
@@ -29,8 +29,6 @@
 #include "engines/myst3/node.h"
 #include "engines/myst3/state.h"
 
-#include "graphics/colormasks.h"
-
 #include "math/vector2d.h"
 
 namespace Myst3 {
@@ -106,12 +104,12 @@ void Scene::drawSunspotFlare(const SunSpot &s) {
 	Common::Rect frame = Common::Rect(Renderer::kOriginalWidth, Renderer::kFrameHeight);
 
 	uint8 a = (uint8)(s.intensity * s.radius);
-	uint8 r, g, b;
-	Graphics::colorToRGB< Graphics::ColorMasks<888> >(s.color, r, g, b);
-	uint32 color = Graphics::ARGBToColor< Graphics::ColorMasks<8888> >(a, r, g, b);
+	uint8 r = (s.color >> 16) & 0xFF;
+	uint8 g = (s.color >>  8) & 0xFF;
+	uint8 b = (s.color >>  0) & 0xFF;
 
 	_vm->_gfx->selectTargetWindow(this, false, true);
-	_vm->_gfx->drawRect2D(frame, color);
+	_vm->_gfx->drawRect2D(frame, a, r, g, b);
 }
 
 
diff --git a/engines/myst3/subtitles.cpp b/engines/myst3/subtitles.cpp
index c6552ac39f..b032b75a6c 100644
--- a/engines/myst3/subtitles.cpp
+++ b/engines/myst3/subtitles.cpp
@@ -483,7 +483,7 @@ void Subtitles::drawOverlay() {
 
 	if (_vm->isWideScreenModEnabled()) {
 		// Draw a black background to cover the main game frame
-		_vm->_gfx->drawRect2D(Common::Rect(screen.width(), Renderer::kBottomBorderHeight), 0xFF000000);
+		_vm->_gfx->drawRect2D(Common::Rect(screen.width(), Renderer::kBottomBorderHeight), 0xFF, 0x00, 0x00, 0x00);
 
 		// Center the subtitles in the screen
 		bottomBorder.translate((screen.width() - Renderer::kOriginalWidth) / 2, 0);
diff --git a/engines/myst3/transition.cpp b/engines/myst3/transition.cpp
index 18a5fae796..0fb98f1346 100644
--- a/engines/myst3/transition.cpp
+++ b/engines/myst3/transition.cpp
@@ -27,7 +27,6 @@
 #include "engines/myst3/sound.h"
 #include "engines/myst3/state.h"
 
-#include "graphics/colormasks.h"
 #include "graphics/surface.h"
 
 namespace Myst3 {


Commit: 757a819da9ab0d93b6318995831e2ff406dce76f
    https://github.com/scummvm/scummvm/commit/757a819da9ab0d93b6318995831e2ff406dce76f
Author: Cameron Cawley (ccawley2011 at gmail.com)
Date: 2021-06-24T11:55:54+02:00

Commit Message:
GRIM: Remove unneeded use of Graphics::createPixelFormat

Changed paths:
    engines/grim/bitmap.cpp
    engines/grim/emi/emi.cpp
    engines/grim/emi/lua_v2.cpp
    engines/grim/gfx_base.cpp
    engines/grim/gfx_tinygl.cpp
    engines/grim/lua_v1.cpp
    graphics/pixelbuffer.h


diff --git a/engines/grim/bitmap.cpp b/engines/grim/bitmap.cpp
index 835b638587..fff26378e7 100644
--- a/engines/grim/bitmap.cpp
+++ b/engines/grim/bitmap.cpp
@@ -22,7 +22,6 @@
 
 #include "common/endian.h"
 
-#include "graphics/colormasks.h"
 #include "graphics/pixelbuffer.h"
 #include "image/tga.h"
 
diff --git a/engines/grim/emi/emi.cpp b/engines/grim/emi/emi.cpp
index 85105ce7d3..79d90cd0e3 100644
--- a/engines/grim/emi/emi.cpp
+++ b/engines/grim/emi/emi.cpp
@@ -222,7 +222,7 @@ void EMIEngine::storeSaveGameImage(SaveGame *state) {
 	// copy the actual screenshot to the correct position
 	unsigned int texWidth = 256, texHeight = 128;
 	unsigned int size = texWidth * texHeight;
-	Graphics::PixelBuffer buffer = Graphics::PixelBuffer::createBuffer<565>(size, DisposeAfterUse::YES);
+	Graphics::PixelBuffer buffer(Graphics::PixelFormat(2, 5, 6, 5, 0, 11, 5, 0, 0), size, DisposeAfterUse::YES);
 	buffer.clear(size);
 	for (unsigned int j = 0; j < 120; j++) {
 		buffer.copyBuffer(j * texWidth, j * width, width, screenshot->getData(0));
diff --git a/engines/grim/emi/lua_v2.cpp b/engines/grim/emi/lua_v2.cpp
index 79fe70ee4c..b391c3a610 100644
--- a/engines/grim/emi/lua_v2.cpp
+++ b/engines/grim/emi/lua_v2.cpp
@@ -507,7 +507,7 @@ void Lua_V2::ThumbnailFromFile() {
 	for (int l = 0; l < dataSize / 2; l++) {
 		data[l] = savedState->readLEUint16();
 	}
-	Graphics::PixelBuffer buf(Graphics::createPixelFormat<565>(), (byte *)data);
+	Graphics::PixelBuffer buf(Graphics::PixelFormat(2, 5, 6, 5, 0, 11, 5, 0, 0), (byte *)data);
 	Bitmap *screenshot = new Bitmap(buf, width, height, "screenshot");
 	if (!screenshot) {
 		lua_pushnil();
diff --git a/engines/grim/gfx_base.cpp b/engines/grim/gfx_base.cpp
index 6becf7798c..96e0a76c9f 100644
--- a/engines/grim/gfx_base.cpp
+++ b/engines/grim/gfx_base.cpp
@@ -176,7 +176,7 @@ void GfxBase::createSpecialtyTexture(uint id, const uint8 *data, int width, int
 }
 
 Bitmap *GfxBase::createScreenshotBitmap(const Graphics::PixelBuffer src, int w, int h, bool flipOrientation) {
-		Graphics::PixelBuffer buffer = Graphics::PixelBuffer::createBuffer<565>(w * h, DisposeAfterUse::YES);
+		Graphics::PixelBuffer buffer(Graphics::PixelFormat(2, 5, 6, 5, 0, 11, 5, 0, 0), w * h, DisposeAfterUse::YES);
 
 		int i1 = (_screenWidth * w - 1) / _screenWidth + 1;
 		int j1 = (_screenHeight * h - 1) / _screenHeight + 1;
diff --git a/engines/grim/gfx_tinygl.cpp b/engines/grim/gfx_tinygl.cpp
index f095a24ce4..cce795df1e 100644
--- a/engines/grim/gfx_tinygl.cpp
+++ b/engines/grim/gfx_tinygl.cpp
@@ -25,7 +25,6 @@
 #include "common/system.h"
 
 #include "graphics/surface.h"
-#include "graphics/colormasks.h"
 
 #include "math/glmath.h"
 
diff --git a/engines/grim/lua_v1.cpp b/engines/grim/lua_v1.cpp
index 24f81eb198..93a23a859e 100644
--- a/engines/grim/lua_v1.cpp
+++ b/engines/grim/lua_v1.cpp
@@ -27,7 +27,6 @@
 
 #include "graphics/pixelbuffer.h"
 #include "graphics/renderer.h"
-#include "graphics/colormasks.h"
 
 #include "math/matrix3.h"
 
@@ -534,7 +533,7 @@ void Lua_V1::GetSaveGameImage() {
 	for (int l = 0; l < dataSize / 2; l++) {
 		data[l] = savedState->readLEUint16();
 	}
-	Graphics::PixelBuffer buf(Graphics::createPixelFormat<565>(), (byte *)data);
+	Graphics::PixelBuffer buf(Graphics::PixelFormat(2, 5, 6, 5, 0, 11, 5, 0, 0), (byte *)data);
 	screenshot = new Bitmap(buf, width, height, "screenshot");
 	delete[] data;
 	if (screenshot) {
diff --git a/graphics/pixelbuffer.h b/graphics/pixelbuffer.h
index 6515fd02f5..bf562ab9f7 100644
--- a/graphics/pixelbuffer.h
+++ b/graphics/pixelbuffer.h
@@ -27,7 +27,6 @@
 #include "common/endian.h"
 #include "common/textconsole.h"
 
-#include "graphics/colormasks.h"
 #include "graphics/pixelformat.h"
 
 namespace Graphics {
@@ -43,24 +42,6 @@ namespace Graphics {
 
 class PixelBuffer {
 public:
-	/**
-	 * Create a PixelBuffer.
-	 * Convenience syntax for PixelBuffer(createPixelFormat<format>(), buffersize, dispose).
-	 */
-	template<int format>
-	inline static PixelBuffer createBuffer(int buffersize, DisposeAfterUse::Flag dispose) {
-		return PixelBuffer(createPixelFormat<format>(), buffersize, dispose);
-	}
-
-	/**
-	 * Create a PixelBuffer.
-	 * Convenience syntax for PixelBuffer(createPixelFormat<format>(), buffer).
-	 */
-	template<int format>
-	inline static PixelBuffer createBuffer(byte *buffer) {
-		return PixelBuffer(createPixelFormat<format>(), buffer);
-	}
-
 	/**
 	 * Construct an empty PixelBuffer.
 	 */


Commit: 10b724fd717fb4bb0f08c598e80b8a20b22473ee
    https://github.com/scummvm/scummvm/commit/10b724fd717fb4bb0f08c598e80b8a20b22473ee
Author: Cameron Cawley (ccawley2011 at gmail.com)
Date: 2021-06-24T11:55:54+02:00

Commit Message:
SWORD25: Remove unneeded use of Graphics::ColorMasks

Changed paths:
    engines/sword25/gfx/image/vectorimage.cpp
    engines/sword25/gfx/image/vectorimagerenderer.cpp


diff --git a/engines/sword25/gfx/image/vectorimage.cpp b/engines/sword25/gfx/image/vectorimage.cpp
index ca4c875419..e2f8f4ee25 100644
--- a/engines/sword25/gfx/image/vectorimage.cpp
+++ b/engines/sword25/gfx/image/vectorimage.cpp
@@ -37,8 +37,6 @@
 #include "sword25/gfx/image/vectorimage.h"
 #include "sword25/gfx/image/renderedimage.h"
 
-#include "graphics/colormasks.h"
-
 namespace Sword25 {
 
 #define BEZSMOOTHNESS 0.5
@@ -291,7 +289,7 @@ VectorImage::VectorImage(const byte *pFileData, uint fileSize, bool &success, co
 				r = bs.getByte();
 				g = bs.getByte();
 				b = bs.getByte();
-				_bgColor = Graphics::ARGBToColor<Graphics::ColorMasks<8888> >(0xff, r, g, b);
+				_bgColor = BS_RGB(r, g, b);
 			}
 			break;
 		default:
@@ -546,7 +544,7 @@ bool VectorImage::parseStyles(uint shapeType, SWFBitStream &bs, uint &numFillBit
 		if (shapeType == 3)
 			a = bs.getByte();
 
-		color = Graphics::ARGBToColor<Graphics::ColorMasks<8888> >(a, r, g, b);
+		color = BS_ARGB(a, r, g, b);
 
 		if (type != 0)
 			return false;
@@ -575,7 +573,7 @@ bool VectorImage::parseStyles(uint shapeType, SWFBitStream &bs, uint &numFillBit
 		if (shapeType == 3)
 			a = bs.getByte();
 
-		color = Graphics::ARGBToColor<Graphics::ColorMasks<8888> >(a, r, g, b);
+		color = BS_ARGB(a, r, g, b);
 
 		_elements.back()._lineStyles.push_back(VectorImageElement::LineStyleType(width, color));
 	}
diff --git a/engines/sword25/gfx/image/vectorimagerenderer.cpp b/engines/sword25/gfx/image/vectorimagerenderer.cpp
index e7a1fefd69..4abbddde02 100644
--- a/engines/sword25/gfx/image/vectorimagerenderer.cpp
+++ b/engines/sword25/gfx/image/vectorimagerenderer.cpp
@@ -40,7 +40,6 @@
 
 #include "sword25/gfx/image/art.h"
 #include "sword25/gfx/image/vectorimage.h"
-#include "graphics/colormasks.h"
 
 namespace Sword25 {
 
@@ -51,7 +50,7 @@ void art_rgb_fill_run1(byte *buf, byte r, byte g, byte b, int n) {
 		memset(buf, g, n + n + n + n);
 	} else {
 		uint32 *alt = (uint32 *)buf;
-		uint32 color = Graphics::ARGBToColor<Graphics::ColorMasks<8888> >(r, g, b, 0xff);
+		uint32 color = BS_ARGB(r, g, b, 0xff);
 
 		for (i = 0; i < n; i++)
 			*alt++ = color;
@@ -225,19 +224,16 @@ void art_rgb_svp_alpha1(const ArtSVP *svp,
 						uint32 color,
 						byte *buf, int rowstride) {
 	ArtRgbSVPAlphaData data;
-	byte r, g, b, alpha;
 	int i;
 	int a, da;
 
-	Graphics::colorToARGB<Graphics::ColorMasks<8888> >(color, alpha, r, g, b);
-
-	data.r = r;
-	data.g = g;
-	data.b = b;
-	data.alpha = alpha;
+	data.r     = (color >> 16) & 0xFF;
+	data.g     = (color >>  8) & 0xFF;
+	data.b     = (color >>  0) & 0xFF;
+	data.alpha = (color >> 24) & 0xFF;
 
 	a = 0x8000;
-	da = (alpha * 66051 + 0x80) >> 8; /* 66051 equals 2 ^ 32 / (255 * 255) */
+	da = (data.alpha * 66051 + 0x80) >> 8; /* 66051 equals 2 ^ 32 / (255 * 255) */
 
 	for (i = 0; i < 256; i++) {
 		data.alphatab[i] = a >> 16;
@@ -248,7 +244,7 @@ void art_rgb_svp_alpha1(const ArtSVP *svp,
 	data.rowstride = rowstride;
 	data.x0 = x0;
 	data.x1 = x1;
-	if (alpha == 255)
+	if (data.alpha == 255)
 		art_svp_render_aa(svp, x0, y0, x1, y1, art_rgb_svp_alpha_opaque_callback1, &data);
 	else
 		art_svp_render_aa(svp, x0, y0, x1, y1, art_rgb_svp_alpha_callback1, &data);
@@ -357,7 +353,7 @@ void drawBez(ArtBpath *bez1, ArtBpath *bez2, byte *buffer, int width, int height
 	// HACK: Some frames have green bounding boxes drawn.
 	// Perhaps they were used by original game artist Umriss
 	// We skip them just like the original
-	if (bez2 == 0 && color == Graphics::ARGBToColor<Graphics::ColorMasks<8888> >(0xff, 0x00, 0xff, 0x00)) {
+	if (bez2 == 0 && color == BS_RGB(0x00, 0xff, 0x00)) {
 		return;
 	}
 


Commit: 632150171ec7a420c713e0558b34e725966dc55b
    https://github.com/scummvm/scummvm/commit/632150171ec7a420c713e0558b34e725966dc55b
Author: Cameron Cawley (ccawley2011 at gmail.com)
Date: 2021-06-24T11:55:54+02:00

Commit Message:
MOHAWK: RIVEN: Remove use of Graphics::ColorMasks

Changed paths:
    engines/mohawk/riven_graphics.cpp


diff --git a/engines/mohawk/riven_graphics.cpp b/engines/mohawk/riven_graphics.cpp
index 426c957523..7db0cadc07 100644
--- a/engines/mohawk/riven_graphics.cpp
+++ b/engines/mohawk/riven_graphics.cpp
@@ -36,7 +36,6 @@
 #include "graphics/fontman.h"
 #include "graphics/font.h"
 #include "graphics/fonts/ttf.h"
-#include "graphics/colormasks.h"
 
 namespace Mohawk {
 
@@ -271,8 +270,8 @@ public:
 	}
 
 	bool drawFrame(uint32 elapsed) override {
-		assert(_effectScreen->format == _mainScreen->format);
-		assert(_effectScreen->format == _system->getScreenFormat());
+		assert(_mainScreen->format.bytesPerPixel == 2);
+		assert(_effectScreen->format.bytesPerPixel == 2);
 
 		if (elapsed == _duration) {
 			_effectScreen->copyRectToSurface(*_mainScreen, 0, 0, Common::Rect(_mainScreen->w, _mainScreen->h));
@@ -288,8 +287,8 @@ public:
 				uint16 *dst = (uint16 *) screen->getBasePtr(0, y);
 				for (uint x = 0; x < _mainScreen->w; x++) {
 					uint8 r1, g1, b1, r2, g2, b2;
-					Graphics::colorToRGB< Graphics::ColorMasks<565> >(*src1++, r1, g1, b1);
-					Graphics::colorToRGB< Graphics::ColorMasks<565> >(*src2++, r2, g2, b2);
+					_mainScreen->format.colorToRGB(*src1++, r1, g1, b1);
+					_effectScreen->format.colorToRGB(*src2++, r2, g2, b2);
 
 					uint r = r1 * alpha + r2 * (255 - alpha);
 					uint g = g1 * alpha + g2 * (255 - alpha);
@@ -299,7 +298,7 @@ public:
 					g /= 255;
 					b /= 255;
 
-					*dst++ = (uint16) Graphics::RGBToColor< Graphics::ColorMasks<565> >(r, g, b);
+					*dst++ = (uint16) screen->format.RGBToColor(r, g, b);
 				}
 			}
 
@@ -329,7 +328,7 @@ RivenGraphics::RivenGraphics(MohawkEngine_Riven* vm) :
 	_bitmapDecoder = new MohawkBitmap();
 
 	// Restrict ourselves to a single pixel format to simplify the effects implementation
-	_pixelFormat = Graphics::createPixelFormat<565>();
+	_pixelFormat = Graphics::PixelFormat(2, 5, 6, 5, 0, 11, 5, 0, 0);
 	initGraphics(608, 436, &_pixelFormat);
 
 	// The actual game graphics only take up the first 392 rows. The inventory


Commit: cdc00c41be335c3babb5c1b252bc43d898972c85
    https://github.com/scummvm/scummvm/commit/cdc00c41be335c3babb5c1b252bc43d898972c85
Author: Cameron Cawley (ccawley2011 at gmail.com)
Date: 2021-06-24T11:55:54+02:00

Commit Message:
IOS7: Remove unneeded use of Graphics::ColorMasks

Changed paths:
    backends/platform/ios7/ios7_osys_main.h
    backends/platform/ios7/ios7_osys_video.mm
    backends/platform/ios7/ios7_video.mm


diff --git a/backends/platform/ios7/ios7_osys_main.h b/backends/platform/ios7/ios7_osys_main.h
index c4d59fb0a5..538d6504b9 100644
--- a/backends/platform/ios7/ios7_osys_main.h
+++ b/backends/platform/ios7/ios7_osys_main.h
@@ -31,7 +31,6 @@
 #include "common/ustr.h"
 #include "audio/mixer_intern.h"
 #include "backends/fs/posix/posix-fs-factory.h"
-#include "graphics/colormasks.h"
 #include "graphics/palette.h"
 
 #include <AudioToolbox/AudioQueue.h>
@@ -167,7 +166,7 @@ public:
 	virtual void copyRectToOverlay(const void *buf, int pitch, int x, int y, int w, int h) override;
 	virtual int16 getOverlayHeight() override;
 	virtual int16 getOverlayWidth() override;
-	virtual Graphics::PixelFormat getOverlayFormat() const override { return Graphics::createPixelFormat<5551>(); }
+	virtual Graphics::PixelFormat getOverlayFormat() const override;
 
 	virtual bool showMouse(bool visible) override;
 
diff --git a/backends/platform/ios7/ios7_osys_video.mm b/backends/platform/ios7/ios7_osys_video.mm
index ad90594982..8adbd4876c 100644
--- a/backends/platform/ios7/ios7_osys_video.mm
+++ b/backends/platform/ios7/ios7_osys_video.mm
@@ -103,7 +103,7 @@ void OSystem_iOS7::initVideoContext() {
 Common::List<Graphics::PixelFormat> OSystem_iOS7::getSupportedFormats() const {
 	Common::List<Graphics::PixelFormat> list;
 	// RGB565
-	list.push_back(Graphics::createPixelFormat<565>());
+	list.push_back(Graphics::PixelFormat(2, 5, 6, 5, 0, 11, 5, 0, 0));
 	// CLUT8
 	list.push_back(Graphics::PixelFormat::createFormatCLUT8());
 	return list;
@@ -201,8 +201,8 @@ void OSystem_iOS7::setPalette(const byte *colors, uint start, uint num) {
 	const byte *b = colors;
 
 	for (uint i = start; i < start + num; ++i) {
-		_gamePalette[i] = Graphics::RGBToColor<Graphics::ColorMasks<565> >(b[0], b[1], b[2]);
-		_gamePaletteRGBA5551[i] = Graphics::RGBToColor<Graphics::ColorMasks<5551> >(b[0], b[1], b[2]);
+		_gamePalette[i] = _videoContext->screenTexture.format.RGBToColor(b[0], b[1], b[2]);
+		_gamePaletteRGBA5551[i] = _videoContext->mouseTexture.format.RGBToColor(b[0], b[1], b[2]);
 		b += 3;
 	}
 
@@ -220,7 +220,7 @@ void OSystem_iOS7::grabPalette(byte *colors, uint start, uint num) const {
 	byte *b = colors;
 
 	for (uint i = start; i < start + num; ++i) {
-		Graphics::colorToRGB<Graphics::ColorMasks<565> >(_gamePalette[i], b[0], b[1], b[2]);
+		_videoContext->screenTexture.format.colorToRGB(_gamePalette[i], b[0], b[1], b[2]);
 		b += 3;
 	}
 }
@@ -439,6 +439,10 @@ int16 OSystem_iOS7::getOverlayWidth() {
 	return _videoContext->overlayWidth;
 }
 
+Graphics::PixelFormat getOverlayFormat() const {
+	return _videoContext->overlayTexture.format;
+}
+
 bool OSystem_iOS7::showMouse(bool visible) {
 	//printf("showMouse(%d)\n", visible);
 	bool last = _videoContext->mouseIsVisible;
@@ -507,7 +511,7 @@ void OSystem_iOS7::setCursorPalette(const byte *colors, uint start, uint num) {
 	assert(start + num <= 256);
 
 	for (uint i = start; i < start + num; ++i, colors += 3)
-		_mouseCursorPalette[i] = Graphics::RGBToColor<Graphics::ColorMasks<5551> >(colors[0], colors[1], colors[2]);
+		_mouseCursorPalette[i] = _videoContext->mouseTexture.format.RGBToColor(colors[0], colors[1], colors[2]);
 
 	// FIXME: This is just stupid, our client code seems to assume that this
 	// automatically enables the cursor palette.
@@ -523,7 +527,7 @@ void OSystem_iOS7::updateMouseTexture() {
 
 	Graphics::Surface &mouseTexture = _videoContext->mouseTexture;
 	if (mouseTexture.w != texWidth || mouseTexture.h != texHeight)
-		mouseTexture.create(texWidth, texHeight, Graphics::createPixelFormat<5551>());
+		mouseTexture.create(texWidth, texHeight, Graphics::PixelFormat(2, 5, 5, 5, 1, 11, 6, 1, 0));
 
 	if (_mouseBuffer.format.bytesPerPixel == 1) {
 		const uint16 *palette;
diff --git a/backends/platform/ios7/ios7_video.mm b/backends/platform/ios7/ios7_video.mm
index 3e4df0d59e..8aa08094f7 100644
--- a/backends/platform/ios7/ios7_video.mm
+++ b/backends/platform/ios7/ios7_video.mm
@@ -25,7 +25,6 @@
 
 #include "backends/platform/ios7/ios7_video.h"
 
-#include "graphics/colormasks.h"
 #include "backends/platform/ios7/ios7_app_delegate.h"
 
 static int g_needsScreenUpdate = 0;
@@ -210,7 +209,7 @@ uint getSizeNextPOT(uint size) {
 	_overlayCoords[2].x = 0; _overlayCoords[2].y = 0; _overlayCoords[2].u = 0; _overlayCoords[2].v = v;
 	_overlayCoords[3].x = 0; _overlayCoords[3].y = 0; _overlayCoords[3].u = u; _overlayCoords[3].v = v;
 
-	_videoContext.overlayTexture.create((uint16) overlayTextureWidthPOT, (uint16) overlayTextureHeightPOT, Graphics::createPixelFormat<5551>());
+	_videoContext.overlayTexture.create((uint16) overlayTextureWidthPOT, (uint16) overlayTextureHeightPOT, Graphics::PixelFormat(2, 5, 5, 5, 1, 11, 6, 1, 0));
 }
 
 - (void)deleteFramebuffer {
@@ -606,7 +605,7 @@ uint getSizeNextPOT(uint size) {
 	_gameScreenCoords[1].u = _gameScreenCoords[3].u = _videoContext.screenWidth / (GLfloat)screenTexWidth;
 	_gameScreenCoords[2].v = _gameScreenCoords[3].v = _videoContext.screenHeight / (GLfloat)screenTexHeight;
 
-	_videoContext.screenTexture.create((uint16) screenTexWidth, (uint16) screenTexHeight, Graphics::createPixelFormat<565>());
+	_videoContext.screenTexture.create((uint16) screenTexWidth, (uint16) screenTexHeight, Graphics::PixelFormat(2, 5, 6, 5, 0, 11, 5, 0, 0));
 }
 
 - (void)initSurface {


Commit: 64fc110586cf2819815c17ded68bf9f24b8aa165
    https://github.com/scummvm/scummvm/commit/64fc110586cf2819815c17ded68bf9f24b8aa165
Author: Cameron Cawley (ccawley2011 at gmail.com)
Date: 2021-06-24T11:55:54+02:00

Commit Message:
IPHONE: Remove unneeded use of Graphics::ColorMasks

Changed paths:
    backends/platform/iphone/iphone_video.mm
    backends/platform/iphone/osys_main.h
    backends/platform/iphone/osys_video.mm


diff --git a/backends/platform/iphone/iphone_video.mm b/backends/platform/iphone/iphone_video.mm
index d99c1e2822..a13457081c 100644
--- a/backends/platform/iphone/iphone_video.mm
+++ b/backends/platform/iphone/iphone_video.mm
@@ -25,8 +25,6 @@
 
 #include "backends/platform/iphone/iphone_video.h"
 
-#include "graphics/colormasks.h"
-
 iPhoneView *g_iPhoneViewInstance = nil;
 static int g_fullWidth;
 static int g_fullHeight;
@@ -144,7 +142,7 @@ const char *iPhone_getDocumentsDir() {
 		_overlayTexCoords[2] = _overlayTexCoords[6] = _videoContext.overlayWidth / (GLfloat)overlayTextureWidth;
 		_overlayTexCoords[5] = _overlayTexCoords[7] = _videoContext.overlayHeight / (GLfloat)overlayTextureHeight;
 
-		_videoContext.overlayTexture.create(overlayTextureWidth, overlayTextureHeight, Graphics::createPixelFormat<5551>());
+		_videoContext.overlayTexture.create(overlayTextureWidth, overlayTextureHeight, Graphics::PixelFormat(2, 5, 5, 5, 1, 11, 6, 1, 0));
 
 		glViewport(0, 0, _renderBufferWidth, _renderBufferHeight); printOpenGLError();
 		glClearColor(0.0f, 0.0f, 0.0f, 1.0f); printOpenGLError();
@@ -448,7 +446,7 @@ const char *iPhone_getDocumentsDir() {
 	_gameScreenTexCoords[2] = _gameScreenTexCoords[6] = _videoContext.screenWidth / (GLfloat)screenTexWidth;
 	_gameScreenTexCoords[5] = _gameScreenTexCoords[7] = _videoContext.screenHeight / (GLfloat)screenTexHeight;
 
-	_videoContext.screenTexture.create(screenTexWidth, screenTexHeight, Graphics::createPixelFormat<565>());
+	_videoContext.screenTexture.create(screenTexWidth, screenTexHeight, Graphics::PixelFormat(2, 5, 6, 5, 0, 11, 5, 0, 0));
 }
 
 - (void)initSurface {
diff --git a/backends/platform/iphone/osys_main.h b/backends/platform/iphone/osys_main.h
index 4a24e8f349..3060434894 100644
--- a/backends/platform/iphone/osys_main.h
+++ b/backends/platform/iphone/osys_main.h
@@ -29,7 +29,6 @@
 #include "common/events.h"
 #include "audio/mixer_intern.h"
 #include "backends/fs/posix/posix-fs-factory.h"
-#include "graphics/colormasks.h"
 #include "graphics/palette.h"
 
 #include <AudioToolbox/AudioQueue.h>
@@ -155,7 +154,7 @@ public:
 	virtual void copyRectToOverlay(const void *buf, int pitch, int x, int y, int w, int h);
 	virtual int16 getOverlayHeight();
 	virtual int16 getOverlayWidth();
-	virtual Graphics::PixelFormat getOverlayFormat() const { return Graphics::createPixelFormat<5551>(); }
+	virtual Graphics::PixelFormat getOverlayFormat() const;
 
 	virtual bool showMouse(bool visible);
 
diff --git a/backends/platform/iphone/osys_video.mm b/backends/platform/iphone/osys_video.mm
index 3d8128e91c..f6b08a7ff0 100644
--- a/backends/platform/iphone/osys_video.mm
+++ b/backends/platform/iphone/osys_video.mm
@@ -48,7 +48,7 @@ void OSystem_IPHONE::initVideoContext() {
 Common::List<Graphics::PixelFormat> OSystem_IPHONE::getSupportedFormats() const {
 	Common::List<Graphics::PixelFormat> list;
 	// RGB565
-	list.push_back(Graphics::createPixelFormat<565>());
+	list.push_back(Graphics::PixelFormat(2, 5, 6, 5, 0, 11, 5, 0, 0));
 	// CLUT8
 	list.push_back(Graphics::PixelFormat::createFormatCLUT8());
 	return list;
@@ -131,8 +131,8 @@ void OSystem_IPHONE::setPalette(const byte *colors, uint start, uint num) {
 	const byte *b = colors;
 
 	for (uint i = start; i < start + num; ++i) {
-		_gamePalette[i] = Graphics::RGBToColor<Graphics::ColorMasks<565> >(b[0], b[1], b[2]);
-		_gamePaletteRGBA5551[i] = Graphics::RGBToColor<Graphics::ColorMasks<5551> >(b[0], b[1], b[2]);
+		_gamePalette[i] = _videoContext->screenTexture.format.RGBToColor(b[0], b[1], b[2]);
+		_gamePaletteRGBA5551[i] = _videoContext->mouseTexture.format.RGBToColor(b[0], b[1], b[2]);
 		b += 3;
 	}
 
@@ -150,7 +150,7 @@ void OSystem_IPHONE::grabPalette(byte *colors, uint start, uint num) const {
 	byte *b = colors;
 
 	for (uint i = start; i < start + num; ++i) {
-		Graphics::colorToRGB<Graphics::ColorMasks<565> >(_gamePalette[i], b[0], b[1], b[2]);
+		_videoContext->screenTexture.format.colorToRGB(_gamePalette[i], b[0], b[1], b[2]);
 		b += 3;
 	}
 }
@@ -363,6 +363,10 @@ int16 OSystem_IPHONE::getOverlayWidth() {
 	return _videoContext->overlayWidth;
 }
 
+Graphics::PixelFormat getOverlayFormat() const {
+	return _videoContext->overlayTexture.format;
+}
+
 bool OSystem_IPHONE::showMouse(bool visible) {
 	//printf("showMouse(%d)\n", visible);
 	bool last = _videoContext->mouseIsVisible;
@@ -429,7 +433,7 @@ void OSystem_IPHONE::setCursorPalette(const byte *colors, uint start, uint num)
 	assert(start + num <= 256);
 
 	for (uint i = start; i < start + num; ++i, colors += 3)
-		_mouseCursorPalette[i] = Graphics::RGBToColor<Graphics::ColorMasks<5551> >(colors[0], colors[1], colors[2]);
+		_mouseCursorPalette[i] = _videoContext->mouseTexture.format.RGBToColor(colors[0], colors[1], colors[2]);
 
 	// FIXME: This is just stupid, our client code seems to assume that this
 	// automatically enables the cursor palette.
@@ -445,7 +449,7 @@ void OSystem_IPHONE::updateMouseTexture() {
 
 	Graphics::Surface &mouseTexture = _videoContext->mouseTexture;
 	if (mouseTexture.w != texWidth || mouseTexture.h != texHeight)
-		mouseTexture.create(texWidth, texHeight, Graphics::createPixelFormat<5551>());
+		mouseTexture.create(texWidth, texHeight, Graphics::PixelFormat(2, 5, 5, 5, 1, 11, 6, 1, 0));
 
 	if (_mouseBuffer.format.bytesPerPixel == 1) {
 		const uint16 *palette;


Commit: 82a85494cd266b21ad6c6eb6427144b44200728e
    https://github.com/scummvm/scummvm/commit/82a85494cd266b21ad6c6eb6427144b44200728e
Author: Cameron Cawley (ccawley2011 at gmail.com)
Date: 2021-06-24T11:55:54+02:00

Commit Message:
GRAPHICS: Integrate Graphics::ColorMasks with Graphics::PixelFormat

Changed paths:
    graphics/colormasks.h
    graphics/pixelformat.h
    graphics/scaler/thumbnail_intern.cpp
    graphics/thumbnail.cpp


diff --git a/graphics/colormasks.h b/graphics/colormasks.h
index d845b4f088..54e38e7fed 100644
--- a/graphics/colormasks.h
+++ b/graphics/colormasks.h
@@ -23,7 +23,7 @@
 #ifndef GRAPHICS_COLORMASKS_H
 #define GRAPHICS_COLORMASKS_H
 
-#include "graphics/pixelformat.h"
+#include "common/scummsys.h"
 
 namespace Graphics {
 
@@ -287,63 +287,6 @@ struct ColorMasks<8888> {
 	typedef uint32 PixelType;
 };
 
-template<class T>
-uint32 RGBToColor(uint8 r, uint8 g, uint8 b) {
-	return T::kAlphaMask |
-	       (((r << T::kRedShift) >> (8 - T::kRedBits)) & T::kRedMask) |
-	       (((g << T::kGreenShift) >> (8 - T::kGreenBits)) & T::kGreenMask) |
-	       (((b << T::kBlueShift) >> (8 - T::kBlueBits)) & T::kBlueMask);
-}
-
-template<class T>
-uint32 ARGBToColor(uint8 a, uint8 r, uint8 g, uint8 b) {
-	return (((a << T::kAlphaShift) >> (8 - T::kAlphaBits)) & T::kAlphaMask) |
-	       (((r << T::kRedShift) >> (8 - T::kRedBits)) & T::kRedMask) |
-	       (((g << T::kGreenShift) >> (8 - T::kGreenBits)) & T::kGreenMask) |
-	       (((b << T::kBlueShift) >> (8 - T::kBlueBits)) & T::kBlueMask);
-}
-
-template<class T>
-void colorToRGB(uint32 color, uint8 &r, uint8 &g, uint8 &b) {
-	r = ((color & T::kRedMask) >> T::kRedShift) << (8 - T::kRedBits);
-	g = ((color & T::kGreenMask) >> T::kGreenShift) << (8 - T::kGreenBits);
-	b = ((color & T::kBlueMask) >> T::kBlueShift) << (8 - T::kBlueBits);
-}
-
-template<class T>
-void colorToARGB(uint32 color, uint8 &a, uint8 &r, uint8 &g, uint8 &b) {
-	a = ((color & T::kAlphaMask) >> T::kAlphaShift) << (8 - T::kAlphaBits);
-	r = ((color & T::kRedMask) >> T::kRedShift) << (8 - T::kRedBits);
-	g = ((color & T::kGreenMask) >> T::kGreenShift) << (8 - T::kGreenBits);
-	b = ((color & T::kBlueMask) >> T::kBlueShift) << (8 - T::kBlueBits);
-}
-
-
-
-/**
- * Convert a 'bitFormat' as defined by one of the ColorMasks
- * into a PixelFormat.
- */
-template<int bitFormat>
-PixelFormat createPixelFormat() {
-	PixelFormat format;
-
-	format.bytesPerPixel = ColorMasks<bitFormat>::kBytesPerPixel;
-
-	format.rLoss = 8 - ColorMasks<bitFormat>::kRedBits;
-	format.gLoss = 8 - ColorMasks<bitFormat>::kGreenBits;
-	format.bLoss = 8 - ColorMasks<bitFormat>::kBlueBits;
-	format.aLoss = 8 - ColorMasks<bitFormat>::kAlphaBits;
-
-	format.rShift = ColorMasks<bitFormat>::kRedShift;
-	format.gShift = ColorMasks<bitFormat>::kGreenShift;
-	format.bShift = ColorMasks<bitFormat>::kBlueShift;
-	format.aShift = ColorMasks<bitFormat>::kAlphaShift;
-
-	return format;
-}
-
-
 } // End of namespace Graphics
 
 #endif
diff --git a/graphics/pixelformat.h b/graphics/pixelformat.h
index 9af1919627..7c869dc34b 100644
--- a/graphics/pixelformat.h
+++ b/graphics/pixelformat.h
@@ -26,6 +26,8 @@
 #include "common/scummsys.h"
 #include "common/str.h"
 
+#include "graphics/colormasks.h"
+
 namespace Graphics {
 
 /**
@@ -212,6 +214,14 @@ struct PixelFormat {
 			((   b >> bLoss) << bShift);
 	}
 
+	template<class T>
+	inline uint32 RGBToColorT(uint8 r, uint8 g, uint8 b) const {
+		return T::kAlphaMask |
+		       (((r << T::kRedShift) >> (8 - T::kRedBits)) & T::kRedMask) |
+		       (((g << T::kGreenShift) >> (8 - T::kGreenBits)) & T::kGreenMask) |
+		       (((b << T::kBlueShift) >> (8 - T::kBlueBits)) & T::kBlueMask);
+	}
+
 	/** Return an ARGB color value from alpha, red, green, and blue values. */
 	inline uint32 ARGBToColor(uint8 a, uint8 r, uint8 g, uint8 b) const {
 		return
@@ -221,6 +231,14 @@ struct PixelFormat {
 			((b >> bLoss) << bShift);
 	}
 
+	template<class T>
+	inline uint32 ARGBToColorT(uint8 a, uint8 r, uint8 g, uint8 b) const {
+		return (((a << T::kAlphaShift) >> (8 - T::kAlphaBits)) & T::kAlphaMask) |
+		       (((r << T::kRedShift) >> (8 - T::kRedBits)) & T::kRedMask) |
+		       (((g << T::kGreenShift) >> (8 - T::kGreenBits)) & T::kGreenMask) |
+		       (((b << T::kBlueShift) >> (8 - T::kBlueBits)) & T::kBlueMask);
+	}
+
 	/** Retrieve red, green, and blue values from an RGB color value. */
 	inline void colorToRGB(uint32 color, uint8 &r, uint8 &g, uint8 &b) const {
 		r = expand(rBits(), color >> rShift);
@@ -228,6 +246,13 @@ struct PixelFormat {
 		b = expand(bBits(), color >> bShift);
 	}
 
+	template<class T>
+	inline void colorToRGBT(uint32 color, uint8 &r, uint8 &g, uint8 &b) const {
+		r = ((color & T::kRedMask) >> T::kRedShift) << (8 - T::kRedBits);
+		g = ((color & T::kGreenMask) >> T::kGreenShift) << (8 - T::kGreenBits);
+		b = ((color & T::kBlueMask) >> T::kBlueShift) << (8 - T::kBlueBits);
+	}
+
 	/** Retrieve alpha, red, green, and blue values from an ARGB color value. */
 	inline void colorToARGB(uint32 color, uint8 &a, uint8 &r, uint8 &g, uint8 &b) const {
 		a = (aBits() == 0) ? 0xFF : expand(aBits(), color >> aShift);
@@ -236,6 +261,14 @@ struct PixelFormat {
 		b = expand(bBits(), color >> bShift);
 	}
 
+	template<class T>
+	inline void colorToARGBT(uint32 color, uint8 &a, uint8 &r, uint8 &g, uint8 &b) const {
+		a = ((color & T::kAlphaMask) >> T::kAlphaShift) << (8 - T::kAlphaBits);
+		r = ((color & T::kRedMask) >> T::kRedShift) << (8 - T::kRedBits);
+		g = ((color & T::kGreenMask) >> T::kGreenShift) << (8 - T::kGreenBits);
+		b = ((color & T::kBlueMask) >> T::kBlueShift) << (8 - T::kBlueBits);
+	}
+
 	/**
 	 * @name Convenience functions for getting the number of color component bits
 	 * @{
@@ -341,6 +374,51 @@ struct PixelFormat {
 	/** Return string representation. */
 	Common::String toString() const;
 };
+
+template<>
+inline uint32 PixelFormat::RGBToColorT<ColorMasks<0> >(uint8 r, uint8 g, uint8 b) const {
+	return RGBToColor(r, g, b);
+}
+
+template<>
+inline uint32 PixelFormat::ARGBToColorT<ColorMasks<0> >(uint8 a, uint8 r, uint8 g, uint8 b) const {
+	return ARGBToColor(a, r, g, b);
+}
+
+template<>
+inline void PixelFormat::colorToRGBT<ColorMasks<0> >(uint32 color, uint8 &r, uint8 &g, uint8 &b) const {
+	colorToRGB(color, r, g, b);
+}
+
+template<>
+inline void PixelFormat::colorToARGBT<ColorMasks<0> >(uint32 color, uint8 &a, uint8 &r, uint8 &g, uint8 &b) const {
+	colorToARGB(color, a, r, g, b);
+}
+
+/**
+ * Convert a 'bitFormat' as defined by one of the ColorMasks
+ * into a PixelFormat.
+ */
+template<int bitFormat>
+PixelFormat createPixelFormat() {
+	PixelFormat format;
+
+	format.bytesPerPixel = ColorMasks<bitFormat>::kBytesPerPixel;
+
+	format.rLoss = 8 - ColorMasks<bitFormat>::kRedBits;
+	format.gLoss = 8 - ColorMasks<bitFormat>::kGreenBits;
+	format.bLoss = 8 - ColorMasks<bitFormat>::kBlueBits;
+	format.aLoss = 8 - ColorMasks<bitFormat>::kAlphaBits;
+
+	format.rShift = ColorMasks<bitFormat>::kRedShift;
+	format.gShift = ColorMasks<bitFormat>::kGreenShift;
+	format.bShift = ColorMasks<bitFormat>::kBlueShift;
+	format.aShift = ColorMasks<bitFormat>::kAlphaShift;
+
+	return format;
+}
+
+
 /** @} */
 } // End of namespace Graphics
 
diff --git a/graphics/scaler/thumbnail_intern.cpp b/graphics/scaler/thumbnail_intern.cpp
index 78fb7828d7..6465c79ec7 100644
--- a/graphics/scaler/thumbnail_intern.cpp
+++ b/graphics/scaler/thumbnail_intern.cpp
@@ -29,7 +29,7 @@
 #include "graphics/scaler/intern.h"
 #include "graphics/palette.h"
 
-template<int bitFormat>
+template<typename ColorMask>
 uint16 quadBlockInterpolate(const uint8 *src, uint32 srcPitch) {
 	uint16 colorx1y1 = *(((const uint16 *)src));
 	uint16 colorx2y1 = *(((const uint16 *)src) + 1);
@@ -37,10 +37,10 @@ uint16 quadBlockInterpolate(const uint8 *src, uint32 srcPitch) {
 	uint16 colorx1y2 = *(((const uint16 *)(src + srcPitch)));
 	uint16 colorx2y2 = *(((const uint16 *)(src + srcPitch)) + 1);
 
-	return interpolate16_1_1_1_1<Graphics::ColorMasks<bitFormat> >(colorx1y1, colorx2y1, colorx1y2, colorx2y2);
+	return interpolate16_1_1_1_1<ColorMask>(colorx1y1, colorx2y1, colorx1y2, colorx2y2);
 }
 
-template<int bitFormat>
+template<typename ColorMask>
 void createThumbnail_2(const uint8 *src, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch, int width, int height) {
 	// Make sure the width and height is a multiple of 2.
 	width &= ~1;
@@ -48,14 +48,14 @@ void createThumbnail_2(const uint8 *src, uint32 srcPitch, uint8 *dstPtr, uint32
 
 	for (int y = 0; y < height; y += 2) {
 		for (int x = 0; x < width; x += 2, dstPtr += 2) {
-			*((uint16 *)dstPtr) = quadBlockInterpolate<bitFormat>(src + 2 * x, srcPitch);
+			*((uint16 *)dstPtr) = quadBlockInterpolate<ColorMask>(src + 2 * x, srcPitch);
 		}
 		dstPtr += (dstPitch - 2 * width / 2);
 		src += 2 * srcPitch;
 	}
 }
 
-template<int bitFormat>
+template<typename ColorMask>
 void createThumbnail_4(const uint8 *src, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch, int width, int height) {
 	// Make sure the width and height is a multiple of 4
 	width &= ~3;
@@ -63,27 +63,28 @@ void createThumbnail_4(const uint8 *src, uint32 srcPitch, uint8 *dstPtr, uint32
 
 	for (int y = 0; y < height; y += 4) {
 		for (int x = 0; x < width; x += 4, dstPtr += 2) {
-			uint16 upleft = quadBlockInterpolate<bitFormat>(src + 2 * x, srcPitch);
-			uint16 upright = quadBlockInterpolate<bitFormat>(src + 2 * (x + 2), srcPitch);
-			uint16 downleft = quadBlockInterpolate<bitFormat>(src + srcPitch * 2 + 2 * x, srcPitch);
-			uint16 downright = quadBlockInterpolate<bitFormat>(src + srcPitch * 2 + 2 * (x + 2), srcPitch);
+			uint16 upleft = quadBlockInterpolate<ColorMask>(src + 2 * x, srcPitch);
+			uint16 upright = quadBlockInterpolate<ColorMask>(src + 2 * (x + 2), srcPitch);
+			uint16 downleft = quadBlockInterpolate<ColorMask>(src + srcPitch * 2 + 2 * x, srcPitch);
+			uint16 downright = quadBlockInterpolate<ColorMask>(src + srcPitch * 2 + 2 * (x + 2), srcPitch);
 
-			*((uint16 *)dstPtr) = interpolate16_1_1_1_1<Graphics::ColorMasks<bitFormat> >(upleft, upright, downleft, downright);
+			*((uint16 *)dstPtr) = interpolate16_1_1_1_1<ColorMask>(upleft, upright, downleft, downright);
 		}
 		dstPtr += (dstPitch - 2 * width / 4);
 		src += 4 * srcPitch;
 	}
 }
 
+template<typename ColorMask>
 static void scaleThumbnail(Graphics::Surface &in, Graphics::Surface &out) {
 	while (in.w / out.w >= 4 || in.h / out.h >= 4) {
-		createThumbnail_4<565>((const uint8 *)in.getPixels(), in.pitch, (uint8 *)in.getPixels(), in.pitch, in.w, in.h);
+		createThumbnail_4<ColorMask>((const uint8 *)in.getPixels(), in.pitch, (uint8 *)in.getPixels(), in.pitch, in.w, in.h);
 		in.w /= 4;
 		in.h /= 4;
 	}
 
 	while (in.w / out.w >= 2 || in.h / out.h >= 2) {
-		createThumbnail_2<565>((const uint8 *)in.getPixels(), in.pitch, (uint8 *)in.getPixels(), in.pitch, in.w, in.h);
+		createThumbnail_2<ColorMask>((const uint8 *)in.getPixels(), in.pitch, (uint8 *)in.getPixels(), in.pitch, in.w, in.h);
 		in.w /= 2;
 		in.h /= 2;
 	}
@@ -134,13 +135,13 @@ static void scaleThumbnail(Graphics::Surface &in, Graphics::Surface &out) {
 
 				// Look up colors at the points
 				uint8 p1R, p1G, p1B;
-				Graphics::colorToRGB<Graphics::ColorMasks<565> >(READ_UINT16(in.getBasePtr(x1, y1)), p1R, p1G, p1B);
+				in.format.colorToRGBT<ColorMask>(READ_UINT16(in.getBasePtr(x1, y1)), p1R, p1G, p1B);
 				uint8 p2R, p2G, p2B;
-				Graphics::colorToRGB<Graphics::ColorMasks<565> >(READ_UINT16(in.getBasePtr(x2, y1)), p2R, p2G, p2B);
+				in.format.colorToRGBT<ColorMask>(READ_UINT16(in.getBasePtr(x2, y1)), p2R, p2G, p2B);
 				uint8 p3R, p3G, p3B;
-				Graphics::colorToRGB<Graphics::ColorMasks<565> >(READ_UINT16(in.getBasePtr(x1, y2)), p3R, p3G, p3B);
+				in.format.colorToRGBT<ColorMask>(READ_UINT16(in.getBasePtr(x1, y2)), p3R, p3G, p3B);
 				uint8 p4R, p4G, p4B;
-				Graphics::colorToRGB<Graphics::ColorMasks<565> >(READ_UINT16(in.getBasePtr(x2, y2)), p4R, p4G, p4B);
+				in.format.colorToRGBT<ColorMask>(READ_UINT16(in.getBasePtr(x2, y2)), p4R, p4G, p4B);
 
 				const float xDiff = xFrac - x1;
 				const float yDiff = yFrac - y1;
@@ -149,7 +150,7 @@ static void scaleThumbnail(Graphics::Surface &in, Graphics::Surface &out) {
 				uint8 pG = (uint8)((1 - yDiff) * ((1 - xDiff) * p1G + xDiff * p2G) + yDiff * ((1 - xDiff) * p3G + xDiff * p4G));
 				uint8 pB = (uint8)((1 - yDiff) * ((1 - xDiff) * p1B + xDiff * p2B) + yDiff * ((1 - xDiff) * p3B + xDiff * p4B));
 
-				WRITE_UINT16(dst, Graphics::RGBToColor<Graphics::ColorMasks<565> >(pR, pG, pB));
+				WRITE_UINT16(dst, out.format.RGBToColorT<ColorMask>(pR, pG, pB));
 				dst += 2;
 			}
 
@@ -203,7 +204,7 @@ static bool grabScreen565(Graphics::Surface *surf) {
 				screenFormat.colorToRGB(col, r, g, b);
 			}
 
-			*((uint16 *)surf->getBasePtr(x, y)) = Graphics::RGBToColor<Graphics::ColorMasks<565> >(r, g, b);
+			*((uint16 *)surf->getBasePtr(x, y)) = surf->format.RGBToColor(r, g, b);
 		}
 	}
 
@@ -222,7 +223,8 @@ static bool createThumbnail(Graphics::Surface &out, Graphics::Surface &in) {
 	}
 
 	out.create(kThumbnailWidth, height, Graphics::PixelFormat(2, 5, 6, 5, 0, 11, 5, 0, 0));
-	scaleThumbnail(in, out);
+	assert(out.format == Graphics::createPixelFormat<565>());
+	scaleThumbnail<Graphics::ColorMasks<565> >(in, out);
 	in.free();
 	return true;
 }
@@ -251,7 +253,7 @@ bool createThumbnail(Graphics::Surface *surf, const uint8 *pixels, int w, int h,
 			g = palette[pixels[y * w + x] * 3 + 1];
 			b = palette[pixels[y * w + x] * 3 + 2];
 
-			*((uint16 *)screen.getBasePtr(x, y)) = Graphics::RGBToColor<Graphics::ColorMasks<565> >(r, g, b);
+			*((uint16 *)screen.getBasePtr(x, y)) = screen.format.RGBToColor(r, g, b);
 		}
 	}
 
@@ -277,7 +279,7 @@ bool createScreenShot(Graphics::Surface &surf) {
 				byte r = 0, g = 0, b = 0, a = 0;
 				uint32 col = READ_UINT32(screen->getBasePtr(x, y));
 				screenFormat.colorToARGB(col, a, r, g, b);
-				*((uint32 *)surf.getBasePtr(x, y)) = Graphics::ARGBToColor<Graphics::ColorMasks<8888> >(a, r, g, b);
+				*((uint32 *)surf.getBasePtr(x, y)) = surf.format.ARGBToColor(a, r, g, b);
 			}
 		}
 		g_system->unlockScreen();
diff --git a/graphics/thumbnail.cpp b/graphics/thumbnail.cpp
index e59928d5cb..2cea54dac0 100644
--- a/graphics/thumbnail.cpp
+++ b/graphics/thumbnail.cpp
@@ -22,7 +22,7 @@
 
 #include "graphics/thumbnail.h"
 #include "graphics/scaler.h"
-#include "graphics/colormasks.h"
+#include "graphics/pixelformat.h"
 #include "common/endian.h"
 #include "common/algorithm.h"
 #include "common/system.h"


Commit: 359109df103d90494bf0e5ab166292fc67eae54c
    https://github.com/scummvm/scummvm/commit/359109df103d90494bf0e5ab166292fc67eae54c
Author: Cameron Cawley (ccawley2011 at gmail.com)
Date: 2021-06-24T11:55:54+02:00

Commit Message:
GRAPHICS: Add optimized versions of scaleBlitBilinear and rotoscaleBlitLinear

Changed paths:
    graphics/conversion.cpp


diff --git a/graphics/conversion.cpp b/graphics/conversion.cpp
index 81e117106f..f12db3dd67 100644
--- a/graphics/conversion.cpp
+++ b/graphics/conversion.cpp
@@ -333,29 +333,29 @@ inline byte scaleBlitBilinearInterpolate(byte c01, byte c00, byte c11, byte c10,
 	return (((t2 - t1) * ey) >> 16) + t1;
 }
 
-template <typename Size>
+template <typename ColorMask, typename Size>
 Size scaleBlitBilinearInterpolate(Size c01, Size c00, Size c11, Size c10, int ex, int ey,
 								  const Graphics::PixelFormat &fmt) {
 	byte c01_a, c01_r, c01_g, c01_b;
-	fmt.colorToARGB(c01, c01_a, c01_r, c01_g, c01_b);
+	fmt.colorToARGBT<ColorMask>(c01, c01_a, c01_r, c01_g, c01_b);
 
 	byte c00_a, c00_r, c00_g, c00_b;
-	fmt.colorToARGB(c00, c00_a, c00_r, c00_g, c00_b);
+	fmt.colorToARGBT<ColorMask>(c00, c00_a, c00_r, c00_g, c00_b);
 
 	byte c11_a, c11_r, c11_g, c11_b;
-	fmt.colorToARGB(c11, c11_a, c11_r, c11_g, c11_b);
+	fmt.colorToARGBT<ColorMask>(c11, c11_a, c11_r, c11_g, c11_b);
 
 	byte c10_a, c10_r, c10_g, c10_b;
-	fmt.colorToARGB(c10, c10_a, c10_r, c10_g, c10_b);
+	fmt.colorToARGBT<ColorMask>(c10, c10_a, c10_r, c10_g, c10_b);
 
 	byte dp_a = scaleBlitBilinearInterpolate(c01_a, c00_a, c11_a, c10_a, ex, ey);
 	byte dp_r = scaleBlitBilinearInterpolate(c01_r, c00_r, c11_r, c10_r, ex, ey);
 	byte dp_g = scaleBlitBilinearInterpolate(c01_g, c00_g, c11_g, c10_g, ex, ey);
 	byte dp_b = scaleBlitBilinearInterpolate(c01_b, c00_b, c11_b, c10_b, ex, ey);
-	return fmt.ARGBToColor(dp_a, dp_r, dp_g, dp_b);
+	return fmt.ARGBToColorT<ColorMask>(dp_a, dp_r, dp_g, dp_b);
 }
 
-template <typename Size, bool flipx, bool flipy> // TODO: See mirroring comment in RenderTicket ctor
+template <typename ColorMask, typename Size, bool flipx, bool flipy> // TODO: See mirroring comment in RenderTicket ctor
 void scaleBlitBilinearLogic(byte *dst, const byte *src,
 							const uint dstPitch, const uint srcPitch,
 							const uint dstW, const uint dstH,
@@ -412,7 +412,7 @@ void scaleBlitBilinearLogic(byte *dst, const byte *src,
 			/*
 			* Draw and interpolate colors
 			*/
-			*dp = scaleBlitBilinearInterpolate(*(const Size *)c01, *(const Size *)c00, *(const Size *)c11, *(const Size *)c10, ex, ey, fmt);
+			*dp = scaleBlitBilinearInterpolate<ColorMask, Size>(*(const Size *)c01, *(const Size *)c00, *(const Size *)c11, *(const Size *)c10, ex, ey, fmt);
 			/*
 			* Advance source pointer x
 			*/
@@ -445,7 +445,7 @@ void scaleBlitBilinearLogic(byte *dst, const byte *src,
 	}
 }
 
-template<typename Size, bool filtering, bool flipx, bool flipy> // TODO: See mirroring comment in RenderTicket ctor
+template<typename ColorMask, typename Size, bool filtering, bool flipx, bool flipy> // TODO: See mirroring comment in RenderTicket ctor
 void rotoscaleBlitLogic(byte *dst, const byte *src,
 						const uint dstPitch, const uint srcPitch,
 						const uint dstW, const uint dstH,
@@ -520,7 +520,7 @@ void rotoscaleBlitLogic(byte *dst, const byte *src,
 					*/
 					int ex = (sdx & 0xffff);
 					int ey = (sdy & 0xffff);
-					*pc = scaleBlitBilinearInterpolate(c01, c00, c11, c10, ex, ey, fmt);
+					*pc = scaleBlitBilinearInterpolate<ColorMask, Size>(c01, c00, c11, c10, ex, ey, fmt);
 				}
 			} else {
 				if ((dx >= 0) && (dy >= 0) && (dx < (int)srcW) && (dy < (int)srcH)) {
@@ -589,10 +589,19 @@ bool scaleBlitBilinear(byte *dst, const byte *src,
 		}
 	}
 
-	if (fmt.bytesPerPixel == 4) {
-		scaleBlitBilinearLogic<uint32, false, false>(dst, src, dstPitch, srcPitch, dstW, dstH, srcW, srcH, fmt, sax, say);
+	if (fmt == createPixelFormat<8888>()) {
+		scaleBlitBilinearLogic<ColorMasks<8888>, uint32, false, false>(dst, src, dstPitch, srcPitch, dstW, dstH, srcW, srcH, fmt, sax, say);
+	} else if (fmt == createPixelFormat<888>()) {
+		scaleBlitBilinearLogic<ColorMasks<888>,  uint32, false, false>(dst, src, dstPitch, srcPitch, dstW, dstH, srcW, srcH, fmt, sax, say);
+	} else if (fmt == createPixelFormat<565>()) {
+		scaleBlitBilinearLogic<ColorMasks<565>,  uint16, false, false>(dst, src, dstPitch, srcPitch, dstW, dstH, srcW, srcH, fmt, sax, say);
+	} else if (fmt == createPixelFormat<555>()) {
+		scaleBlitBilinearLogic<ColorMasks<555>,  uint16, false, false>(dst, src, dstPitch, srcPitch, dstW, dstH, srcW, srcH, fmt, sax, say);
+
+	} else if (fmt.bytesPerPixel == 4) {
+		scaleBlitBilinearLogic<ColorMasks<0>,    uint32, false, false>(dst, src, dstPitch, srcPitch, dstW, dstH, srcW, srcH, fmt, sax, say);
 	} else if (fmt.bytesPerPixel == 2) {
-		scaleBlitBilinearLogic<uint16, false, false>(dst, src, dstPitch, srcPitch, dstW, dstH, srcW, srcH, fmt, sax, say);
+		scaleBlitBilinearLogic<ColorMasks<0>,    uint16, false, false>(dst, src, dstPitch, srcPitch, dstW, dstH, srcW, srcH, fmt, sax, say);
 	} else {
 		delete[] sax;
 		delete[] say;
@@ -614,11 +623,11 @@ bool rotoscaleBlit(byte *dst, const byte *src,
 				   const TransformStruct &transform,
 				   const Common::Point &newHotspot) {
 	if (fmt.bytesPerPixel == 4) {
-		rotoscaleBlitLogic<uint32, false, false, false>(dst, src, dstPitch, srcPitch, dstW, dstH, srcW, srcH, fmt, transform, newHotspot);
+		rotoscaleBlitLogic<ColorMasks<0>, uint32, false, false, false>(dst, src, dstPitch, srcPitch, dstW, dstH, srcW, srcH, fmt, transform, newHotspot);
 	} else if (fmt.bytesPerPixel == 2) {
-		rotoscaleBlitLogic<uint16, false, false, false>(dst, src, dstPitch, srcPitch, dstW, dstH, srcW, srcH, fmt, transform, newHotspot);
+		rotoscaleBlitLogic<ColorMasks<0>, uint16, false, false, false>(dst, src, dstPitch, srcPitch, dstW, dstH, srcW, srcH, fmt, transform, newHotspot);
 	} else if (fmt.bytesPerPixel == 1) {
-		rotoscaleBlitLogic<uint8, false, false, false>(dst, src, dstPitch, srcPitch, dstW, dstH, srcW, srcH, fmt, transform, newHotspot);
+		rotoscaleBlitLogic<ColorMasks<0>, uint8, false, false, false>(dst, src, dstPitch, srcPitch, dstW, dstH, srcW, srcH, fmt, transform, newHotspot);
 	} else {
 		return false;
 	}
@@ -633,10 +642,19 @@ bool rotoscaleBlitBilinear(byte *dst, const byte *src,
 						   const Graphics::PixelFormat &fmt,
 						   const TransformStruct &transform,
 						   const Common::Point &newHotspot) {
-	if (fmt.bytesPerPixel == 4) {
-		rotoscaleBlitLogic<uint32, true, false, false>(dst, src, dstPitch, srcPitch, dstW, dstH, srcW, srcH, fmt, transform, newHotspot);
+	if (fmt == createPixelFormat<8888>()) {
+		rotoscaleBlitLogic<ColorMasks<8888>, uint32, true, false, false>(dst, src, dstPitch, srcPitch, dstW, dstH, srcW, srcH, fmt, transform, newHotspot);
+	} else if (fmt == createPixelFormat<888>()) {
+		rotoscaleBlitLogic<ColorMasks<888>,  uint32, true, false, false>(dst, src, dstPitch, srcPitch, dstW, dstH, srcW, srcH, fmt, transform, newHotspot);
+	} else if (fmt == createPixelFormat<565>()) {
+		rotoscaleBlitLogic<ColorMasks<565>,  uint16, true, false, false>(dst, src, dstPitch, srcPitch, dstW, dstH, srcW, srcH, fmt, transform, newHotspot);
+	} else if (fmt == createPixelFormat<555>()) {
+		rotoscaleBlitLogic<ColorMasks<555>,  uint16, true, false, false>(dst, src, dstPitch, srcPitch, dstW, dstH, srcW, srcH, fmt, transform, newHotspot);
+
+	} else if (fmt.bytesPerPixel == 4) {
+		rotoscaleBlitLogic<ColorMasks<0>,    uint32, true, false, false>(dst, src, dstPitch, srcPitch, dstW, dstH, srcW, srcH, fmt, transform, newHotspot);
 	} else if (fmt.bytesPerPixel == 2) {
-		rotoscaleBlitLogic<uint16, true, false, false>(dst, src, dstPitch, srcPitch, dstW, dstH, srcW, srcH, fmt, transform, newHotspot);
+		rotoscaleBlitLogic<ColorMasks<0>,    uint16, true, false, false>(dst, src, dstPitch, srcPitch, dstW, dstH, srcW, srcH, fmt, transform, newHotspot);
 	} else {
 		return false;
 	}




More information about the Scummvm-git-logs mailing list