Improve time comparing display with better colors.

This commit is contained in:
Martijn Courteaux 2024-05-21 19:47:19 +02:00
parent abdbaed737
commit bd00c6a4ee

View File

@ -193,23 +193,32 @@ static void PrintSpeedupOrSlowdown( double time_this, double time_external, cons
double factor = time_this / time_external; double factor = time_this / time_external;
if( time_external >= time_this ) if( time_external >= time_this )
{ {
label = "less than external"; label = "less";
color = ImVec4( 0.1f, 0.6f, 0.1f, 1.0f ); color = ImVec4( 0.1f, 0.6f, 0.1f, 1.0f );
} else { } else {
label = "more than external"; label = "more";
color = ImVec4( 0.8f, 0.1f, 0.1f, 1.0f ); color = ImVec4( 0.8f, 0.1f, 0.1f, 1.0f );
} }
TextColoredUnformatted( color, metric ); ImGui::TextDisabled( "%s:", metric );
ImGui::SameLine(); ImGui::SameLine();
TextColoredUnformatted(color, time_diff ); TextColoredUnformatted( color, time_diff );
ImGui::SameLine(); ImGui::SameLine();
TextColoredUnformatted( color, label ); TextColoredUnformatted( color, label );
ImGui::SameLine(); ImGui::SameLine();
ImGui::TextUnformatted( "than external" );
ImGui::SameLine();
ImGui::Spacing(); ImGui::Spacing();
ImGui::SameLine(); ImGui::SameLine();
char buf[64];
sprintf(buf, "(%s = %.2f%% %s)", ICON_FA_LEMON, factor * 100, ICON_FA_GEM ); TextDisabledUnformatted("(");
TextDisabledUnformatted( buf ); 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() void View::DrawCompare()