From e9aeb0c52285ecc650c367908650d3cea07e7786 Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Sun, 24 Feb 2019 18:35:03 +0100 Subject: [PATCH] Darken timeline outside of capture area. --- server/TracyView.cpp | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/server/TracyView.cpp b/server/TracyView.cpp index c72ac87e..b905ac0b 100644 --- a/server/TracyView.cpp +++ b/server/TracyView.cpp @@ -1754,6 +1754,23 @@ void View::DrawZones() const auto linepos = ImGui::GetCursorScreenPos(); const auto lineh = ImGui::GetContentRegionAvail().y; + auto draw = ImGui::GetWindowDrawList(); + const auto w = ImGui::GetWindowContentRegionWidth() - 1; + const auto timespan = m_zvEnd - m_zvStart; + auto pxns = w / double( timespan ); + { + const auto tbegin = m_worker.GetTimeBegin(); + const auto tend = m_worker.GetLastTime(); + if( tbegin > m_zvStart ) + { + draw->AddRectFilled( linepos, linepos + ImVec2( ( tbegin - m_zvStart ) * pxns, lineh ), 0x44000000 ); + } + if( tend < m_zvEnd ) + { + draw->AddRectFilled( linepos + ImVec2( ( tend - m_zvStart ) * pxns, 0 ), linepos + ImVec2( w, lineh ), 0x44000000 ); + } + } + bool drawMouseLine = DrawZoneFramesHeader(); auto& frames = m_worker.GetFrames(); for( auto fd : frames ) @@ -1767,16 +1784,11 @@ void View::DrawZones() ImGui::BeginChild( "##zoneWin", ImVec2( ImGui::GetWindowContentRegionWidth(), ImGui::GetContentRegionAvail().y ), false, ImGuiWindowFlags_AlwaysVerticalScrollbar | ImGuiWindowFlags_NoScrollWithMouse ); const auto wpos = ImGui::GetCursorScreenPos(); - const auto w = ImGui::GetWindowContentRegionWidth() - 1; const auto h = std::max( m_zvHeight, ImGui::GetContentRegionAvail().y - 4 ); // magic border value - auto draw = ImGui::GetWindowDrawList(); ImGui::InvisibleButton( "##zones", ImVec2( w, h ) ); bool hover = ImGui::IsItemHovered(); - const auto timespan = m_zvEnd - m_zvStart; - auto pxns = w / double( timespan ); - if( hover ) { drawMouseLine = true;