1
0
mirror of https://github.com/wolfpld/tracy synced 2025-04-29 20:33:52 +00:00

Extract thread color getter.

This commit is contained in:
Bartosz Taudul 2019-09-11 18:34:48 +02:00
parent 9cd359f0b9
commit 00409b0b94
2 changed files with 11 additions and 6 deletions

View File

@ -11849,13 +11849,8 @@ uint32_t View::GetZoneColor( const ZoneEvent& ev, uint64_t thread, int depth )
} }
} }
uint32_t View::GetRawZoneColor( const ZoneEvent& ev, uint64_t thread, int depth ) uint32_t View::GetThreadColor( uint64_t thread, int depth )
{ {
const auto& srcloc = m_worker.GetSourceLocation( ev.SrcLoc() );
const auto color = srcloc.color;
if( color != 0 ) return color | 0xFF000000;
if( !m_vd.dynamicColors ) return 0xFFCC5555;
const uint8_t h = thread & 0xFF; const uint8_t h = thread & 0xFF;
const uint8_t s = 96; const uint8_t s = 96;
const uint8_t v = std::max( 96, 170 - depth * 8 ); const uint8_t v = std::max( 96, 170 - depth * 8 );
@ -11882,6 +11877,15 @@ uint32_t View::GetRawZoneColor( const ZoneEvent& ev, uint64_t thread, int depth
return 0xFF000000 | ( r << 16 ) | ( g << 8 ) | b; return 0xFF000000 | ( r << 16 ) | ( g << 8 ) | b;
} }
uint32_t View::GetRawZoneColor( const ZoneEvent& ev, uint64_t thread, int depth )
{
const auto& srcloc = m_worker.GetSourceLocation( ev.SrcLoc() );
const auto color = srcloc.color;
if( color != 0 ) return color | 0xFF000000;
if( !m_vd.dynamicColors ) return 0xFFCC5555;
return GetThreadColor( thread, depth );
}
uint32_t View::GetZoneColor( const GpuEvent& ev ) uint32_t View::GetZoneColor( const GpuEvent& ev )
{ {
const auto& srcloc = m_worker.GetSourceLocation( ev.srcloc ); const auto& srcloc = m_worker.GetSourceLocation( ev.srcloc );

View File

@ -154,6 +154,7 @@ private:
void HandleZoneViewMouse( int64_t timespan, const ImVec2& wpos, float w, double& pxns ); void HandleZoneViewMouse( int64_t timespan, const ImVec2& wpos, float w, double& pxns );
uint32_t GetThreadColor( uint64_t thread, int depth );
uint32_t GetZoneColor( const ZoneEvent& ev, uint64_t thread, int depth ); uint32_t GetZoneColor( const ZoneEvent& ev, uint64_t thread, int depth );
uint32_t GetZoneColor( const GpuEvent& ev ); uint32_t GetZoneColor( const GpuEvent& ev );
uint32_t GetRawZoneColor( const ZoneEvent& ev, uint64_t thread, int depth ); uint32_t GetRawZoneColor( const ZoneEvent& ev, uint64_t thread, int depth );