From 020ba4a28937e75d6774a97b53b09a29c5631738 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Emmanuel=20Beno=C3=AEt?= <tseeker@nocternity.net>
Date: Sun, 24 Dec 2017 18:40:34 +0100
Subject: [PATCH] Profiler - Some code clean-up

---
 ui-profiling.cc | 6 ++----
 ui-profiling.hh | 2 +-
 2 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/ui-profiling.cc b/ui-profiling.cc
index a29981d..5c4b67c 100644
--- a/ui-profiling.cc
+++ b/ui-profiling.cc
@@ -150,10 +150,8 @@ void T_Profiler::makeUI( )
 
 	ImGui::BeginChild( "left" , ImVec2( 180 , 0 ) , true );
 	float angle( 0 );
+	displayed_.resize( n , true );
 	for ( auto i = 0u ; i < n ; i ++ ) {
-		if ( displayed_.size( ) == i ) {
-			displayed_.add( true );
-		}
 		angle = fmod( angle + 137 , 360 );
 		ImVec4 color( 0 , 0 , 0 , 1 );
 		ImGui::ColorConvertHSVtoRGB( angle / 360. , .5 , 1 ,
@@ -164,7 +162,7 @@ void T_Profiler::makeUI( )
 		char tms[ 12 ];
 		snprintf( tms , 12 , "%.1f" , secDurations_[ i ] );
 		sb << sections_[ i ] << " (" << tms << "ms)" << '\0';
-		ImGui::Checkbox( sb.data( ) , (bool*) &displayed_[ i ] );
+		ImGui::Checkbox( sb.data( ) , &displayed_[ i ] );
 		ImGui::PopStyleColor( );
 		if ( ImGui::IsItemHovered( ) ) {
 			ImGui::BeginTooltip( );
diff --git a/ui-profiling.hh b/ui-profiling.hh
index 38a345a..cd1f240 100644
--- a/ui-profiling.hh
+++ b/ui-profiling.hh
@@ -69,7 +69,7 @@ struct T_Profiler
 	T_Array< float > secStarts_;
 
 	bool uiEnabled_ = false;
-	T_Array< int > displayed_;
+	T_Array< bool > displayed_;
 
 	T_Array< GLuint > gpuQueries_{ T_Array< GLuint >( 64 ) };
 	T_Data_ gpuSamples_;