Add function to get zone color.

This commit is contained in:
Bartosz Taudul 2017-10-01 19:31:22 +02:00
parent 3dc4fc4796
commit 7365461ef4
2 changed files with 15 additions and 2 deletions

View File

@ -1253,7 +1253,7 @@ int View::DrawZoneLevel( const Vector<Event*>& vec, bool hover, double pxns, con
{
auto& ev = **it;
auto& srcloc = GetSourceLocation( ev.srcloc );
const auto color = srcloc.color != 0 ? ( srcloc.color | 0xFF000000 ) : 0xDDDD6666;
const auto color = GetZoneColor( srcloc );
const auto end = GetZoneEnd( ev );
const auto zsz = ( end - ev.start ) * pxns;
if( zsz < MinVisSize )
@ -1498,6 +1498,16 @@ void View::DrawZoneInfoWindow()
if( !show ) m_zoneInfoWindow = nullptr;
}
uint32_t View::GetZoneColor( const Event& ev )
{
return GetZoneColor( GetSourceLocation( ev.srcloc ) );
}
uint32_t View::GetZoneColor( const QueueSourceLocation& srcloc )
{
return srcloc.color != 0 ? ( srcloc.color | 0xFF000000 ) : 0xDDDD6666;
}
uint32_t View::GetZoneHighlight( const Event& ev )
{
if( m_zoneInfoWindow == &ev )
@ -1510,7 +1520,7 @@ uint32_t View::GetZoneHighlight( const Event& ev )
}
else
{
return 0xAAAAAAAA;
return 0xFF888888;
}
}

View File

@ -91,8 +91,11 @@ private:
int DrawZoneLevel( const Vector<Event*>& vec, bool hover, double pxns, const ImVec2& wpos, int offset, int depth );
void DrawZoneInfoWindow();
uint32_t GetZoneColor( const Event& ev );
uint32_t GetZoneColor( const QueueSourceLocation& srcloc );
uint32_t GetZoneHighlight( const Event& ev );
float GetZoneThickness( const Event& ev );
void ZoomToZone( const Event& ev );
void ZoneTooltip( const Event& ev );