Skip to content

Commit

Permalink
Fix MINIMAL build warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
NiLuJe committed May 4, 2024
1 parent 01539d6 commit 45ca424
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 9 deletions.
28 changes: 22 additions & 6 deletions fbink.c
Original file line number Diff line number Diff line change
Expand Up @@ -1210,34 +1210,48 @@ static void

// Public convenience wrapper around put/get pixels.
// Performance is *not* a priority for these, avoid them if at all possible!
void
fbink_put_pixel_gray(uint16_t x, uint16_t y, uint8_t v)
int
fbink_put_pixel_gray(uint16_t x UNUSED_BY_NODRAW, uint16_t y UNUSED_BY_NODRAW, uint8_t v UNUSED_BY_NODRAW)
{
#ifdef FBINK_WITH_DRAW
const FBInkCoordinates coords = { .x = x, .y = y };
FBInkPixel px = pack_pixel_from_y8(v);
put_pixel(coords, &px, true);

return EXIT_SUCCESS;
#else
WARN("Drawing primitives are disabled in this FBInk build");
return ERRCODE(ENOSYS);
#endif
}

void
fbink_put_pixel_rgba(uint16_t x, uint16_t y, uint8_t r, uint8_t g, uint8_t b, uint8_t a)
int
fbink_put_pixel_rgba(uint16_t x UNUSED_BY_NODRAW,
uint16_t y UNUSED_BY_NODRAW,
uint8_t r UNUSED_BY_NODRAW,
uint8_t g UNUSED_BY_NODRAW,
uint8_t b UNUSED_BY_NODRAW,
uint8_t a UNUSED_BY_NODRAW)
{
#ifdef FBINK_WITH_DRAW
const FBInkCoordinates coords = { .x = x, .y = y };
FBInkPixel px = pack_pixel_from_rgba(r, g, b, a);
put_pixel(coords, &px, true);

return EXIT_SUCCESS;
#else
WARN("Drawing primitives are disabled in this FBInk build");
return ERRCODE(ENOSYS);
#endif
}

void
fbink_get_pixel(uint16_t x, uint16_t y, uint8_t* r, uint8_t* g, uint8_t* b, uint8_t* a)
int
fbink_get_pixel(uint16_t x UNUSED_BY_NODRAW,
uint16_t y UNUSED_BY_NODRAW,
uint8_t* r UNUSED_BY_NODRAW,
uint8_t* g UNUSED_BY_NODRAW,
uint8_t* b UNUSED_BY_NODRAW,
uint8_t* a UNUSED_BY_NODRAW)
{
#ifdef FBINK_WITH_DRAW
const FBInkCoordinates coords = { .x = x, .y = y };
Expand Down Expand Up @@ -1269,6 +1283,8 @@ void
*a = 0xFFu;
}
}

return EXIT_SUCCESS;
#else
WARN("Drawing primitives are disabled in this FBInk build");
return ERRCODE(ENOSYS);
Expand Down
6 changes: 3 additions & 3 deletions fbink.h
Original file line number Diff line number Diff line change
Expand Up @@ -1512,20 +1512,20 @@ FBINK_API int fbink_fill_rect_rgba(int fbfd,
// x: x coordinates
// y: y coordinates
// v: 8-bit luminance value
FBINK_API void fbink_put_pixel_gray(uint16_t x, uint16_t y, uint8_t v);
FBINK_API int fbink_put_pixel_gray(uint16_t x, uint16_t y, uint8_t v);
// r: 8-bit red component value
// g: 8-bit green component value
// b: 8-bit blue component value
// a: 8-bit alpha component value (opaque is 0xFFu).
FBINK_API void fbink_put_pixel_rgba(uint16_t x, uint16_t y, uint8_t r, uint8_t g, uint8_t b, uint8_t a);
FBINK_API int fbink_put_pixel_rgba(uint16_t x, uint16_t y, uint8_t r, uint8_t g, uint8_t b, uint8_t a);
// *r: out pointer, 8-bit red component value
// *g: out pointer, 8-bit green component value
// *b: out pointer, 8-bit blue component value
// *a: out pointer, 8-bit alpha component value (opaque is 0xFFu).
// NOTE: If pixelformat is grayscale, r = g = b and a = 0xFF
// NOTE: Red always means red, if there's a BGR swap involved, it's handled for you.
// Similarly, BGR565/RBG565 is unpacked to RGB32.
FBINK_API void fbink_get_pixel(uint16_t x, uint16_t y, uint8_t* r, uint8_t* g, uint8_t* b, uint8_t* a);
FBINK_API int fbink_get_pixel(uint16_t x, uint16_t y, uint8_t* r, uint8_t* g, uint8_t* b, uint8_t* a);

// Forcefully wakeup the EPDC (Kobo Mk.8+ only)
// We've found this to be helpful on a few otherwise crashy devices,
Expand Down

0 comments on commit 45ca424

Please sign in to comment.