Merge branch 'master' into viewport

# Conflicts:
#	examples/imgui_impl_sdl.cpp
#	imgui.cpp
This commit is contained in:
omar
2018-10-12 15:50:48 +02:00
17 changed files with 184 additions and 117 deletions

View File

@ -2646,11 +2646,10 @@ void ImFont::RenderText(ImDrawList* draw_list, float size, ImVec2 pos, ImU32 col
// Fast-forward to first visible line
const char* s = text_begin;
if (y + line_height < clip_rect.y && !word_wrap_enabled)
while (y + line_height < clip_rect.y)
while (y + line_height < clip_rect.y && s < text_end)
{
while (s < text_end)
if (*s++ == '\n')
break;
s = (const char*)memchr(s, '\n', text_end - s);
s = s ? s + 1 : text_end;
y += line_height;
}
@ -2660,15 +2659,16 @@ void ImFont::RenderText(ImDrawList* draw_list, float size, ImVec2 pos, ImU32 col
{
const char* s_end = s;
float y_end = y;
while (y_end < clip_rect.w)
while (y_end < clip_rect.w && s_end < text_end)
{
while (s_end < text_end)
if (*s_end++ == '\n')
break;
s_end = (const char*)memchr(s_end, '\n', text_end - s_end);
s = s ? s + 1 : text_end;
y_end += line_height;
}
text_end = s_end;
}
if (s == text_end)
return;
// Reserve vertices for remaining worse case (over-reserving is useful and easily amortized)
const int vtx_count_max = (int)(text_end - s) * 4;