Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <campbell@blender.org>2022-04-13 05:45:41 +0300
committerCampbell Barton <campbell@blender.org>2022-04-13 06:06:29 +0300
commit21ae323dbf28b4e0049e68153fe1a310ccf5ebef (patch)
tree184d0ff206289632094a71f574d6c8270c872a3c /source/blender/editors/interface/interface_style.cc
parentae43872ad572eb3e6ad1ebfd02921fc2403059bc (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_style.cc')
-rw-r--r--source/blender/editors/interface/interface_style.cc8
1 files changed, 4 insertions, 4 deletions
diff --git a/source/blender/editors/interface/interface_style.cc b/source/blender/editors/interface/interface_style.cc
index b4e97f8a396..0156a943015 100644
--- a/source/blender/editors/interface/interface_style.cc
+++ b/source/blender/editors/interface/interface_style.cc
@@ -161,7 +161,7 @@ void UI_fontstyle_draw_ex(const uiFontStyle *fs,
}
else {
/* Draw from bound-box center. */
- const float height = BLF_ascender(fs->uifont_id) + BLF_descender(fs->uifont_id);
+ const int height = BLF_ascender(fs->uifont_id) + BLF_descender(fs->uifont_id);
yofs = ceil(0.5f * (BLI_rcti_size_y(rect) - height));
}
@@ -279,9 +279,9 @@ void UI_fontstyle_draw_simple_backdrop(const uiFontStyle *fs,
UI_fontstyle_set(fs);
{
- const float width = BLF_width(fs->uifont_id, str, BLF_DRAW_STR_DUMMY_MAX);
- const float height = BLF_height_max(fs->uifont_id);
- const float decent = BLF_descender(fs->uifont_id);
+ const int width = BLF_width(fs->uifont_id, str, BLF_DRAW_STR_DUMMY_MAX);
+ const int height = BLF_height_max(fs->uifont_id);
+ const int decent = BLF_descender(fs->uifont_id);
const float margin = height / 4.0f;
rctf rect;