mirror of
https://github.com/wolfpld/tracy
synced 2025-04-30 04:43:53 +00:00
Fix printing floats in source view.
This commit is contained in:
parent
e289884395
commit
86c2574848
@ -4241,20 +4241,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, "% ", 3 );
|
||||||
|
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, "% ", 3 );
|
|
||||||
TextColoredUnformatted( col, buf );
|
TextColoredUnformatted( col, buf );
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if( ImGui::IsItemHovered() )
|
if( ImGui::IsItemHovered() )
|
||||||
{
|
{
|
||||||
UnsetFont();
|
UnsetFont();
|
||||||
@ -4334,20 +4332,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, "% ", 3 );
|
||||||
|
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, "% ", 3 );
|
|
||||||
TextColoredUnformatted( col, buf );
|
TextColoredUnformatted( col, buf );
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if( ImGui::IsItemHovered() )
|
if( ImGui::IsItemHovered() )
|
||||||
{
|
{
|
||||||
UnsetFont();
|
UnsetFont();
|
||||||
@ -4384,20 +4380,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();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user