summaryrefslogtreecommitdiff
path: root/shared-module/displayio/Palette.c
diff options
context:
space:
mode:
authorLucian Copeland <hierophect@gmail.com>2020-04-15 10:29:05 -0400
committerLucian Copeland <hierophect@gmail.com>2020-04-15 10:29:05 -0400
commit54abfc2e8b88ed0dd1caaf3ac926466b0aba717a (patch)
treeb5154c84f807ee6ce3b0716b3a8d7b64dca46061 /shared-module/displayio/Palette.c
parent0f87a75f4f0675ff55e31437907101226d5fb66b (diff)
parentae549fc9da555778884ff64a2ffe45df0a5248db (diff)
translations-merge
Diffstat (limited to 'shared-module/displayio/Palette.c')
-rw-r--r--shared-module/displayio/Palette.c7
1 files changed, 6 insertions, 1 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;