Revert "More accurate 8-bit <=> 5-bit RGB color conversion (#1827)"

This reverts commit 223b3d1921.
This commit is contained in:
Rangi42
2025-10-24 13:32:59 -04:00
parent 8bedd710d7
commit ca383c91ca
20 changed files with 15 additions and 31 deletions

View File

@@ -18,7 +18,10 @@ struct Rgba {
: red(rgba >> 24), green(rgba >> 16), blue(rgba >> 8), alpha(rgba) {}
static constexpr Rgba fromCGBColor(uint16_t color) {
constexpr auto _5to8 = [](uint8_t c) -> uint8_t { return ((c & 0b11111) * 255 + 15) / 31; };
constexpr auto _5to8 = [](uint8_t channel) -> uint8_t {
channel &= 0b11111; // For caller's convenience
return channel << 3 | channel >> 2;
};
return {
_5to8(color),
_5to8(color >> 5),