Add fast line drawing function.

This skips unnecessary construction of ImVec2 vector.

Note: unlike AddLine(), this function doesn't add 0.5 to x and y coordinates.
The user is expected to do it on his own, which if done in just one place will
be performance beneficial.
This commit is contained in:
Bartosz Taudul 2021-05-01 02:34:31 +02:00
parent b9ce9540be
commit fe22d5a6f6
No known key found for this signature in database
GPG Key ID: B7FE2008B7575DF3

View File

@ -12,6 +12,7 @@
#include "../imgui/imgui.h"
#include "../imgui/imgui_internal.h"
#include "../common/TracyForceInline.hpp"
#include "IconsFontAwesome5.h"
#if !IMGUI_DEFINE_MATH_OPERATORS
@ -238,6 +239,12 @@ static const ImVec4 SyntaxColorsDimmed[] = {
ImGui::PopClipRect();
}
[[maybe_unused]] static tracy_force_inline void DrawLine( ImDrawList* draw, const ImVec2& v1, const ImVec2& v2, uint32_t col, float thickness = 1.0f )
{
const ImVec2 data[2] = { v1, v2 };
draw->AddPolyline( data, 2, col, 0, thickness );
}
}
#endif