Make palette color ordering consistent with ColorConvertes and fix blinka.

This commit is contained in:
Scott Shawcroft 2019-01-23 14:44:46 -08:00
parent 3139d0dc20
commit b2f2abcb22
No known key found for this signature in database
GPG Key ID: FD0EDC4B6C53CA59
2 changed files with 4 additions and 4 deletions

View File

@ -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) { 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 shift = (palette_index % 2) * 16;
uint32_t masked = self->colors[palette_index / 2] & ~(0xffff << shift); 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 g6 = (color >> 10) & 0x3f;
uint32_t r5 = (color >> 3) & 0x1f; uint32_t b5 = (color >> 3) & 0x1f;
uint32_t packed = r5 << 11 | g6 << 5 | b5; uint32_t packed = r5 << 11 | g6 << 5 | b5;
// swap bytes // swap bytes
packed = __builtin_bswap16(packed); packed = __builtin_bswap16(packed);

View File

@ -99,8 +99,8 @@ displayio_bitmap_t blinka_bitmap = {
uint32_t blinka_transparency[1] = {0x80000000}; uint32_t blinka_transparency[1] = {0x80000000};
// TODO(tannewt): Fix these colors // These colors are RGB 565 with the bytes swapped.
uint32_t blinka_colors[8] = {0x91780000, 0x879FFC98, 0xffff0000, 0x0000f501, uint32_t blinka_colors[8] = {0x78890000, 0x9F86B8FC, 0xffff0D5A, 0x0000f501,
0x00000000, 0x00000000, 0x00000000, 0x00000000}; 0x00000000, 0x00000000, 0x00000000, 0x00000000};
displayio_palette_t blinka_palette = { displayio_palette_t blinka_palette = {