displayio: swap colors in palettes too

.. change the in-rom palette to be in RGB565 order
This commit is contained in:
Jeff Epler 2020-04-14 17:34:53 -05:00
parent 0ce9c008c5
commit d8362ef654
2 changed files with 11 additions and 6 deletions

View File

@ -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;

View File

@ -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