From 08ce19c93f69557d1cfe73d435860cb18c04a177 Mon Sep 17 00:00:00 2001 From: Luis Michaelis Date: Tue, 2 Apr 2024 16:51:09 +0200 Subject: [PATCH] fix(Texture): swap R and B component of RGB565 I have no idea why this wasn't an issue before. The problem is, that the saved data is little-endian. --- src/Texture.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Texture.cc b/src/Texture.cc index a5634188..cdb34db0 100644 --- a/src/Texture.cc +++ b/src/Texture.cc @@ -14,9 +14,9 @@ namespace zenkit { #pragma pack(push, 1) struct r5g6b5 { - std::uint16_t r : 5; - std::uint16_t g : 6; std::uint16_t b : 5; + std::uint16_t g : 6; + std::uint16_t r : 5; }; #pragma pack(pop) @@ -123,7 +123,7 @@ namespace zenkit { conv[i * 4 + 0] = bytes[i * 3 + 2]; conv[i * 4 + 1] = bytes[i * 3 + 1]; conv[i * 4 + 2] = bytes[i * 3 + 0]; - conv[i * 4 + 3] = 0; + conv[i * 4 + 3] = 0xff; } break; @@ -133,7 +133,7 @@ namespace zenkit { conv[i * 4 + 0] = bytes[i * 3 + 0]; conv[i * 4 + 1] = bytes[i * 3 + 1]; conv[i * 4 + 2] = bytes[i * 3 + 2]; - conv[i * 4 + 3] = 0; + conv[i * 4 + 3] = 0xff; } break;