Skip to content

Commit fe22d5a

Browse files
committed
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.
1 parent b9ce954 commit fe22d5a

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

server/TracyImGui.hpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#include "../imgui/imgui.h"
1313
#include "../imgui/imgui_internal.h"
1414

15+
#include "../common/TracyForceInline.hpp"
1516
#include "IconsFontAwesome5.h"
1617

1718
#if !IMGUI_DEFINE_MATH_OPERATORS
@@ -238,6 +239,12 @@ static const ImVec4 SyntaxColorsDimmed[] = {
238239
ImGui::PopClipRect();
239240
}
240241

242+
[[maybe_unused]] static tracy_force_inline void DrawLine( ImDrawList* draw, const ImVec2& v1, const ImVec2& v2, uint32_t col, float thickness = 1.0f )
243+
{
244+
const ImVec2 data[2] = { v1, v2 };
245+
draw->AddPolyline( data, 2, col, 0, thickness );
246+
}
247+
241248
}
242249

243250
#endif

0 commit comments

Comments
 (0)