Take rounding into consideration.

This commit is contained in:
Bartosz Taudul 2021-12-23 15:15:49 +01:00
parent ac21169f35
commit c4c43ef7fe
No known key found for this signature in database
GPG Key ID: B7FE2008B7575DF3

View File

@ -4099,20 +4099,18 @@ void SourceView::RenderHwLinePart( size_t cycles, size_t retired, size_t branchR
else else
{ {
char buf[16]; char buf[16];
if( rate >= 0.1f )
{
const auto end = PrintFloat( buf, buf+16, rate * 100, 1 ); const auto end = PrintFloat( buf, buf+16, rate * 100, 1 );
assert( end == buf+4 ); memcpy( end, "%", 2 );
if( end - buf == 4 )
{
TextColoredUnformatted( col, buf );
} }
else else
{ {
*buf = ' '; ImGui::SameLine( 0, ts.x );
const auto end = PrintFloat( buf+1, buf+16, rate * 100, 1 );
assert( end == buf+4 );
}
memcpy( buf+4, "%", 2 );
TextColoredUnformatted( col, buf ); TextColoredUnformatted( col, buf );
} }
}
if( ImGui::IsItemHovered() ) if( ImGui::IsItemHovered() )
{ {
UnsetFont(); UnsetFont();