From b2f2abcb228be2bb4601a1373a307d98483ec274 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Wed, 23 Jan 2019 14:44:46 -0800 Subject: [PATCH] Make palette color ordering consistent with ColorConvertes and fix blinka. --- shared-module/displayio/Palette.c | 4 ++-- shared-module/displayio/__init__.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/shared-module/displayio/Palette.c b/shared-module/displayio/Palette.c index 5f410d7869..e810be8752 100644 --- a/shared-module/displayio/Palette.c +++ b/shared-module/displayio/Palette.c @@ -47,9 +47,9 @@ void common_hal_displayio_palette_make_transparent(displayio_palette_t* self, ui void common_hal_displayio_palette_set_color(displayio_palette_t* self, uint32_t palette_index, uint32_t color) { uint32_t shift = (palette_index % 2) * 16; uint32_t masked = self->colors[palette_index / 2] & ~(0xffff << shift); - uint32_t b5 = (color >> 19); + uint32_t r5 = (color >> 19); uint32_t g6 = (color >> 10) & 0x3f; - uint32_t r5 = (color >> 3) & 0x1f; + uint32_t b5 = (color >> 3) & 0x1f; uint32_t packed = r5 << 11 | g6 << 5 | b5; // swap bytes packed = __builtin_bswap16(packed); diff --git a/shared-module/displayio/__init__.c b/shared-module/displayio/__init__.c index 59a5cf398e..c86e48a125 100644 --- a/shared-module/displayio/__init__.c +++ b/shared-module/displayio/__init__.c @@ -99,8 +99,8 @@ displayio_bitmap_t blinka_bitmap = { uint32_t blinka_transparency[1] = {0x80000000}; -// TODO(tannewt): Fix these colors -uint32_t blinka_colors[8] = {0x91780000, 0x879FFC98, 0xffff0000, 0x0000f501, +// These colors are RGB 565 with the bytes swapped. +uint32_t blinka_colors[8] = {0x78890000, 0x9F86B8FC, 0xffff0D5A, 0x0000f501, 0x00000000, 0x00000000, 0x00000000, 0x00000000}; displayio_palette_t blinka_palette = {