From fe22d5a6f652db66f45cacf8fb8ba1ddeac98b44 Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Sat, 1 May 2021 02:34:31 +0200 Subject: [PATCH] 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. --- server/TracyImGui.hpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/server/TracyImGui.hpp b/server/TracyImGui.hpp index 03f7f805..a3b99b49 100644 --- a/server/TracyImGui.hpp +++ b/server/TracyImGui.hpp @@ -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