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/editors/interface/interface_handlers.c | |
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/editors/interface/interface_handlers.c')
-rw-r--r-- | source/blender/editors/interface/interface_handlers.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index 8935df7b581..2c408619fe7 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -3018,12 +3018,12 @@ static bool ui_textedit_set_cursor_pos_foreach_glyph(const char *UNUSED(str), const size_t str_step_ofs, const rcti *glyph_step_bounds, const int UNUSED(glyph_advance_x), - const rctf *glyph_bounds, + const rcti *glyph_bounds, const int UNUSED(glyph_bearing[2]), void *user_data) { int *cursor_data = user_data; - const float center = glyph_step_bounds->xmin + (BLI_rctf_size_x(glyph_bounds) / 2.0f); + const int center = glyph_step_bounds->xmin + (BLI_rcti_size_x(glyph_bounds) / 2.0f); if (cursor_data[0] < center) { cursor_data[1] = str_step_ofs; return false; |