Skip to content

Commit

Permalink
macfb: fix up 1-bit pixel encoding
Browse files Browse the repository at this point in the history
The MacOS driver expects the RGB values for the pixel to be in entries 0 and 1
of the colour palette.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Message-Id: <20211007221253.29024-11-mark.cave-ayland@ilande.co.uk>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
  • Loading branch information
mcayland authored and vivier committed Oct 8, 2021
1 parent df8abbb commit 57eeaf4
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion hw/display/macfb.c
Expand Up @@ -128,7 +128,9 @@ static void macfb_draw_line1(MacfbState *s, uint8_t *d, uint32_t addr,
for (x = 0; x < width; x++) {
int bit = x & 7;
int idx = (macfb_read_byte(s, addr) >> (7 - bit)) & 1;
r = g = b = ((1 - idx) << 7);
r = s->color_palette[idx * 3];
g = s->color_palette[idx * 3 + 1];
b = s->color_palette[idx * 3 + 2];
addr += (bit == 7);

*(uint32_t *)d = rgb_to_pixel32(r, g, b);
Expand Down

0 comments on commit 57eeaf4

Please sign in to comment.