[Scummvm-git-logs] scummvm master -> 6ae4512a42f865385b790fe803353f578423a8e6

rsn8887 noreply at scummvm.org
Sat Nov 5 19:00:47 UTC 2022


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:
6ae4512a42 BACKENDS: PSP: Support RGBA8888 by swapping bytes


Commit: 6ae4512a42f865385b790fe803353f578423a8e6
    https://github.com/scummvm/scummvm/commit/6ae4512a42f865385b790fe803353f578423a8e6
Author: rsn8887 (rsn8887 at users.noreply.github.com)
Date: 2022-11-05T14:00:32-05:00

Commit Message:
BACKENDS: PSP: Support RGBA8888 by swapping bytes

Changed paths:
    backends/platform/psp/display_client.cpp
    backends/platform/psp/psppixelformat.cpp
    backends/platform/psp/psppixelformat.h


diff --git a/backends/platform/psp/display_client.cpp b/backends/platform/psp/display_client.cpp
index 137d8dbfbef..c9bf0a87d21 100644
--- a/backends/platform/psp/display_client.cpp
+++ b/backends/platform/psp/display_client.cpp
@@ -639,6 +639,7 @@ inline uint32 GuRenderer::convertToGuPixelFormat(PSPPixelFormat::Type format) {
 		guFormat = GU_PSM_5650;
 		break;
 	case PSPPixelFormat::Type_8888:
+	case PSPPixelFormat::Type_8888_RGBA:
 		guFormat = GU_PSM_8888;
 		break;
 	case PSPPixelFormat::Type_Palette_8bit:
diff --git a/backends/platform/psp/psppixelformat.cpp b/backends/platform/psp/psppixelformat.cpp
index 531d0fb7f4a..ef56e456212 100644
--- a/backends/platform/psp/psppixelformat.cpp
+++ b/backends/platform/psp/psppixelformat.cpp
@@ -43,6 +43,9 @@ void PSPPixelFormat::set(Type type, bool swap /* = false */) {
 		bitsPerPixel = 16;
 		break;
 	case Type_8888:
+	case Type_8888_RGBA:
+		bitsPerPixel = 32;
+		break;
 		bitsPerPixel = 32;
 		break;
 	case Type_Palette_8bit:
@@ -98,6 +101,8 @@ void PSPPixelFormat::convertFromScummvmPixelFormat(const Graphics::PixelFormat *
 			*target = Type_4444;
 		} else if (pf->gLoss == 0 && pf->gShift == 8) {
 			*target = Type_8888;
+		} else if (pf->gLoss == 0 && pf->gShift == 16) {
+			*target = Type_8888_RGBA;
 		} else if ((pf->gLoss == 0 && pf->gShift == 0) ||
 		           (pf->gLoss == 8 && pf->gShift == 0)) {	// Default CLUT8 can have weird values
 			*target = Type_5551;
@@ -154,6 +159,7 @@ Graphics::PixelFormat PSPPixelFormat::convertToScummvmPixelFormat(PSPPixelFormat
 		pf.bShift = 11;
 		break;
 	case Type_8888:
+	case Type_8888_RGBA:
 		pf.bytesPerPixel = 4;
 		pf.aLoss = 0;
 		pf.rLoss = 0;
diff --git a/backends/platform/psp/psppixelformat.h b/backends/platform/psp/psppixelformat.h
index cd9a6384148..83cd8f681c2 100644
--- a/backends/platform/psp/psppixelformat.h
+++ b/backends/platform/psp/psppixelformat.h
@@ -38,6 +38,7 @@ struct PSPPixelFormat {
 		Type_5551,
 		Type_5650,
 		Type_8888,
+		Type_8888_RGBA,
 		Type_Palette_8bit,
 		Type_Palette_4bit,
 		Type_Unknown
@@ -70,6 +71,7 @@ struct PSPPixelFormat {
 			color = (((b >> 3) << 11) | ((g >> 2) << 5) | ((r >> 3) << 0));
 			break;
 		case Type_8888:
+		case Type_8888_RGBA:
 			color = (((b >> 0) << 16) | ((g >> 0) << 8) | ((r >> 0) << 0) | ((a >> 0) << 24));
 			break;
 		default:
@@ -110,6 +112,7 @@ struct PSPPixelFormat {
 			r = r << 3 | r >> 2;
 			break;
 		case Type_8888:
+		case Type_8888_RGBA:
 			a = (color >> 24) & 0xFF;
 			b = (color >> 16) & 0xFF;
 			g = (color >> 8)  & 0xFF;
@@ -130,6 +133,7 @@ struct PSPPixelFormat {
 			color = (color & 0x7FFF) | (((uint32)alpha >> 7) << 15);
 			break;
 		case Type_8888:
+		case Type_8888_RGBA:
 			color = (color & 0x00FFFFFF) | ((uint32)alpha << 24);
 			break;
 		case Type_5650:
@@ -200,6 +204,10 @@ struct PSPPixelFormat {
 			output = (color & 0xff00ff00) |
 			         ((color & 0x000000ff) << 16) | ((color & 0x00ff0000) >> 16);
 			break;
+		case Type_8888_RGBA:
+			output = ((color & 0x000000ff) << 24) | ((color & 0x0000ff00) << 8) |
+			         ((color & 0x00ff0000) >> 8) | ((color & 0xff000000) >> 24);
+			break;
 		default:
 			PSP_ERROR("invalid format[%u] for swapping\n", format);
 			output = 0;




More information about the Scummvm-git-logs mailing list