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;
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()