mirror of
https://github.com/ocornut/imgui.git
synced 2024-11-24 07:40:22 +01:00
ImFont::CalcWordWrapPositionA: minor optimization
This commit is contained in:
parent
a6d69f04c0
commit
7b7845d764
@ -1878,6 +1878,7 @@ const char* ImFont::CalcWordWrapPositionA(float scale, const char* text, const c
|
|||||||
float line_width = 0.0f;
|
float line_width = 0.0f;
|
||||||
float word_width = 0.0f;
|
float word_width = 0.0f;
|
||||||
float blank_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* word_end = text;
|
||||||
const char* prev_word_end = NULL;
|
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 (ImCharIsSpace(c))
|
||||||
{
|
{
|
||||||
if (inside_word)
|
if (inside_word)
|
||||||
|
Loading…
Reference in New Issue
Block a user