Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide double width 4bpp output to lcd_draw_line #107

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
13 changes: 6 additions & 7 deletions examples/debug/peanut-debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,17 @@

#include "SDL.h"

#define PEANUT_GB_USE_NIBBLE_FOR_PALETTE 1
#define ENABLE_LCD 1
#define ENABLE_SOUND 0

#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 }
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the purpose of changing [3][4] to [3*4]?

0x7FFF, 0x5294, 0x294A, 0x0000,
0x7FFF, 0x5294, 0x294A, 0x0000,
0x7FFF, 0x5294, 0x294A, 0x0000
};

struct priv_t
Expand Down Expand Up @@ -180,9 +181,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
Loading