Color plot background.

This commit is contained in:
Bartosz Taudul 2022-07-24 01:39:51 +02:00
parent 755df94f45
commit a3b6a9c95c
No known key found for this signature in database
GPG Key ID: B7FE2008B7575DF3
2 changed files with 13 additions and 1 deletions

View File

@ -28,6 +28,14 @@ static tracy_force_inline uint32_t DarkenColor( uint32_t color )
( ( ( ( color & 0x000000FF ) ) * 2 / 3 ) ); ( ( ( ( color & 0x000000FF ) ) * 2 / 3 ) );
} }
static tracy_force_inline uint32_t DarkenColorMore( uint32_t color )
{
return 0xFF000000 |
( ( ( ( color & 0x00FF0000 ) >> 16 ) * 1 / 4 ) << 16 ) |
( ( ( ( color & 0x0000FF00 ) >> 8 ) * 1 / 4 ) << 8 ) |
( ( ( ( color & 0x000000FF ) ) * 1 / 4 ) );
}
} }
#endif #endif

View File

@ -174,6 +174,11 @@ int View::DrawPlots( int offset, double pxns, const ImVec2& wpos, bool hover, fl
auto& vec = v->data; auto& vec = v->data;
vec.ensure_sorted(); vec.ensure_sorted();
const auto color = GetPlotColor( v );
const auto bg = 0x22000000 | ( DarkenColorMore( color ) & 0xFFFFFF );
draw->AddRectFilled( ImVec2( 0, yPos ), ImVec2( w, yPos + PlotHeight ), bg );
if( v->type == PlotType::Memory ) if( v->type == PlotType::Memory )
{ {
auto& mem = m_worker.GetMemoryNamed( v->name ); auto& mem = m_worker.GetMemoryNamed( v->name );
@ -273,7 +278,6 @@ int View::DrawPlots( int offset, double pxns, const ImVec2& wpos, bool hover, fl
} }
const auto revrange = 1.0 / ( max - min ); const auto revrange = 1.0 / ( max - min );
const auto color = GetPlotColor( v );
if( it == vec.begin() ) if( it == vec.begin() )
{ {