summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott Shawcroft <scott@tannewt.org>2019-01-23 14:44:46 -0800
committerScott Shawcroft <scott@tannewt.org>2019-01-23 14:44:46 -0800
commitb2f2abcb228be2bb4601a1373a307d98483ec274 (patch)
tree8efaddb56d5ff95c4cca0e9e9b1692d2683b1cfa
parent3139d0dc20cf55565ea6654e8e9ef4a78363ff21 (diff)
Make palette color ordering consistent with ColorConvertes and fix blinka.
-rw-r--r--shared-module/displayio/Palette.c4
-rw-r--r--shared-module/displayio/__init__.c4
2 files changed, 4 insertions, 4 deletions
diff --git a/shared-module/displayio/Palette.c b/shared-module/displayio/Palette.c
index 5f410d786..e810be875 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 59a5cf398..c86e48a12 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 = {