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/blenfont/intern/blf_thumbs.c
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/blenfont/intern/blf_thumbs.c')
-rw-r--r--source/blender/blenfont/intern/blf_thumbs.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/source/blender/blenfont/intern/blf_thumbs.c b/source/blender/blenfont/intern/blf_thumbs.c
index 0e265fb7553..a75072f854f 100644
--- a/source/blender/blenfont/intern/blf_thumbs.c
+++ b/source/blender/blenfont/intern/blf_thumbs.c
@@ -64,7 +64,7 @@ void BLF_thumb_preview(const char *filepath,
/* Always create the image with a white font,
* the caller can theme how it likes */
memcpy(font->buf_info.col_init, font_color, sizeof(font->buf_info.col_init));
- font->pos[1] = (float)h;
+ font->pos[1] = h;
font_size_curr = font_size;
@@ -84,7 +84,7 @@ void BLF_thumb_preview(const char *filepath,
font_size_curr -= (font_size_curr / font_shrink);
font_shrink += 1;
- font->pos[1] -= blf_font_ascender(font) * 1.1f;
+ font->pos[1] -= (int)((float)blf_font_ascender(font) * 1.1f);
/* We fallback to default english strings in case not enough chars are available in current
* font for given translated string (useful in non-latin i18n context, like Chinese,