Skip to content

Commit

Permalink
The FBInkConfig pointer is usually one of the last arguments (before
Browse files Browse the repository at this point in the history
other pointers).

Tweak the new signatures to keep honoring that.

It doesn't necessarily make much sense (hi #43!), but, eh.
  • Loading branch information
NiLuJe committed Feb 23, 2020
1 parent 8701673 commit db6cb9d
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 13 deletions.
16 changes: 8 additions & 8 deletions fbink.c
Original file line number Diff line number Diff line change
Expand Up @@ -3602,10 +3602,10 @@ int
// Handle cls & refresh, but for grid-based coordinates (i.e., like draw())
static int
grid_to_region(int fbfd,
const FBInkConfig* restrict fbink_cfg,
unsigned short int rows,
unsigned short int cols,
bool do_clear)
bool do_clear,
const FBInkConfig* restrict fbink_cfg)
{
// If we open a fd now, we'll only keep it open for this single call!
// NOTE: We *expect* to be initialized at this point, though, but that's on the caller's hands!
Expand All @@ -3625,8 +3625,8 @@ static int
}
}

// NOTE: Since the idea is to play nice with draw(),
// that implies duplicating its whole set of insane positioning tweaks...
// NOTE: Since the idea is to play nice with fbink_print()/draw(),
// that implies duplicating their whole set of insane positioning tweaks...

// NOTE: Starting with the initial row/col handling from fbink_print...
// NOTE: Make copies of these so we don't wreck our original struct, since we passed it by reference,
Expand Down Expand Up @@ -3915,15 +3915,15 @@ static int

// Public wrappers around grid_to_region
int
fbink_grid_clear(int fbfd, const FBInkConfig* restrict fbink_cfg, unsigned short int rows, unsigned short int cols)
fbink_grid_clear(int fbfd, unsigned short int rows, unsigned short int cols, const FBInkConfig* restrict fbink_cfg)
{
return grid_to_region(fbfd, fbink_cfg, rows, cols, true);
return grid_to_region(fbfd, rows, cols, true, fbink_cfg);
}

int
fbink_grid_refresh(int fbfd, const FBInkConfig* restrict fbink_cfg, unsigned short int rows, unsigned short int cols)
fbink_grid_refresh(int fbfd, unsigned short int rows, unsigned short int cols, const FBInkConfig* restrict fbink_cfg)
{
return grid_to_region(fbfd, fbink_cfg, rows, cols, false);
return grid_to_region(fbfd, rows, cols, false, fbink_cfg);
}

// Utility function to handle get_last_rect tracking
Expand Down
8 changes: 4 additions & 4 deletions fbink.h
Original file line number Diff line number Diff line change
Expand Up @@ -754,13 +754,13 @@ FBINK_API int fbink_cls(int fbfd, const FBInkConfig* restrict fbink_cfg, const F

// Same idea, but honoring col/row/hoffset/voffset like fbink_print
FBINK_API int fbink_grid_clear(int fbfd,
const FBInkConfig* restrict fbink_cfg,
unsigned short int rows,
unsigned short int cols);
unsigned short int cols,
const FBInkConfig* restrict fbink_cfg);
FBINK_API int fbink_grid_refresh(int fbfd,
const FBInkConfig* restrict fbink_cfg,
unsigned short int rows,
unsigned short int cols);
unsigned short int cols,
const FBInkConfig* restrict fbink_cfg);

//
// Dump the full screen.
Expand Down
2 changes: 1 addition & 1 deletion fbink_cmd.c
Original file line number Diff line number Diff line change
Expand Up @@ -2194,7 +2194,7 @@ int
const struct timespec zzz = { 0L, 750000000L };
nanosleep(&zzz, NULL);
fbink_set_bg_pen_gray(0x88u, false);
fbink_grid_clear(fbfd, &fbink_cfg, linecount, strlen(string));
fbink_grid_clear(fbfd, linecount + 2, strlen(string), &fbink_cfg);

// NOTE: Don't clobber previous entries if multiple strings were passed...
// We make sure to trust print's return value,
Expand Down
2 changes: 2 additions & 0 deletions fbink_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -569,6 +569,8 @@ static void rotate_region_boot(struct mxcfb_rect* restrict);
static void rotate_region_nop(struct mxcfb_rect* restrict);
static void fullscreen_region(struct mxcfb_rect* restrict);

static int grid_to_region(int, unsigned short int, unsigned short int, bool, const FBInkConfig* restrict);

static void set_last_rect(const struct mxcfb_rect* restrict);

int draw_progress_bars(int, bool, uint8_t, const FBInkConfig* restrict);
Expand Down

0 comments on commit db6cb9d

Please sign in to comment.