diff --git a/profiler/src/main.cpp b/profiler/src/main.cpp index 6ca614f4..5af16f9b 100644 --- a/profiler/src/main.cpp +++ b/profiler/src/main.cpp @@ -763,7 +763,7 @@ static void DrawContents() view = std::make_unique( RunOnMainThread, addr, port, fixedWidth, smallFont, bigFont, SetWindowTitleCallback, GetMainWindowNative, SetupScaleCallback ); } } - ImGui::SameLine( 0, ImGui::GetFontSize() * 2 ); + ImGui::SameLine( 0, ImGui::GetTextLineHeight() * 2 ); #ifndef TRACY_NO_FILESELECTOR if( ImGui::Button( ICON_FA_FOLDER_OPEN " Open saved trace" ) && !loadThread.joinable() ) @@ -842,7 +842,7 @@ static void DrawContents() } if( showFilter ) { - const auto w = ImGui::GetFontSize() * 12; + const auto w = ImGui::GetTextLineHeight() * 12; ImGui::Separator(); addrFilter.Draw( "Address filter", w ); portFilter.Draw( "Port filter", w ); diff --git a/server/TracyImGui.hpp b/server/TracyImGui.hpp index 2b794fd4..4c7c4f1e 100644 --- a/server/TracyImGui.hpp +++ b/server/TracyImGui.hpp @@ -95,7 +95,7 @@ static const ImVec4 SyntaxColorsDimmed[] = { ImGui::TextUnformatted( "" ); auto draw = ImGui::GetWindowDrawList(); const auto wpos = ImGui::GetWindowPos(); - const auto ty = ImGui::GetFontSize(); + const auto ty = ImGui::GetTextLineHeight(); const auto h = ImGui::GetCursorPosY() - ty * 0.5f; const auto w = ImGui::GetWindowWidth(); draw->AddCircleFilled( wpos + ImVec2( w * 0.5f - ty, h ), ty * ( 0.15f + 0.2f * ( pow( cos( time * 3.5f + 0.3f ), 16.f ) ) ), 0xFFBBBBBB, 12 ); diff --git a/server/TracySourceView.cpp b/server/TracySourceView.cpp index 3d2dbdd0..fbda25cc 100644 --- a/server/TracySourceView.cpp +++ b/server/TracySourceView.cpp @@ -971,7 +971,7 @@ void SourceView::RenderSimpleSourceView() const auto wpos = ImGui::GetWindowPos(); const auto dpos = wpos + ImVec2( 0.5f, 0.5f ); const auto wh = ImGui::GetWindowHeight(); - const auto ty = ImGui::GetFontSize(); + const auto ty = ImGui::GetTextLineHeight(); const auto ts = ImGui::CalcTextSize( " " ).x; const auto lineCount = lines.size(); const auto tmp = RealToString( lineCount ); @@ -1282,7 +1282,7 @@ void SourceView::RenderSymbolView( Worker& worker, View& view ) const auto w = ImGui::CalcTextSize( v ).x; if( w > mw ) mw = w; } - ImGui::SetNextItemWidth( mw + ImGui::GetFontSize() ); + ImGui::SetNextItemWidth( mw + ImGui::GetTextLineHeight() ); ImGui::PushStyleVar( ImGuiStyleVar_FramePadding, ImVec2( 0, 0 ) ); if( ImGui::BeginCombo( "##cost", s_CostName[(int)m_cost], ImGuiComboFlags_HeightLarge ) ) { @@ -1447,7 +1447,7 @@ void SourceView::RenderSymbolView( Worker& worker, View& view ) if( !map.empty() ) { TextDisabledUnformatted( "Child call distribution" ); - if( ImGui::BeginChild( "ccd", ImVec2( 0, ImGui::GetFontSize() * std::min( 4, map.size() ) + ImGui::GetStyle().WindowPadding.y ) ) ) + if( ImGui::BeginChild( "ccd", ImVec2( 0, ImGui::GetTextLineHeight() * std::min( 4, map.size() ) + ImGui::GetStyle().WindowPadding.y ) ) ) { std::vector vec; vec.reserve( map.size() ); @@ -1851,7 +1851,7 @@ void SourceView::RenderSymbolSourceView( const AddrStatData& as, Worker& worker, const auto wpos = ImGui::GetWindowPos() - ImVec2( ImGui::GetCurrentWindowRead()->Scroll.x, 0 ); const auto dpos = wpos + ImVec2( 0.5f, 0.5f ); const auto wh = ImGui::GetWindowHeight(); - const auto ty = ImGui::GetFontSize(); + const auto ty = ImGui::GetTextLineHeight(); const auto ts = ImGui::CalcTextSize( " " ).x; const auto lineCount = lines.size(); const auto tmp = RealToString( lineCount ); @@ -2197,7 +2197,7 @@ uint64_t SourceView::RenderSymbolAsmView( const AddrStatData& as, Worker& worker ImGui::SameLine( 0, 0 ); ImGui::TextUnformatted( " \xce\xbc""arch:" ); ImGui::SameLine(); - ImGui::SetNextItemWidth( mw + ImGui::GetFontSize() ); + ImGui::SetNextItemWidth( mw + ImGui::GetTextLineHeight() ); ImGui::PushStyleVar( ImGuiStyleVar_FramePadding, ImVec2( 0, 0 ) ); if( ImGui::BeginCombo( "##uarch", s_uArchUx[m_selMicroArch].uArch, ImGuiComboFlags_HeightLarge ) ) { @@ -2716,7 +2716,7 @@ uint64_t SourceView::RenderSymbolAsmView( const AddrStatData& as, Worker& worker static bool PrintPercentage( float val, uint32_t col = 0xFFFFFFFF ) { - const auto ty = ImGui::GetFontSize(); + const auto ty = ImGui::GetTextLineHeight(); auto draw = ImGui::GetWindowDrawList(); const auto wpos = ImGui::GetCursorScreenPos(); const auto stw = ImGui::CalcTextSize( " " ).x; @@ -2743,7 +2743,7 @@ void SourceView::RenderLine( const Tokenizer::Line& line, int lineNum, const Add { const auto scale = GetScale(); const auto ts = ImGui::CalcTextSize( " " ); - const auto ty = ImGui::GetFontSize(); + const auto ty = ImGui::GetTextLineHeight(); auto draw = ImGui::GetWindowDrawList(); const auto w = std::max( m_srcWidth, ImGui::GetWindowWidth() ); const auto wpos = ImGui::GetCursorScreenPos(); @@ -3037,7 +3037,7 @@ void SourceView::RenderLine( const Tokenizer::Line& line, int lineNum, const Add void SourceView::RenderAsmLine( AsmLine& line, const AddrStat& ipcnt, const AddrStatData& as, Worker& worker, uint64_t& jumpOut, int maxAddrLen, View& view ) { const auto scale = GetScale(); - const auto ty = ImGui::GetFontSize(); + const auto ty = ImGui::GetTextLineHeight(); auto draw = ImGui::GetWindowDrawList(); const auto w = std::max( m_asmWidth, ImGui::GetWindowWidth() ); const auto wpos = ImGui::GetCursorScreenPos(); @@ -3580,7 +3580,7 @@ void SourceView::RenderAsmLine( AsmLine& line, const AddrStat& ipcnt, const Addr if( m_showLatency && asmVar && asmVar->minlat >= 0 ) { const auto pos = ImVec2( (int)ImGui::GetCursorScreenPos().x, (int)ImGui::GetCursorScreenPos().y ); - const auto ty = ImGui::GetFontSize(); + const auto ty = ImGui::GetTextLineHeight(); if( asmVar->minlat == 0 ) { diff --git a/server/TracyView.cpp b/server/TracyView.cpp index c86e2d24..e677aad5 100644 --- a/server/TracyView.cpp +++ b/server/TracyView.cpp @@ -337,7 +337,7 @@ void View::DrawHelpMarker( const char* desc ) const TextDisabledUnformatted( "(?)" ); if( ImGui::IsItemHovered() ) { - const auto ty = ImGui::GetFontSize(); + const auto ty = ImGui::GetTextLineHeight(); ImGui::BeginTooltip(); ImGui::PushTextWrapPos( 450.0f * ty / 15.f ); ImGui::TextUnformatted( desc ); @@ -1325,7 +1325,7 @@ bool View::DrawImpl() void View::DrawNotificationArea() { auto& io = ImGui::GetIO(); - const auto ty = ImGui::GetFontSize(); + const auto ty = ImGui::GetTextLineHeight(); if( m_worker.IsConnected() ) { size_t sqs; @@ -1553,7 +1553,7 @@ void View::DrawNotificationArea() bool View::DrawConnection() { const auto scale = GetScale(); - const auto ty = ImGui::GetFontSize(); + const auto ty = ImGui::GetTextLineHeight(); const auto cs = ty * 0.9f; const auto isConnected = m_worker.IsConnected(); @@ -2475,7 +2475,7 @@ void View::DrawZoneFramesHeader() const auto dpos = wpos + ImVec2( 0.5f, 0.5f ); const auto w = ImGui::GetContentRegionAvail().x - ImGui::GetStyle().ScrollbarSize; auto draw = ImGui::GetWindowDrawList(); - const auto ty = ImGui::GetFontSize(); + const auto ty = ImGui::GetTextLineHeight(); const auto ty025 = round( ty * 0.25f ); const auto ty0375 = round( ty * 0.375f ); const auto ty05 = round( ty * 0.5f ); @@ -2619,7 +2619,7 @@ void View::DrawZoneFrames( const FrameData& frames ) const auto w = ImGui::GetContentRegionAvail().x - ImGui::GetStyle().ScrollbarSize; const auto wh = ImGui::GetContentRegionAvail().y; auto draw = ImGui::GetWindowDrawList(); - const auto ty = ImGui::GetFontSize(); + const auto ty = ImGui::GetTextLineHeight(); const auto ty025 = ty * 0.25f; const auto ty05 = round( ty * 0.5f ); @@ -2988,7 +2988,7 @@ void View::DrawZones() const auto nspx = 1.0 / pxns; - const auto ty = ImGui::GetFontSize(); + const auto ty = ImGui::GetTextLineHeight(); const auto ostep = ty + 1; int offset = 0; const auto to = 9.f; @@ -3014,7 +3014,7 @@ void View::DrawZones() ImGui::PushClipRect( wpos, wpos + ImVec2( w, oldOffset + vis.height ), true ); ImGui::PushFont( m_smallFont ); - const auto sty = ImGui::GetFontSize(); + const auto sty = ImGui::GetTextLineHeight(); const auto sstep = sty + 1; ImGui::PopFont(); @@ -3963,7 +3963,7 @@ void View::DrawContextSwitches( const ContextSwitch* ctx, const Vector& vec, bool hover, double pxns, const auto itend = std::lower_bound( it, vec.end(), m_vd.zvEnd, [] ( const auto& l, const auto& r ) { return l.time.Val() < r; } ); if( it == itend ) return; - const auto ty0375 = offset + round( ImGui::GetFontSize() * 0.375f ); - const auto ty02 = round( ImGui::GetFontSize() * 0.2f ); - const auto ty01 = round( ImGui::GetFontSize() * 0.1f ); + const auto ty0375 = offset + round( ImGui::GetTextLineHeight() * 0.375f ); + const auto ty02 = round( ImGui::GetTextLineHeight() * 0.2f ); + const auto ty01 = round( ImGui::GetTextLineHeight() * 0.1f ); const auto y0 = ty0375 - ty02 - 3; const auto y1 = ty0375 + ty02 - 1; auto draw = ImGui::GetWindowDrawList(); @@ -4269,7 +4269,7 @@ void View::DrawSamples( const Vector& vec, bool hover, double pxns, #ifndef TRACY_NO_STATISTICS int View::DispatchGhostLevel( const Vector& vec, bool hover, double pxns, int64_t nspx, const ImVec2& wpos, int _offset, int depth, float yMin, float yMax, uint64_t tid ) { - const auto ty = ImGui::GetFontSize(); + const auto ty = ImGui::GetTextLineHeight(); const auto ostep = ty + 1; const auto offset = _offset + ostep * depth; @@ -4294,7 +4294,7 @@ int View::DrawGhostLevel( const Vector& vec, bool hover, double pxns, if( it == zitend ) return depth; const auto w = ImGui::GetContentRegionAvail().x - 1; - const auto ty = ImGui::GetFontSize(); + const auto ty = ImGui::GetTextLineHeight(); const auto ostep = ty + 1; const auto offset = _offset + ostep * depth; auto draw = ImGui::GetWindowDrawList(); @@ -4607,7 +4607,7 @@ int View::SkipGhostLevel( const Vector& vec, bool hover, double pxns, int View::DispatchZoneLevel( const Vector>& vec, bool hover, double pxns, int64_t nspx, const ImVec2& wpos, int _offset, int depth, float yMin, float yMax, uint64_t tid ) { - const auto ty = ImGui::GetFontSize(); + const auto ty = ImGui::GetTextLineHeight(); const auto ostep = ty + 1; const auto offset = _offset + ostep * depth; @@ -4651,7 +4651,7 @@ int View::DrawZoneLevel( const V& vec, bool hover, double pxns, int64_t nspx, co if( !a(*it).IsEndValid() && m_worker.GetZoneEnd( a(*it) ) < m_vd.zvStart ) return depth; const auto w = ImGui::GetContentRegionAvail().x - 1; - const auto ty = ImGui::GetFontSize(); + const auto ty = ImGui::GetTextLineHeight(); const auto ostep = ty + 1; const auto offset = _offset + ostep * depth; auto draw = ImGui::GetWindowDrawList(); @@ -4927,7 +4927,7 @@ int View::SkipZoneLevel( const V& vec, bool hover, double pxns, int64_t nspx, co int View::DispatchGpuZoneLevel( const Vector>& vec, bool hover, double pxns, int64_t nspx, const ImVec2& wpos, int _offset, int depth, uint64_t thread, float yMin, float yMax, int64_t begin, int drift ) { - const auto ty = ImGui::GetFontSize(); + const auto ty = ImGui::GetTextLineHeight(); const auto ostep = ty + 1; const auto offset = _offset + ostep * depth; @@ -4976,7 +4976,7 @@ int View::DrawGpuZoneLevel( const V& vec, bool hover, double pxns, int64_t nspx, if( it == zitend ) return depth; const auto w = ImGui::GetContentRegionAvail().x - 1; - const auto ty = ImGui::GetFontSize(); + const auto ty = ImGui::GetTextLineHeight(); const auto ostep = ty + 1; const auto offset = _offset + ostep * depth; auto draw = ImGui::GetWindowDrawList(); @@ -5510,7 +5510,7 @@ int View::DrawLocks( uint64_t tid, bool hover, double pxns, const ImVec2& wpos, const auto delay = m_worker.GetDelay(); const auto resolution = m_worker.GetResolution(); const auto w = ImGui::GetContentRegionAvail().x - 1; - const auto ty = ImGui::GetFontSize(); + const auto ty = ImGui::GetTextLineHeight(); const auto ostep = ty + 1; auto draw = ImGui::GetWindowDrawList(); const auto dsz = delay * pxns; @@ -6097,7 +6097,7 @@ int View::DrawCpuData( int offset, double pxns, const ImVec2& wpos, bool hover, if( cpuCnt == 0 ) return offset; const auto w = ImGui::GetContentRegionAvail().x - 1; - const auto ty = ImGui::GetFontSize(); + const auto ty = ImGui::GetTextLineHeight(); const auto ostep = ty + 1; const auto nspxdbl = 1.0 / pxns; const auto nspx = int64_t( nspxdbl ); @@ -6244,7 +6244,7 @@ int View::DrawCpuData( int offset, double pxns, const ImVec2& wpos, bool hover, } ImGui::PushFont( m_smallFont ); - const auto sty = round( ImGui::GetFontSize() ); + const auto sty = round( ImGui::GetTextLineHeight() ); const auto sstep = sty + 1; const auto origOffset = offset; @@ -6561,7 +6561,7 @@ int View::DrawPlots( int offset, double pxns, const ImVec2& wpos, bool hover, fl float tmpvec[MaxPoints*2]; const auto w = ImGui::GetContentRegionAvail().x - 1; - const auto ty = ImGui::GetFontSize(); + const auto ty = ImGui::GetTextLineHeight(); auto draw = ImGui::GetWindowDrawList(); const auto to = 9.f; const auto th = ( ty - to ) * sqrt( 3 ) * 0.5; @@ -9993,7 +9993,7 @@ void View::DrawFindZone() zones.ensure_sorted(); if( ImGui::TreeNodeEx( "Histogram", ImGuiTreeNodeFlags_DefaultOpen ) ) { - const auto ty = ImGui::GetFontSize(); + const auto ty = ImGui::GetTextLineHeight(); int64_t tmin = m_findZone.tmin; int64_t tmax = m_findZone.tmax; @@ -12112,7 +12112,7 @@ void View::DrawCompare() ImGui::Separator(); if( ImGui::TreeNodeEx( "Histogram", ImGuiTreeNodeFlags_DefaultOpen ) ) { - const auto ty = ImGui::GetFontSize(); + const auto ty = ImGui::GetTextLineHeight(); int64_t tmin, tmax; size_t size0, size1; @@ -14763,7 +14763,7 @@ void View::DrawInfo() if( ImGui::TreeNodeEx( "Histogram", ImGuiTreeNodeFlags_DefaultOpen ) ) { - const auto ty = ImGui::GetFontSize(); + const auto ty = ImGui::GetTextLineHeight(); auto& frames = m_frameSortData.data; auto tmin = frames.front();