diff --git a/server/TracyTimelineItemCpuData.cpp b/server/TracyTimelineItemCpuData.cpp index 73908c73..7ce37f2b 100644 --- a/server/TracyTimelineItemCpuData.cpp +++ b/server/TracyTimelineItemCpuData.cpp @@ -41,7 +41,7 @@ int64_t TimelineItemCpuData::RangeEnd() const bool TimelineItemCpuData::DrawContents( const TimelineContext& ctx, int& offset ) { - return m_view.DrawCpuData( ctx.pxns, offset, ctx.wpos, ctx.hover, ctx.yMin, ctx.yMax ); + return m_view.DrawCpuData( ctx, offset ); } } diff --git a/server/TracyView.hpp b/server/TracyView.hpp index 7360acfb..9ef0dbe2 100644 --- a/server/TracyView.hpp +++ b/server/TracyView.hpp @@ -125,7 +125,7 @@ public: void DrawThreadMessages( const ThreadData& thread, double pxns, int offset, const ImVec2& wpos, bool hover ); void DrawThreadOverlays( const ThreadData& thread, const ImVec2& ul, const ImVec2& dr ); bool DrawGpu( const GpuCtxData& gpu, double pxns, int& offset, const ImVec2& wpos, bool hover, float yMin, float yMax ); - bool DrawCpuData( double pxns, int& offset, const ImVec2& wpos, bool hover, float yMin, float yMax ); + bool DrawCpuData( const TimelineContext& ctx, int& offset ); bool m_showRanges = false; Range m_statRange; diff --git a/server/TracyView_CpuData.cpp b/server/TracyView_CpuData.cpp index fa82a248..f1709f51 100644 --- a/server/TracyView_CpuData.cpp +++ b/server/TracyView_CpuData.cpp @@ -5,6 +5,7 @@ #include "TracyMouse.hpp" #include "TracyPrint.hpp" #include "TracyTimelineItem.hpp" +#include "TracyTimelineContext.hpp" #include "TracyView.hpp" namespace tracy @@ -12,18 +13,24 @@ namespace tracy constexpr float MinVisSize = 3; -bool View::DrawCpuData( double pxns, int& offset, const ImVec2& wpos, bool hover, float yMin, float yMax ) +bool View::DrawCpuData( const TimelineContext& ctx, int& offset ) { auto cpuData = m_worker.GetCpuData(); const auto cpuCnt = m_worker.GetCpuDataCpuCount(); assert( cpuCnt != 0 ); - const auto w = ImGui::GetContentRegionAvail().x - 1; - const auto ty = ImGui::GetTextLineHeight(); - const auto nspxdbl = 1.0 / pxns; + const auto& wpos = ctx.wpos; + const auto w = ctx.w; + const auto ty = ctx.ty; + const auto pxns = ctx.pxns; + const auto nspxdbl = ctx.nspx; const auto nspx = int64_t( nspxdbl ); - auto draw = ImGui::GetWindowDrawList(); const auto dpos = wpos + ImVec2( 0.5f, 0.5f ); + const auto yMin = ctx.yMin; + const auto yMax = ctx.yMax; + const auto hover = ctx.hover; + + auto draw = ImGui::GetWindowDrawList(); #ifdef TRACY_NO_STATISTICS if( m_vd.drawCpuUsageGraph )