Skip to content

Commit 2463a6d

Browse files
committed
Fix Palette grayscale for EInk.
It needs to do the bitmasking that was only added to ColorConverter in #3611
1 parent 8ac9b17 commit 2463a6d

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

shared-module/displayio/Palette.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,8 @@ bool displayio_palette_get_color(displayio_palette_t *self, const _displayio_col
8383
uint8_t pixel_hue = self->colors[palette_index].hue;
8484
displayio_colorconverter_compute_tricolor(colorspace, pixel_hue, luma, color);
8585
} else if (colorspace->grayscale) {
86-
*color = self->colors[palette_index].luma >> (8 - colorspace->depth);
86+
size_t bitmask = (1 << colorspace->depth) - 1;
87+
*color = (self->colors[palette_index].luma >> colorspace->grayscale_bit) & bitmask;
8788
} else {
8889
uint16_t packed = self->colors[palette_index].rgb565;
8990
if (colorspace->reverse_bytes_in_word) {

0 commit comments

Comments
 (0)