From 938ab3b8ea88c1a1591cc07c00ca392e0f8fdfd5 Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Sun, 30 Jun 2024 20:11:25 +0200 Subject: [PATCH] Move config setup to a separate function. --- profiler/src/profiler/TracyView.cpp | 10 +++++++--- profiler/src/profiler/TracyView.hpp | 1 + 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/profiler/src/profiler/TracyView.cpp b/profiler/src/profiler/TracyView.cpp index 9e0b3cd2..83f5c25d 100644 --- a/profiler/src/profiler/TracyView.cpp +++ b/profiler/src/profiler/TracyView.cpp @@ -59,8 +59,7 @@ View::View( void(*cbMainThread)(const std::function&, bool), const char* , m_achievements( config.achievements ) { InitTextEditor(); - - m_vd.frameTarget = config.targetFps; + SetupConfig( config ); } View::View( void(*cbMainThread)(const std::function&, bool), FileRead& f, ImFont* fixedWidth, ImFont* smallFont, ImFont* bigFont, SetTitleCallback stcb, SetScaleCallback sscb, AttentionCallback acb, const Config& config, AchievementsMgr* amgr ) @@ -97,7 +96,7 @@ View::View( void(*cbMainThread)(const std::function&, bool), FileRead& f if( m_worker.GetCallstackFrameCount() == 0 ) m_showUnknownFrames = false; if( m_worker.GetCallstackSampleCount() == 0 ) m_showAllSymbols = true; - m_vd.frameTarget = config.targetFps; + SetupConfig( config ); Achieve( "loadTrace" ); } @@ -123,6 +122,11 @@ void View::InitTextEditor() m_sourceViewFile = nullptr; } +void View::SetupConfig( const Config& config ) +{ + m_vd.frameTarget = config.targetFps; +} + void View::Achieve( const char* id ) { if( !m_achievements || !m_achievementsMgr ) return; diff --git a/profiler/src/profiler/TracyView.hpp b/profiler/src/profiler/TracyView.hpp index b73ad30d..02526614 100644 --- a/profiler/src/profiler/TracyView.hpp +++ b/profiler/src/profiler/TracyView.hpp @@ -224,6 +224,7 @@ private: }; void InitTextEditor(); + void SetupConfig( const Config& config ); void Achieve( const char* id ); bool DrawImpl();