Skip to content

Commit

Permalink
fix(Texture): fix updated conversion for RGB565 to RGBA8
Browse files Browse the repository at this point in the history
When writing the updated conversion code, I forgot that the source image has 16bbp, not 8. This patch fixes that.
  • Loading branch information
lmichaelis committed Apr 1, 2024
1 parent 118fe5f commit b5a3482
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Texture.cc
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ namespace zenkit {
}
case TextureFormat::R5G6B5: {
for (auto i = 0u; i < width * height; ++i) {
auto* rgb = reinterpret_cast<r5g6b5 const*>(&bytes[i]);
auto* rgb = reinterpret_cast<r5g6b5 const*>(&bytes[i * 2]);
conv[i * 4 + 0] = static_cast<uint8_t>(static_cast<float>(rgb->r) * 8.225806452f);
conv[i * 4 + 1] = static_cast<uint8_t>(static_cast<float>(rgb->g) * 4.047619048f);
conv[i * 4 + 2] = static_cast<uint8_t>(static_cast<float>(rgb->b) * 8.225806452f);
Expand Down

0 comments on commit b5a3482

Please sign in to comment.