Use TimelineContext when drawing CPU data.

This commit is contained in:
Bartosz Taudul 2023-03-19 00:23:33 +01:00
parent 26791f55d1
commit 5743bff0af
No known key found for this signature in database
GPG Key ID: B7FE2008B7575DF3
3 changed files with 14 additions and 7 deletions

View File

@ -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 );
}
}

View File

@ -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;

View File

@ -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 )