diff options
author | Campbell Barton <campbell@blender.org> | 2022-04-13 05:45:41 +0300 |
---|---|---|
committer | Campbell Barton <campbell@blender.org> | 2022-04-13 06:06:29 +0300 |
commit | 21ae323dbf28b4e0049e68153fe1a310ccf5ebef (patch) | |
tree | 184d0ff206289632094a71f574d6c8270c872a3c /source/blender/blenfont/BLF_api.h | |
parent | ae43872ad572eb3e6ad1ebfd02921fc2403059bc (diff) |
Cleanup: avoid redundant float/int conversions in BLF
Internally many offsets for BLF were integers but exposed as floats,
since these are used in pixel-space, many callers were converging them
back to integers. Simplify logic by using ints.
Diffstat (limited to 'source/blender/blenfont/BLF_api.h')
-rw-r--r-- | source/blender/blenfont/BLF_api.h | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/source/blender/blenfont/BLF_api.h b/source/blender/blenfont/BLF_api.h index 058b0f120f7..e5e2b1711b1 100644 --- a/source/blender/blenfont/BLF_api.h +++ b/source/blender/blenfont/BLF_api.h @@ -109,7 +109,7 @@ typedef bool (*BLF_GlyphBoundsFn)(const char *str, size_t str_step_ofs, const struct rcti *glyph_step_bounds, int glyph_advance_x, - const struct rctf *glyph_bounds, + const struct rcti *glyph_bounds, const int glyph_bearing[2], void *user_data); @@ -151,9 +151,9 @@ size_t BLF_width_to_rstrlen( void BLF_boundbox_ex(int fontid, const char *str, size_t str_len, - struct rctf *box, + struct rcti *box, struct ResultBLF *r_info) ATTR_NONNULL(2); -void BLF_boundbox(int fontid, const char *str, size_t str_len, struct rctf *box) ATTR_NONNULL(); +void BLF_boundbox(int fontid, const char *str, size_t str_len, struct rcti *box) ATTR_NONNULL(); /** * The next both function return the width and height @@ -173,9 +173,9 @@ float BLF_height(int fontid, const char *str, size_t str_len) ATTR_WARN_UNUSED_R * Return dimensions of the font without any sample text. */ int BLF_height_max(int fontid) ATTR_WARN_UNUSED_RESULT; -float BLF_width_max(int fontid) ATTR_WARN_UNUSED_RESULT; -float BLF_descender(int fontid) ATTR_WARN_UNUSED_RESULT; -float BLF_ascender(int fontid) ATTR_WARN_UNUSED_RESULT; +int BLF_width_max(int fontid) ATTR_WARN_UNUSED_RESULT; +int BLF_descender(int fontid) ATTR_WARN_UNUSED_RESULT; +int BLF_ascender(int fontid) ATTR_WARN_UNUSED_RESULT; /** * The following function return the width and height of the string, but @@ -195,7 +195,7 @@ float BLF_fixed_width(int fontid) ATTR_WARN_UNUSED_RESULT; * have to be enable/disable using BLF_enable/disable. */ void BLF_rotation(int fontid, float angle); -void BLF_clipping(int fontid, float xmin, float ymin, float xmax, float ymax); +void BLF_clipping(int fontid, int xmin, int ymin, int xmax, int ymax); void BLF_wordwrap(int fontid, int wrap_width); #if BLF_BLUR_ENABLE |