mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 06:47:35 +00:00
Profiler: Extract the bar label String into a private method
This commit is contained in:
parent
47a4737110
commit
d3a80b1a6e
2 changed files with 12 additions and 5 deletions
|
@ -116,11 +116,7 @@ void FlameGraphView::paint_event(GUI::PaintEvent& event)
|
||||||
painter.add_clip_rect(event.rect());
|
painter.add_clip_rect(event.rect());
|
||||||
|
|
||||||
for (const auto& bar : m_bars) {
|
for (const auto& bar : m_bars) {
|
||||||
auto label_index = bar.index.sibling_at_column(m_text_column);
|
auto label = bar_label(bar);
|
||||||
String label = "All";
|
|
||||||
if (label_index.is_valid()) {
|
|
||||||
label = m_model.data(label_index).to_string();
|
|
||||||
}
|
|
||||||
|
|
||||||
auto color = m_colors[label.hash() % m_colors.size()];
|
auto color = m_colors[label.hash() % m_colors.size()];
|
||||||
|
|
||||||
|
@ -148,6 +144,16 @@ void FlameGraphView::paint_event(GUI::PaintEvent& event)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String FlameGraphView::bar_label(StackBar const& bar) const
|
||||||
|
{
|
||||||
|
auto label_index = bar.index.sibling_at_column(m_text_column);
|
||||||
|
String label = "All";
|
||||||
|
if (label_index.is_valid()) {
|
||||||
|
label = m_model.data(label_index).to_string();
|
||||||
|
}
|
||||||
|
return label;
|
||||||
|
}
|
||||||
|
|
||||||
void FlameGraphView::layout_bars()
|
void FlameGraphView::layout_bars()
|
||||||
{
|
{
|
||||||
m_bars.clear();
|
m_bars.clear();
|
||||||
|
|
|
@ -45,6 +45,7 @@ private:
|
||||||
bool selected;
|
bool selected;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
String bar_label(StackBar const&) const;
|
||||||
void layout_bars();
|
void layout_bars();
|
||||||
void layout_children(GUI::ModelIndex& parent, int depth, int left, int right, Vector<GUI::ModelIndex>& selected);
|
void layout_children(GUI::ModelIndex& parent, int depth, int left, int right, Vector<GUI::ModelIndex>& selected);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue