From 7b7845d76472c61f62a4975bcf35eb7efc905c15 Mon Sep 17 00:00:00 2001 From: omar Date: Mon, 14 Aug 2017 21:00:44 +0800 Subject: [PATCH] ImFont::CalcWordWrapPositionA: minor optimization --- imgui_draw.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/imgui_draw.cpp b/imgui_draw.cpp index 9a79ffbf..3eb8eea6 100644 --- a/imgui_draw.cpp +++ b/imgui_draw.cpp @@ -1878,6 +1878,7 @@ const char* ImFont::CalcWordWrapPositionA(float scale, const char* text, const c float line_width = 0.0f; float word_width = 0.0f; float blank_width = 0.0f; + wrap_width /= scale; // We work with unscaled widths to avoid scaling every characters const char* word_end = text; const char* prev_word_end = NULL; @@ -1911,7 +1912,7 @@ const char* ImFont::CalcWordWrapPositionA(float scale, const char* text, const c } } - const float char_width = ((int)c < IndexXAdvance.Size ? IndexXAdvance[(int)c] : FallbackXAdvance) * scale; + const float char_width = ((int)c < IndexXAdvance.Size ? IndexXAdvance[(int)c] : FallbackXAdvance); if (ImCharIsSpace(c)) { if (inside_word)