Skip to content

Commit

Permalink
Provide double width 4bpp output to lcd_draw_line
Browse files Browse the repository at this point in the history
  • Loading branch information
ccawley2011 committed May 30, 2024
1 parent e7e73ef commit df4c609
Show file tree
Hide file tree
Showing 5 changed files with 136 additions and 135 deletions.
6 changes: 1 addition & 5 deletions examples/benchmark/peanut-benchmark.c
Original file line number Diff line number Diff line change
Expand Up @@ -127,11 +127,7 @@ static void lcd_draw_line(struct gb_s *gb, const uint8_t pixels[160],

for (unsigned int x = 0; x < LCD_WIDTH; x++)
{
#if PEANUT_GB_16BIT_COLOUR
priv->fb[line][x] = palette[pixels[x] & 3];
#else
priv->fb[line][x] = palette[pixels[x]];
#endif
priv->fb[line][x] = palette[pixels[x] & LCD_COLOUR];
}
}
#endif
Expand Down
12 changes: 5 additions & 7 deletions examples/debug/peanut-debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@

#include "../../peanut_gb.h"

const uint16_t lcd_palette[3][4] =
const uint16_t lcd_palette[4 * 4] =
{
{ 0x7FFF, 0x5294, 0x294A, 0x0000 },
{ 0x7FFF, 0x5294, 0x294A, 0x0000 },
{ 0x7FFF, 0x5294, 0x294A, 0x0000 }
0x7FFF, 0x5294, 0x294A, 0x0000,
0x7FFF, 0x5294, 0x294A, 0x0000,
0x7FFF, 0x5294, 0x294A, 0x0000
};

struct priv_t
Expand Down Expand Up @@ -180,9 +180,7 @@ void lcd_draw_line(struct gb_s *gb, const uint8_t pixels[160],

for(unsigned int x = 0; x < LCD_WIDTH; x++)
{
priv->fb[line][x] = lcd_palette
[(pixels[x] & LCD_PALETTE_ALL) >> 4]
[pixels[x] & 3];
priv->fb[line][x] = lcd_palette[pixels[x] & (LCD_COLOUR | LCD_PALETTE_ALL)];
}
}
#endif
Expand Down
2 changes: 1 addition & 1 deletion examples/mini_fb/peanut_minifb.c
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ void lcd_draw_line(struct gb_s *gb, const uint8_t pixels[160],
const uint32_t palette[] = { 0xFFFFFF, 0xA5A5A5, 0x525252, 0x000000 };

for(unsigned int x = 0; x < LCD_WIDTH; x++)
priv->fb[line][x] = palette[pixels[x] & 3];
priv->fb[line][x] = palette[pixels[x] & LCD_COLOUR];
}
#endif

Expand Down
Loading

0 comments on commit df4c609

Please sign in to comment.