Make user plot color depend on its name.

This commit is contained in:
Bartosz Taudul 2022-07-24 01:26:20 +02:00
parent a98bbc2340
commit 27a98a3cc2
No known key found for this signature in database
GPG Key ID: B7FE2008B7575DF3
2 changed files with 4 additions and 2 deletions

View File

@ -311,6 +311,7 @@ private:
std::vector<MemoryPage> 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;

View File

@ -1,5 +1,6 @@
#include <inttypes.h>
#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: