From 30b8b29da44cf75d60f7b94998d6a171255a2c1d Mon Sep 17 00:00:00 2001 From: Luis Michaelis Date: Mon, 19 Aug 2024 16:19:44 +0200 Subject: [PATCH] :( --- src/Texture.cc | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/src/Texture.cc b/src/Texture.cc index 897d7599..1a57e2bc 100644 --- a/src/Texture.cc +++ b/src/Texture.cc @@ -165,22 +165,10 @@ namespace zenkit { } case TextureFormat::A4R4G4B4: { for (auto i = 0u; i < width * height; ++i) { - auto* argb = reinterpret_cast(&bytes[i * 2]); - conv[i * 4 + 0] = argb->r * 17; - conv[i * 4 + 1] = argb->g * 17; - conv[i * 4 + 2] = argb->b * 17; - conv[i * 4 + 3] = argb->a * 17; - } - - break; - } - case TextureFormat::A1R5G5B5: { - for (auto i = 0u; i < width * height; ++i) { - auto* argb = reinterpret_cast(&bytes[i * 2]); - conv[i * 4 + 0] = static_cast(static_cast(argb->r) * 8.225806452f); - conv[i * 4 + 1] = static_cast(static_cast(argb->g) * 8.225806452f); - conv[i * 4 + 2] = static_cast(static_cast(argb->b) * 8.225806452f); - conv[i * 4 + 3] = argb->a * 255; + conv[i * 4 + 2] = ((bytes[i * 2 + 0] >> 0) & 0x0F) * 17; + conv[i * 4 + 1] = ((bytes[i * 2 + 0] >> 4) & 0x0F) * 17; + conv[i * 4 + 0] = ((bytes[i * 2 + 1] >> 0) & 0x0F) * 17; + conv[i * 4 + 3] = ((bytes[i * 2 + 1] >> 4) & 0x0F) * 17; } break;