RenderCheckMark() tidying up

This commit is contained in:
omar 2017-08-09 22:56:01 +08:00
parent 4fd148f4f9
commit fc5ab0cb8d

View File

@ -3102,20 +3102,13 @@ void ImGui::RenderCheckMark(ImVec2 pos, ImU32 col)
{
ImGuiContext& g = *GImGui;
ImGuiWindow* window = GetCurrentWindow();
ImVec2 a, b, c;
float start_x = (float)(int)(g.FontSize * 0.307f + 0.5f);
float rem_third = (float)(int)((g.FontSize - start_x) / 3.0f);
a.x = pos.x + 0.5f + start_x;
b.x = a.x + rem_third;
c.x = a.x + rem_third * 3.0f;
b.y = pos.y - 1.0f + (float)(int)(g.Font->Ascent * (g.FontSize / g.Font->FontSize) + 0.5f) + (float)(int)(g.Font->DisplayOffset.y);
a.y = b.y - rem_third;
c.y = b.y - rem_third * 2.0f;
window->DrawList->PathLineTo(a);
window->DrawList->PathLineTo(b);
window->DrawList->PathLineTo(c);
float bx = pos.x + 0.5f + start_x + rem_third;
float by = pos.y - 1.0f + (float)(int)(g.Font->Ascent * (g.FontSize / g.Font->FontSize) + 0.5f) + (float)(int)(g.Font->DisplayOffset.y);
window->DrawList->PathLineTo(ImVec2(bx - rem_third, by - rem_third));
window->DrawList->PathLineTo(ImVec2(bx, by));
window->DrawList->PathLineTo(ImVec2(bx + rem_third*2, by - rem_third*2));
window->DrawList->PathStroke(col, false);
}