From 6e36469840f31f8459b16ea8c114e38e355fb217 Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Sat, 3 Sep 2022 19:28:50 +0200 Subject: [PATCH] Add non-View-dependent thread color getter. --- server/TracyUtility.cpp | 6 ++++++ server/TracyUtility.hpp | 1 + server/TracyView_Utility.cpp | 4 ++-- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/server/TracyUtility.cpp b/server/TracyUtility.cpp index 3138086d..32f9df40 100644 --- a/server/TracyUtility.cpp +++ b/server/TracyUtility.cpp @@ -140,6 +140,12 @@ void TooltipNormalizedName( const char* name, const char* normalized ) } } +uint32_t GetThreadColor( uint64_t thread, int depth, bool dynamic ) +{ + if( !dynamic ) return 0xFFCC5555; + return GetHsvColor( thread, depth ); +} + uint32_t GetPlotColor( const PlotData& plot, const Worker& worker ) { switch( plot.type ) diff --git a/server/TracyUtility.hpp b/server/TracyUtility.hpp index c752bae6..7540a81b 100644 --- a/server/TracyUtility.hpp +++ b/server/TracyUtility.hpp @@ -25,6 +25,7 @@ void TooltipNormalizedName( const char* name, const char* normalized ); static inline const char* ShortenZoneName( ShortenName type, const char* name ) { ImVec2 tsz = {}; return ShortenZoneName( type, name, tsz, 0 ); } +uint32_t GetThreadColor( uint64_t thread, int depth, bool dynamic ); uint32_t GetPlotColor( const PlotData& plot, const Worker& worker ); const char* FormatPlotValue( double val, PlotValueFormatting format ); diff --git a/server/TracyView_Utility.cpp b/server/TracyView_Utility.cpp index 1b63f04d..8ef2f44a 100644 --- a/server/TracyView_Utility.cpp +++ b/server/TracyView_Utility.cpp @@ -2,6 +2,7 @@ #include "TracyColor.hpp" #include "TracyPrint.hpp" +#include "TracyUtility.hpp" #include "TracyView.hpp" namespace tracy @@ -9,8 +10,7 @@ namespace tracy uint32_t View::GetThreadColor( uint64_t thread, int depth ) { - if( m_vd.dynamicColors == 0 ) return 0xFFCC5555; - return GetHsvColor( thread, depth ); + return tracy::GetThreadColor( thread, depth, m_vd.dynamicColors != 0 ); } uint32_t View::GetRawSrcLocColor( const SourceLocation& srcloc, int depth )