Commit: f55944001480a6690aba40ccdbf23583cd4d790a Author: Jacques Lucke Date: Tue Apr 27 16:33:45 2021 +0200 Branches: profiler-editor https://developer.blender.org/rBf55944001480a6690aba40ccdbf23583cd4d790a
cleanup =================================================================== M source/blender/editors/space_profiler/profiler_draw.cc M source/blender/editors/space_profiler/profiler_layout.cc M source/blender/editors/space_profiler/profiler_layout.hh M source/blender/editors/space_profiler/profiler_profile.cc M source/blender/editors/space_profiler/profiler_runtime.cc M source/blender/editors/space_profiler/profiler_runtime.hh =================================================================== diff --git a/source/blender/editors/space_profiler/profiler_draw.cc b/source/blender/editors/space_profiler/profiler_draw.cc index 8a496026092..ae40f963adf 100644 --- a/source/blender/editors/space_profiler/profiler_draw.cc +++ b/source/blender/editors/space_profiler/profiler_draw.cc @@ -29,6 +29,7 @@ #include "BLI_rect.h" #include "profiler_draw.hh" +#include "profiler_layout.hh" #include "profiler_runtime.hh" namespace blender::ed::profiler { @@ -36,6 +37,13 @@ namespace blender::ed::profiler { void draw_profiler(const bContext *C, ARegion *region) { SpaceProfiler *sprofiler = CTX_wm_space_profiler(C); + SpaceProfiler_Runtime &runtime = *sprofiler->runtime; + + if (!runtime.profiler_layout) { + runtime.profiler_layout = std::make_unique<ProfilerLayout>(); + } + ProfilerLayout &profiler_layout = *runtime.profiler_layout; + std::cout << profiler_layout.root_nodes().size() << "\n"; UI_ThemeClearColor(TH_BACK); } diff --git a/source/blender/editors/space_profiler/profiler_layout.cc b/source/blender/editors/space_profiler/profiler_layout.cc index 9dce6a7ba96..ec816e7d86b 100644 --- a/source/blender/editors/space_profiler/profiler_layout.cc +++ b/source/blender/editors/space_profiler/profiler_layout.cc @@ -135,7 +135,7 @@ void ProfileNode::pack_added_children() children_to_pack_.clear(); } -void ProfileLayout::add(const RecordedProfile &recorded_profile) +void ProfilerLayout::add(const RecordedProfile &recorded_profile) { /* Create new nodes for segments and add them to the id map. */ for (const ProfileTaskBegin &task_begin : recorded_profile.task_begins) { @@ -222,7 +222,7 @@ void ProfileNode::destruct_recursively() this->~ProfileNode(); } -ProfileLayout::~ProfileLayout() +ProfilerLayout::~ProfilerLayout() { for (Span<ProfileNode *> nodes : root_nodes_) { for (ProfileNode *node : nodes) { diff --git a/source/blender/editors/space_profiler/profiler_layout.hh b/source/blender/editors/space_profiler/profiler_layout.hh index 43b442cd40e..7f8c375b73f 100644 --- a/source/blender/editors/space_profiler/profiler_layout.hh +++ b/source/blender/editors/space_profiler/profiler_layout.hh @@ -26,7 +26,7 @@ namespace blender::ed::profiler { using profile::RecordedProfile; using profile::TimePoint; -class ProfileLayout; +class ProfilerLayout; class ProfileNode { private: @@ -45,7 +45,10 @@ class ProfileNode { /* These nodes still have to be inserted into the vectors above. They are not sorted. */ Vector<ProfileNode *> children_to_pack_; - friend ProfileLayout; + int top_y; + int bottom_y; + + friend ProfilerLayout; public: StringRefNull name() const @@ -96,7 +99,7 @@ class ProfileNode { void destruct_recursively(); }; -class ProfileLayout { +class ProfilerLayout { private: LinearAllocator<> allocator_; @@ -107,7 +110,7 @@ class ProfileLayout { TimePoint end_time_; public: - ~ProfileLayout(); + ~ProfilerLayout(); void add(const RecordedProfile &recorded); diff --git a/source/blender/editors/space_profiler/profiler_profile.cc b/source/blender/editors/space_profiler/profiler_profile.cc index 1dcaf9bb460..5019577e4fe 100644 --- a/source/blender/editors/space_profiler/profiler_profile.cc +++ b/source/blender/editors/space_profiler/profiler_profile.cc @@ -48,5 +48,5 @@ bool ED_profiler_profile_is_enabled(SpaceProfiler *sprofiler) void ED_profiler_profile_clear(SpaceProfiler *sprofiler) { SpaceProfiler_Runtime &runtime = *sprofiler->runtime; - runtime.profile_layout.reset(); + runtime.profiler_layout.reset(); } diff --git a/source/blender/editors/space_profiler/profiler_runtime.cc b/source/blender/editors/space_profiler/profiler_runtime.cc index 9e3361828f2..27de77ce732 100644 --- a/source/blender/editors/space_profiler/profiler_runtime.cc +++ b/source/blender/editors/space_profiler/profiler_runtime.cc @@ -24,11 +24,11 @@ SpaceProfilerListener::SpaceProfilerListener(SpaceProfiler_Runtime &runtime) : r void SpaceProfilerListener::handle(const RecordedProfile &profile) { - if (!runtime_->profile_layout) { - runtime_->profile_layout = std::make_unique<ProfileLayout>(); + if (!runtime_->profiler_layout) { + runtime_->profiler_layout = std::make_unique<ProfilerLayout>(); } - ProfileLayout &profile_layout = *runtime_->profile_layout; - profile_layout.add(profile); + ProfilerLayout &profiler_layout = *runtime_->profiler_layout; + profiler_layout.add(profile); } } // namespace blender::ed::profiler diff --git a/source/blender/editors/space_profiler/profiler_runtime.hh b/source/blender/editors/space_profiler/profiler_runtime.hh index 3da781839c3..c275a65d463 100644 --- a/source/blender/editors/space_profiler/profiler_runtime.hh +++ b/source/blender/editors/space_profiler/profiler_runtime.hh @@ -37,7 +37,7 @@ class SpaceProfilerListener : public profile::ProfileListener { } // namespace blender::ed::profiler struct SpaceProfiler_Runtime { - std::unique_ptr<blender::ed::profiler::ProfileLayout> profile_layout; + std::unique_ptr<blender::ed::profiler::ProfilerLayout> profiler_layout; std::unique_ptr<blender::ed::profiler::SpaceProfilerListener> profile_listener; SpaceProfiler_Runtime() = default; _______________________________________________ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs