mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-25 15:34:36 +00:00
Show diff direction and allow reversal.
This commit is contained in:
parent
166c553af3
commit
b8029f7448
@ -742,6 +742,7 @@ private:
|
||||
int minBinVal = 1;
|
||||
int compareMode = 0;
|
||||
bool diffDone = false;
|
||||
bool diffDirection;
|
||||
std::vector<const char*> thisUnique;
|
||||
std::vector<const char*> secondUnique;
|
||||
std::vector<std::pair<const char*, std::string>> diffs;
|
||||
|
@ -214,6 +214,7 @@ void View::DrawCompare()
|
||||
{
|
||||
m_compare.second = std::make_unique<Worker>( *f, EventType::SourceCache );
|
||||
m_compare.userData = std::make_unique<UserData>( m_compare.second->GetCaptureProgram().c_str(), m_compare.second->GetCaptureTime() );
|
||||
m_compare.diffDirection = m_worker.GetCaptureTime() < m_compare.second->GetCaptureTime();
|
||||
}
|
||||
catch( const tracy::UnsupportedVersion& e )
|
||||
{
|
||||
@ -309,8 +310,25 @@ void View::DrawCompare()
|
||||
ImGui::Separator();
|
||||
ImGui::BeginChild( "##compare" );
|
||||
|
||||
const auto& tfc = m_worker.GetSourceFileCache();
|
||||
const auto& ofc = m_compare.second->GetSourceFileCache();
|
||||
TextDisabledUnformatted( "Diff direction: " );
|
||||
ImGui::SameLine();
|
||||
TextColoredUnformatted( ImVec4( 0xDD/255.f, 0xDD/255.f, 0x22/255.f, 1.f ), ICON_FA_LEMON );
|
||||
ImGui::SameLine();
|
||||
ImGui::Text( " %s ", m_compare.diffDirection ? ICON_FA_ARROW_RIGHT : ICON_FA_ARROW_LEFT );
|
||||
ImGui::SameLine();
|
||||
TextColoredUnformatted( ImVec4( 0xDD/255.f, 0x22/255.f, 0x22/255.f, 1.f ), ICON_FA_GEM );
|
||||
ImGui::SameLine();
|
||||
if( ImGui::SmallButton( "Switch" ) )
|
||||
{
|
||||
m_compare.diffDirection = !m_compare.diffDirection;
|
||||
m_compare.Reset();
|
||||
}
|
||||
ImGui::Separator();
|
||||
|
||||
ImGui::BeginChild( "##diff" );
|
||||
|
||||
const auto& tfc = m_compare.diffDirection ? m_worker.GetSourceFileCache() : m_compare.second->GetSourceFileCache();
|
||||
const auto& ofc = m_compare.diffDirection ? m_compare.second->GetSourceFileCache() : m_worker.GetSourceFileCache();
|
||||
|
||||
if( !m_compare.diffDone )
|
||||
{
|
||||
@ -430,6 +448,7 @@ void View::DrawCompare()
|
||||
}
|
||||
}
|
||||
}
|
||||
ImGui::EndChild();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user