Non-user plots must have predefined names.

This commit is contained in:
Bartosz Taudul 2018-04-28 15:49:51 +02:00
parent d8bfe7de2e
commit afa432a087
2 changed files with 17 additions and 2 deletions

View File

@ -2392,7 +2392,7 @@ int View::DrawPlots( int offset, double pxns, const ImVec2& wpos, bool hover, fl
{
draw->AddTriangle( wpos + ImVec2( to/2, offset + to/2 ), wpos + ImVec2( to/2, offset + ty - to/2 ), wpos + ImVec2( to/2 + th, offset + ty * 0.5 ), 0xFF226E6E );
}
const auto txt = m_worker.GetString( v->name );
const auto txt = GetPlotName( v );
draw->AddText( wpos + ImVec2( ty, offset ), showFull ? 0xFF44DDDD : 0xFF226E6E, txt );
draw->AddLine( wpos + ImVec2( 0, offset + ty - 1 ), wpos + ImVec2( w, offset + ty - 1 ), 0x8844DDDD );
@ -3014,7 +3014,7 @@ void View::DrawOptions()
{
for( const auto& p : m_worker.GetPlots() )
{
ImGui::Checkbox( m_worker.GetString( p->name ), &Visible( p ) );
ImGui::Checkbox( GetPlotName( p ), &Visible( p ) );
}
ImGui::TreePop();
}
@ -4907,6 +4907,20 @@ Vector<int8_t> View::GetMemoryPages() const
return ret;
}
const char* View::GetPlotName( const PlotData* plot ) const
{
switch( plot->type )
{
case PlotType::User:
return m_worker.GetString( plot->name );
case PlotType::Memory:
return "Memory usage";
default:
assert( false );
return nullptr;
}
}
uint32_t View::GetZoneColor( const ZoneEvent& ev )
{
const auto& srcloc = m_worker.GetSourceLocation( ev.srcloc );

View File

@ -116,6 +116,7 @@ private:
#endif
Vector<int8_t> GetMemoryPages() const;
const char* GetPlotName( const PlotData* plot ) const;
flat_hash_map<const void*, bool, nohash<const void*>> m_visible;
flat_hash_map<const void*, bool, nohash<const void*>> m_showFull;