mirror of
https://github.com/wolfpld/tracy.git
synced 2025-03-20 07:40:02 +08:00
Separate small callstack button setup.
This commit is contained in:
parent
e7b71f29a5
commit
6485a090ed
@ -5311,27 +5311,7 @@ void View::ListMemData( T ptr, T end, std::function<const MemEvent*(T&)> DrawAdd
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
bool hilite = m_callstackInfoWindow == v->csAlloc;
|
SmallCallstackButton( "alloc", v->csAlloc, idx );
|
||||||
if( hilite )
|
|
||||||
{
|
|
||||||
ImGui::PushStyleColor( ImGuiCol_Button, (ImVec4)ImColor::HSV( 0.f, 0.6f, 0.6f ) );
|
|
||||||
ImGui::PushStyleColor( ImGuiCol_ButtonHovered, (ImVec4)ImColor::HSV( 0.f, 0.7f, 0.7f ) );
|
|
||||||
ImGui::PushStyleColor( ImGuiCol_ButtonActive, (ImVec4)ImColor::HSV( 0.f, 0.8f, 0.8f ) );
|
|
||||||
}
|
|
||||||
ImGui::PushID( idx++ );
|
|
||||||
if( ImGui::SmallButton( "alloc" ) )
|
|
||||||
{
|
|
||||||
m_callstackInfoWindow = v->csAlloc;
|
|
||||||
}
|
|
||||||
ImGui::PopID();
|
|
||||||
if( hilite )
|
|
||||||
{
|
|
||||||
ImGui::PopStyleColor( 3 );
|
|
||||||
}
|
|
||||||
if( ImGui::IsItemHovered() )
|
|
||||||
{
|
|
||||||
CallstackTooltip( v->csAlloc );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
ImGui::Spacing();
|
ImGui::Spacing();
|
||||||
@ -5342,27 +5322,7 @@ void View::ListMemData( T ptr, T end, std::function<const MemEvent*(T&)> DrawAdd
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
bool hilite = m_callstackInfoWindow == v->csFree;
|
SmallCallstackButton( "free", v->csFree, idx );
|
||||||
if( hilite )
|
|
||||||
{
|
|
||||||
ImGui::PushStyleColor( ImGuiCol_Button, (ImVec4)ImColor::HSV( 0.f, 0.6f, 0.6f ) );
|
|
||||||
ImGui::PushStyleColor( ImGuiCol_ButtonHovered, (ImVec4)ImColor::HSV( 0.f, 0.7f, 0.7f ) );
|
|
||||||
ImGui::PushStyleColor( ImGuiCol_ButtonActive, (ImVec4)ImColor::HSV( 0.f, 0.8f, 0.8f ) );
|
|
||||||
}
|
|
||||||
ImGui::PushID( idx++ );
|
|
||||||
if( ImGui::SmallButton( "free" ) )
|
|
||||||
{
|
|
||||||
m_callstackInfoWindow = v->csFree;
|
|
||||||
}
|
|
||||||
ImGui::PopID();
|
|
||||||
if( hilite )
|
|
||||||
{
|
|
||||||
ImGui::PopStyleColor( 3 );
|
|
||||||
}
|
|
||||||
if( ImGui::IsItemHovered() )
|
|
||||||
{
|
|
||||||
CallstackTooltip( v->csFree );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
ImGui::NextColumn();
|
ImGui::NextColumn();
|
||||||
ptr++;
|
ptr++;
|
||||||
@ -6203,4 +6163,30 @@ void View::FindZonesCompare()
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
void View::SmallCallstackButton( const char* name, uint32_t callstack, int& idx )
|
||||||
|
{
|
||||||
|
bool hilite = m_callstackInfoWindow == callstack;
|
||||||
|
if( hilite )
|
||||||
|
{
|
||||||
|
ImGui::PushStyleColor( ImGuiCol_Button, (ImVec4)ImColor::HSV( 0.f, 0.6f, 0.6f ) );
|
||||||
|
ImGui::PushStyleColor( ImGuiCol_ButtonHovered, (ImVec4)ImColor::HSV( 0.f, 0.7f, 0.7f ) );
|
||||||
|
ImGui::PushStyleColor( ImGuiCol_ButtonActive, (ImVec4)ImColor::HSV( 0.f, 0.8f, 0.8f ) );
|
||||||
|
}
|
||||||
|
ImGui::PushID( idx++ );
|
||||||
|
if( ImGui::SmallButton( name ) )
|
||||||
|
{
|
||||||
|
m_callstackInfoWindow = callstack;
|
||||||
|
}
|
||||||
|
ImGui::PopID();
|
||||||
|
if( hilite )
|
||||||
|
{
|
||||||
|
ImGui::PopStyleColor( 3 );
|
||||||
|
}
|
||||||
|
if( ImGui::IsItemHovered() )
|
||||||
|
{
|
||||||
|
CallstackTooltip( callstack );
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -128,6 +128,8 @@ private:
|
|||||||
std::pair<int8_t*, size_t> GetMemoryPages() const;
|
std::pair<int8_t*, size_t> GetMemoryPages() const;
|
||||||
const char* GetPlotName( const PlotData* plot ) const;
|
const char* GetPlotName( const PlotData* plot ) const;
|
||||||
|
|
||||||
|
void SmallCallstackButton( const char* name, uint32_t callstack, int& idx );
|
||||||
|
|
||||||
flat_hash_map<const void*, bool, nohash<const void*>> m_visible;
|
flat_hash_map<const void*, bool, nohash<const void*>> m_visible;
|
||||||
flat_hash_map<const void*, bool, nohash<const void*>> m_showFull;
|
flat_hash_map<const void*, bool, nohash<const void*>> m_showFull;
|
||||||
flat_hash_map<const void*, int, nohash<const void*>> m_gpuDrift;
|
flat_hash_map<const void*, int, nohash<const void*>> m_gpuDrift;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user