diff options
| author | Jeff Epler <jepler@gmail.com> | 2020-04-14 17:34:53 -0500 |
|---|---|---|
| committer | Jeff Epler <jepler@gmail.com> | 2020-04-14 18:25:00 -0500 |
| commit | d8362ef654d86d29561db2cbcc2a20ab488316a8 (patch) | |
| tree | 5ff3e0bc789685ae94c67e2f13af6ede355e20f5 | |
| parent | 0ce9c008c5d54f59224bda91af36c9c86aa64c09 (diff) | |
displayio: swap colors in palettes too
.. change the in-rom palette to be in RGB565 order
| -rw-r--r-- | shared-module/displayio/Palette.c | 7 | ||||
| -rw-r--r-- | supervisor/shared/display.c | 10 |
2 files changed, 11 insertions, 6 deletions
diff --git a/shared-module/displayio/Palette.c b/shared-module/displayio/Palette.c index 3bce86f48..1ef03aab4 100644 --- a/shared-module/displayio/Palette.c +++ b/shared-module/displayio/Palette.c @@ -83,7 +83,12 @@ bool displayio_palette_get_color(displayio_palette_t *self, const _displayio_col } else if (colorspace->grayscale) { *color = self->colors[palette_index].luma >> (8 - colorspace->depth); } else { - *color = self->colors[palette_index].rgb565; + uint16_t packed = self->colors[palette_index].rgb565; + if (colorspace->reverse_bytes_in_word) { + // swap bytes + packed = __builtin_bswap16(packed); + } + *color = packed; } return true; diff --git a/supervisor/shared/display.c b/supervisor/shared/display.c index cdf710d26..95926bc9c 100644 --- a/supervisor/shared/display.c +++ b/supervisor/shared/display.c @@ -169,28 +169,28 @@ _displayio_color_t blinka_colors[7] = { }, { .rgb888 = 0x8428bc, - .rgb565 = 0x7889, + .rgb565 = 0x8978, .luma = 0xff, // We cheat the luma here. It is actually 0x60 .hue = 184, .chroma = 148 }, { .rgb888 = 0xff89bc, - .rgb565 = 0xB8FC, + .rgb565 = 0xFCB8, .luma = 0xb5, .hue = 222, .chroma = 118 }, { .rgb888 = 0x7beffe, - .rgb565 = 0x9F86, + .rgb565 = 0x869F, .luma = 0xe0, .hue = 124, .chroma = 131 }, { .rgb888 = 0x51395f, - .rgb565 = 0x0D5A, + .rgb565 = 0x5A0D, .luma = 0x47, .hue = 185, .chroma = 38 @@ -203,7 +203,7 @@ _displayio_color_t blinka_colors[7] = { }, { .rgb888 = 0x0736a0, - .rgb565 = 0xf501, + .rgb565 = 0x01f5, .luma = 0x44, .hue = 147, .chroma = 153 |
