Skip to content

Commit

Permalink
fix(Texture): swap R and B component of RGB565
Browse files Browse the repository at this point in the history
I have no idea why this wasn't an issue before. The problem is, that the saved data is little-endian.
  • Loading branch information
lmichaelis committed Apr 2, 2024
1 parent b5a3482 commit 08ce19c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/Texture.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand Down

0 comments on commit 08ce19c

Please sign in to comment.