From 2872edce5db914406ee44a8c1e15f4379982bf25 Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Wed, 11 Sep 2019 18:56:54 +0200 Subject: [PATCH] Use thread colors in context switch graph. --- server/TracyView.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/server/TracyView.cpp b/server/TracyView.cpp index d2e8b47c..9b9f2215 100644 --- a/server/TracyView.cpp +++ b/server/TracyView.cpp @@ -4290,8 +4290,19 @@ int View::DrawCpuData( int offset, double pxns, const ImVec2& wpos, bool hover, const auto pr1 = ( end - m_vd.zvStart ) * pxns; const auto px0 = std::max( pr0, -10.0 ); const auto px1 = std::max( { std::min( pr1, double( w + 10 ) ), px0 + pxns * 0.5, px0 + MinVisSize } ); - draw->AddRectFilled( wpos + ImVec2( px0, offset ), wpos + ImVec2( px1, offset + sty ), local ? 0xFF334488 : ( untracked ? 0xFF663333 : 0xFF444444 ) ); - draw->AddRect( wpos + ImVec2( px0, offset ), wpos + ImVec2( px1, offset + sty ), local ? 0xFF5566AA : ( untracked ? 0xFF885555 : 0xFF666666 ) ); + + uint32_t color; + if( m_vd.dynamicColors ) + { + color = local ? GetThreadColor( thread, 0 ) : ( untracked ? 0xFF663333 : 0xFF444444 ); + } + else + { + color = local ? 0xFF334488 : ( untracked ? 0xFF663333 : 0xFF444444 ); + } + + draw->AddRectFilled( wpos + ImVec2( px0, offset ), wpos + ImVec2( px1, offset + sty ), color ); + draw->AddRect( wpos + ImVec2( px0, offset ), wpos + ImVec2( px1, offset + sty ), HighlightColor( color ) ); auto tsz = ImGui::CalcTextSize( label ); if( tsz.x < zsz )