Don't draw off-screen zone timeline labels.

This commit is contained in:
Bartosz Taudul 2018-04-20 22:45:29 +02:00
parent 84fd351fba
commit 723fad84a7

View File

@ -879,6 +879,9 @@ void View::DrawZones()
const auto to = 9.f; const auto to = 9.f;
const auto th = ( ty - to ) * sqrt( 3 ) * 0.5; const auto th = ( ty - to ) * sqrt( 3 ) * 0.5;
const auto yMin = linepos.y;
const auto yMax = yMin + lineh;
// gpu zones // gpu zones
if( m_drawGpuZones ) if( m_drawGpuZones )
{ {
@ -886,10 +889,13 @@ void View::DrawZones()
{ {
const auto& v = m_worker.GetGpuData()[i]; const auto& v = m_worker.GetGpuData()[i];
if( !Visible( v ) ) continue; if( !Visible( v ) ) continue;
bool& showFull = ShowFull( v );
const auto yPos = wpos.y + offset;
if( yPos + ostep >= yMin && yPos <= yMax )
{
draw->AddLine( wpos + ImVec2( 0, offset + ostep - 1 ), wpos + ImVec2( w, offset + ostep - 1 ), 0x33FFFFFF ); draw->AddLine( wpos + ImVec2( 0, offset + ostep - 1 ), wpos + ImVec2( w, offset + ostep - 1 ), 0x33FFFFFF );
bool& showFull = ShowFull( v );
if( showFull ) if( showFull )
{ {
draw->AddTriangleFilled( wpos + ImVec2( to/2, offset + to/2 ), wpos + ImVec2( ty - to/2, offset + to/2 ), wpos + ImVec2( ty * 0.5, offset + to/2 + th ), 0xFFFFAAAA ); draw->AddTriangleFilled( wpos + ImVec2( to/2, offset + to/2 ), wpos + ImVec2( ty - to/2, offset + to/2 ), wpos + ImVec2( ty * 0.5, offset + to/2 + th ), 0xFFFFAAAA );
@ -926,6 +932,7 @@ void View::DrawZones()
ImGui::Text( "Query accuracy bits: %i", v->accuracyBits ); ImGui::Text( "Query accuracy bits: %i", v->accuracyBits );
ImGui::EndTooltip(); ImGui::EndTooltip();
} }
}
offset += ostep; offset += ostep;
if( showFull ) if( showFull )
@ -942,10 +949,13 @@ void View::DrawZones()
for( const auto& v : m_worker.GetThreadData() ) for( const auto& v : m_worker.GetThreadData() )
{ {
if( !Visible( v ) ) continue; if( !Visible( v ) ) continue;
bool& showFull = ShowFull( v );
const auto yPos = wpos.y + offset;
if( yPos + ostep >= yMin && yPos <= yMax )
{
draw->AddLine( wpos + ImVec2( 0, offset + ostep - 1 ), wpos + ImVec2( w, offset + ostep - 1 ), 0x33FFFFFF ); draw->AddLine( wpos + ImVec2( 0, offset + ostep - 1 ), wpos + ImVec2( w, offset + ostep - 1 ), 0x33FFFFFF );
bool& showFull = ShowFull( v );
if( showFull ) if( showFull )
{ {
draw->AddTriangleFilled( wpos + ImVec2( to/2, offset + to/2 ), wpos + ImVec2( ty - to/2, offset + to/2 ), wpos + ImVec2( ty * 0.5, offset + to/2 + th ), 0xFFFFFFFF ); draw->AddTriangleFilled( wpos + ImVec2( to/2, offset + to/2 ), wpos + ImVec2( ty - to/2, offset + to/2 ), wpos + ImVec2( ty * 0.5, offset + to/2 + th ), 0xFFFFFFFF );
@ -1019,7 +1029,7 @@ void View::DrawZones()
ImGui::Text( "Top-level zones: %s", RealToString( v->timeline.size(), true ) ); ImGui::Text( "Top-level zones: %s", RealToString( v->timeline.size(), true ) );
} }
ImGui::EndTooltip(); ImGui::EndTooltip();
}
} }
offset += ostep; offset += ostep;