Store source location color in 24 bits.

This commit is contained in:
Bartosz Taudul 2017-10-13 19:59:18 +02:00
parent ed55fbfacb
commit ec789d60e8
3 changed files with 9 additions and 4 deletions

View File

@ -226,7 +226,9 @@ void Profiler::SendSourceLocation( uint64_t ptr )
item.srcloc.file = (uint64_t)srcloc->file;
item.srcloc.function = (uint64_t)srcloc->function;
item.srcloc.line = srcloc->line;
item.srcloc.color = srcloc->color;
item.srcloc.r = ( srcloc->color ) & 0xFF;
item.srcloc.g = ( srcloc->color >> 8 ) & 0xFF;
item.srcloc.b = ( srcloc->color >> 16 ) & 0xFF;
s_token.ptr->enqueue<moodycamel::CanAlloc>( std::move( item ) );
}

View File

@ -59,7 +59,9 @@ struct QueueSourceLocation
uint64_t function; // ptr
uint64_t file; // ptr
uint32_t line;
uint32_t color;
uint8_t r;
uint8_t g;
uint8_t b;
};
struct QueueZoneText

View File

@ -1666,7 +1666,7 @@ int View::DrawZoneLevel( const Vector<Event*>& vec, bool hover, double pxns, con
++it;
if( it == zitend ) break;
auto& srcloc2 = GetSourceLocation( (*it)->srcloc );
if( srcloc.color != srcloc2.color ) break;
if( srcloc.r != srcloc2.r || srcloc.g != srcloc2.g || srcloc.b != srcloc2.b ) break;
const auto nend = GetZoneEnd( **it );
const auto pxnext = ( nend - m_zvStart ) * pxns;
if( pxnext - px1 >= MinVisSize * 2 ) break;
@ -2390,7 +2390,8 @@ uint32_t View::GetZoneColor( const Event& ev )
uint32_t View::GetZoneColor( const QueueSourceLocation& srcloc )
{
return srcloc.color != 0 ? ( srcloc.color | 0xFF000000 ) : 0xFFCC5555;
const auto color = srcloc.r | ( srcloc.g << 8 ) | ( srcloc.b << 16 );
return color != 0 ? ( color | 0xFF000000 ) : 0xFFCC5555;
}
uint32_t View::GetZoneHighlight( const Event& ev, bool migration )