Browse Source

ImFont::CalcWordWrapPositionA: minor optimization

pull/1282/head
omar 7 years ago
parent
commit
7b7845d764
  1. 3
      imgui_draw.cpp

3
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)

Loading…
Cancel
Save