Profiler display one line/level

This commit is contained in:
Emmanuel BENOîT 2017-10-06 14:42:51 +02:00
parent c4218efc64
commit c90c0d6140

View file

@ -176,15 +176,25 @@ void T_Profiler::makeUI( )
// Plot
static constexpr float plHeight = 5;
float lh( 0 );
uint32_t dLine[ n ];
uint32_t cLine = 0;
angle = 0;
for ( auto i = 0u ; i < n ; i ++ ) {
angle = fmod( angle + 137 , 360 );
if ( i != 0 ) {
if ( chain_[ i ] == Invalid ) {
cLine ++;
} else {
cLine = dLine[ chain_[ i ] ];
}
}
dLine[ i ] = cLine;
if ( !displayed_[ i ] ) {
continue;
}
const float lx0 = msWidth * secStarts_[ i ];
const float lx1 = msWidth * ( secStarts_[ i ] + secDurations_[ i ] );
const float lh = cLine * ( plHeight + 1 );
const float ly1 = lh + plHeight;
ImVec4 color( 0 , 0 , 0 , 1 );
ImGui::ColorConvertHSVtoRGB( angle / 360. , .5 , 1 ,
@ -192,7 +202,6 @@ void T_Profiler::makeUI( )
dl->AddRectFilled( ImVec2( start.x + lx0 , start.y + lh ) ,
ImVec2( start.x + lx1 , start.y + ly1 ) ,
ImGui::GetColorU32( color ) );
lh = ly1 + 1;
}
ImGui::End( );