From 27a98a3cc249983bffb22facde243973f04b50dc Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Sun, 24 Jul 2022 01:26:20 +0200 Subject: [PATCH] Make user plot color depend on its name. --- server/TracyView.hpp | 1 + server/TracyView_Plots.cpp | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/server/TracyView.hpp b/server/TracyView.hpp index 9050f618..689c1e92 100644 --- a/server/TracyView.hpp +++ b/server/TracyView.hpp @@ -311,6 +311,7 @@ private: std::vector GetMemoryPages() const; const char* GetPlotName( const PlotData* plot ) const; + uint32_t GetPlotColor( const PlotData* plot ) const; void SmallCallstackButton( const char* name, uint32_t callstack, int& idx, bool tooltip = true ); void DrawCallstackCalls( uint32_t callstack, uint16_t limit ) const; diff --git a/server/TracyView_Plots.cpp b/server/TracyView_Plots.cpp index d18ec54c..99e944c6 100644 --- a/server/TracyView_Plots.cpp +++ b/server/TracyView_Plots.cpp @@ -1,5 +1,6 @@ #include +#include "TracyColor.hpp" #include "TracyImGui.hpp" #include "TracyMouse.hpp" #include "TracyPrint.hpp" @@ -33,12 +34,12 @@ const char* View::GetPlotName( const PlotData* plot ) const } } -static uint32_t GetPlotColor( const PlotData* plot ) +uint32_t View::GetPlotColor( const PlotData* plot ) const { switch( plot->type ) { case PlotType::User: - return 0xFF44DDDD; + return GetHsvColor( charutil::hash( m_worker.GetString( plot->name ) ), -10 ); case PlotType::Memory: return 0xFF2266CC; case PlotType::SysTime: