From bd00c6a4ee14f7592d650acc88962eabb1317117 Mon Sep 17 00:00:00 2001 From: Martijn Courteaux Date: Tue, 21 May 2024 19:47:19 +0200 Subject: [PATCH] Improve time comparing display with better colors. --- profiler/src/profiler/TracyView_Compare.cpp | 23 ++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/profiler/src/profiler/TracyView_Compare.cpp b/profiler/src/profiler/TracyView_Compare.cpp index f6f1c779..b3dc3513 100644 --- a/profiler/src/profiler/TracyView_Compare.cpp +++ b/profiler/src/profiler/TracyView_Compare.cpp @@ -193,23 +193,32 @@ static void PrintSpeedupOrSlowdown( double time_this, double time_external, cons double factor = time_this / time_external; if( time_external >= time_this ) { - label = "less than external"; + label = "less"; color = ImVec4( 0.1f, 0.6f, 0.1f, 1.0f ); } else { - label = "more than external"; + label = "more"; color = ImVec4( 0.8f, 0.1f, 0.1f, 1.0f ); } - TextColoredUnformatted( color, metric ); + ImGui::TextDisabled( "%s:", metric ); ImGui::SameLine(); - TextColoredUnformatted(color, time_diff ); + TextColoredUnformatted( color, time_diff ); ImGui::SameLine(); TextColoredUnformatted( color, label ); ImGui::SameLine(); + ImGui::TextUnformatted( "than external" ); + ImGui::SameLine(); ImGui::Spacing(); ImGui::SameLine(); - char buf[64]; - sprintf(buf, "(%s = %.2f%% %s)", ICON_FA_LEMON, factor * 100, ICON_FA_GEM ); - TextDisabledUnformatted( buf ); + + TextDisabledUnformatted("("); + ImGui::SameLine(); + TextColoredUnformatted( ImVec4( 0xDD/511.f, 0xDD/511.f, 0x22/511.f, 1.f ), ICON_FA_LEMON ); + ImGui::SameLine(); + ImGui::TextDisabled("= %.2f%%", factor * 100 ); + ImGui::SameLine(); + TextColoredUnformatted( ImVec4( 0xDD/511.f, 0x22/511.f, 0x22/511.f, 1.f ), ICON_FA_GEM ); + ImGui::SameLine(); + TextDisabledUnformatted(")"); } void View::DrawCompare()