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/blenkernel/intern/image.cc | |
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/blenkernel/intern/image.cc')
-rw-r--r-- | source/blender/blenkernel/intern/image.cc | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/source/blender/blenkernel/intern/image.cc b/source/blender/blenkernel/intern/image.cc index 6100923778d..482537d7fa9 100644 --- a/source/blender/blenkernel/intern/image.cc +++ b/source/blender/blenkernel/intern/image.cc @@ -1806,9 +1806,9 @@ void BKE_image_stamp_buf(Scene *scene, int channels) { struct StampData stamp_data; - float w, h, pad; + int w, h, pad; int x, y, y_ofs; - float h_fixed; + int h_fixed; const int mono = blf_mono_font_render; /* XXX */ struct ColorManagedDisplay *display; const char *display_device; @@ -1816,20 +1816,20 @@ void BKE_image_stamp_buf(Scene *scene, /* vars for calculating wordwrap */ struct { struct ResultBLF info; - rctf rect; + rcti rect; } wrap; /* this could be an argument if we want to operate on non linear float imbuf's * for now though this is only used for renders which use scene settings */ #define TEXT_SIZE_CHECK(str, w, h) \ - ((str[0]) && ((void)(h = h_fixed), (w = BLF_width(mono, str, sizeof(str))))) + ((str[0]) && ((void)(h = h_fixed), (w = (int)BLF_width(mono, str, sizeof(str))))) /* must enable BLF_WORD_WRAP before using */ #define TEXT_SIZE_CHECK_WORD_WRAP(str, w, h) \ ((str[0]) && (BLF_boundbox_ex(mono, str, sizeof(str), &wrap.rect, &wrap.info), \ (void)(h = h_fixed * wrap.info.lines), \ - (w = BLI_rctf_size_x(&wrap.rect)))) + (w = BLI_rcti_size_x(&wrap.rect)))) #define BUFF_MARGIN_X 2 #define BUFF_MARGIN_Y 1 |