Clean up number rounding. Now it is more obvious what code is doing. (#2862)

Add IM_ROUND() macro
Replace IM_FLOOR(n + 0.5f) and ImFloor(n + 0.5f) with IM_ROUND(n)
This commit is contained in:
Rokas Kupstys
2019-10-29 17:04:13 +01:00
committed by omar
parent 0b2d35f63f
commit c863c1f6a1
5 changed files with 24 additions and 23 deletions

View File

@ -545,7 +545,7 @@ bool ImFontAtlasBuildWithFreeType(FT_Library ft_library, ImFontAtlas* atlas, uns
const float descent = src_tmp.Font.Info.Descender;
ImFontAtlasBuildSetupFont(atlas, dst_font, &cfg, ascent, descent);
const float font_off_x = cfg.GlyphOffset.x;
const float font_off_y = cfg.GlyphOffset.y + IM_FLOOR(dst_font->Ascent + 0.5f);
const float font_off_y = cfg.GlyphOffset.y + IM_ROUND(dst_font->Ascent);
const int padding = atlas->TexGlyphPadding;
for (int glyph_i = 0; glyph_i < src_tmp.GlyphsCount; glyph_i++)