Skip to content

Commit

Permalink
Support double-buffered hires, enable by default on RP2350
Browse files Browse the repository at this point in the history
  • Loading branch information
Daft-Freak committed Aug 12, 2024
1 parent b4f4a78 commit eb20ed4
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
8 changes: 8 additions & 0 deletions 32blit-pico/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,14 @@
#define ALLOW_HIRES 1
#endif

#ifndef DOUBLE_BUFFERED_HIRES
#ifdef PICO_RP2350
#define DOUBLE_BUFFERED_HIRES 1
#else
#define DOUBLE_BUFFERED_HIRES 0
#endif
#endif

#ifndef BUTTON_LEFT_PIN
#define BUTTON_LEFT_PIN -1
#define BUTTON_LEFT_BI_DECL
Expand Down
12 changes: 9 additions & 3 deletions 32blit-pico/display.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,22 @@ using namespace blit;
// this is in bytes
static const int lores_page_size = (DISPLAY_WIDTH / 2) * ((DISPLAY_HEIGHT + 1) / 2) * 2;

#if ALLOW_HIRES && DOUBLE_BUFFERED_HIRES
static const int fb_size = DISPLAY_WIDTH * DISPLAY_HEIGHT * 2;
#elif ALLOW_HIRES
static const int fb_size = DISPLAY_WIDTH * DISPLAY_HEIGHT;
#else
static const int fb_size = lores_page_size; // double-buffered
#endif

SurfaceInfo cur_surf_info;

bool fb_double_buffer = true;

#if defined(BLIT_BOARD_PIMORONI_PICOVISION)
static const uint16_t *screen_fb = nullptr;
#elif ALLOW_HIRES
uint16_t screen_fb[DISPLAY_WIDTH * DISPLAY_HEIGHT];
#else
uint16_t screen_fb[lores_page_size]; // double-buffered
uint16_t screen_fb[fb_size];
#endif

static const Size lores_screen_size(DISPLAY_WIDTH / 2, DISPLAY_HEIGHT / 2);
Expand Down

0 comments on commit eb20ed4

Please sign in to comment.