[Bf-blender-cvs] [d79d4096bc4] profiler-editor: correct profiler height
Jacques Lucke
noreply at git.blender.org
Sun May 2 15:50:34 CEST 2021
Commit: d79d4096bc41f55dfb77453698338232649c904b
Author: Jacques Lucke
Date: Sun May 2 15:14:10 2021 +0200
Branches: profiler-editor
https://developer.blender.org/rBd79d4096bc41f55dfb77453698338232649c904b
correct profiler height
===================================================================
M source/blender/editors/space_profiler/profiler_draw.cc
===================================================================
diff --git a/source/blender/editors/space_profiler/profiler_draw.cc b/source/blender/editors/space_profiler/profiler_draw.cc
index 018f1c321b4..dbfc3a36ef8 100644
--- a/source/blender/editors/space_profiler/profiler_draw.cc
+++ b/source/blender/editors/space_profiler/profiler_draw.cc
@@ -80,10 +80,17 @@ class ProfilerDrawer {
{
const float duration_ms = duration_to_ms(profiler_layout_->end_time() -
profiler_layout_->begin_time());
+
+ float min_bottom_y = 0.0f;
+ for (ProfileNode *node : profiler_layout_->root_nodes().last()) {
+ min_bottom_y = std::min(min_bottom_y, node->bottom_y);
+ }
+
/* Giving a bit more space on the right side is convenient. */
- const float extended_duration_ms = std::max(duration_ms * 1.1f, 5000.0f);
- /* TODO: Remove magic numbers. */
- UI_view2d_totRect_set(®ion_->v2d, extended_duration_ms, 2000);
+ const int width = std::max(duration_ms * 1.1f, 5000.0f);
+ const int height = -min_bottom_y * UI_UNIT_Y + UI_UNIT_Y;
+
+ UI_view2d_totRect_set(®ion_->v2d, width, height);
UI_view2d_scrollers_draw(®ion_->v2d, nullptr);
}
More information about the Bf-blender-cvs
mailing list