Skip to content

Commit

Permalink
(continuation)
Browse files Browse the repository at this point in the history
  • Loading branch information
William Bérubé committed Apr 22, 2024
1 parent 343ea6e commit 562a1e6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion osd/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,11 @@ extern "C"
#define PIXEL_FORMAT_8888 PIXEL_FORMAT_ARGB_8888
#endif

#ifndef CEILING
#define CEILING(x,y) (((x) + (y) - 1) / (y))
#endif
#ifndef DIV_UP
#define DIV_UP(x, a) (((x) + ((a)-1)) / a)
#define DIV_UP(x, a) (((x) + ((a) - 1)) / a)
#endif
#ifndef MIN
#define MIN(a, b) (((a) < (b)) ? (a) : (b))
Expand Down
2 changes: 1 addition & 1 deletion osd/text.c
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ RECT measure_text(const char *font, double size, const char *text)
calcdim(&margin, &height, &width, text);
// Some platforms operate with a coarse pixel size of 2x2
// and rounding up is required for a sufficient canvas size
RECT rect = { .height = ceil(height), .width = ceil(width) };
RECT rect = { .height = CEILING(height), .width = CEILING(width) };
rect.height += rect.height & 1;
rect.width += rect.width & 1;

Expand Down

0 comments on commit 562a1e6

Please sign in to comment.