pstats: Fix some issues with updates of flame graph

Upon reading data from datagram, the bars would animate from zero width, which looks odd when opening an existing session.

Also, fix the scale area not updating properly in GTK version.
This commit is contained in:
rdb 2022-11-30 12:34:12 +01:00
parent 837815b553
commit 7691d3f67b
4 changed files with 16 additions and 11 deletions

View File

@ -199,6 +199,9 @@ normal_guide_bars() {
}
_guide_bars_changed = true;
nassertv_always(_scale_area != nullptr);
gtk_widget_queue_draw(_scale_area);
}
/**

View File

@ -33,11 +33,6 @@ GtkStatsGraph::
GtkStatsGraph(GtkStatsMonitor *monitor, bool has_label_stack) :
_monitor(monitor)
{
_parent_window = nullptr;
_window = nullptr;
_graph_window = nullptr;
_scale_area = nullptr;
GtkWidget *parent_window = monitor->get_window();
GdkWindow *window = gtk_widget_get_window(parent_window);

View File

@ -96,14 +96,14 @@ protected:
TextColors _text_colors;
GtkStatsMonitor *_monitor;
GtkWidget *_parent_window;
GtkWidget *_window;
GtkWidget *_parent_window = nullptr;
GtkWidget *_window = nullptr;
GtkWidget *_graph_frame;
GtkWidget *_graph_window;
GtkWidget *_graph_window = nullptr;
GtkWidget *_graph_hbox;
GtkWidget *_graph_vbox;
GtkWidget *_hpaned;
GtkWidget *_scale_area;
GtkWidget *_scale_area = nullptr;
GtkStatsLabelStack _label_stack;
GdkCursor *_hand_cursor;

View File

@ -47,7 +47,6 @@ PStatFlameGraph(PStatMonitor *monitor,
}
_guide_bar_units = GBU_ms | GBU_hz | GBU_show_units;
normal_guide_bars();
monitor->_flame_graphs.insert(this);
}
@ -213,8 +212,16 @@ read_datagram(DatagramIterator &scan) {
PStatGraph::read_datagram(scan);
_current_frame = -1;
normal_guide_bars();
_stack.clear();
update();
if (_average_mode) {
_time_width = _stack.get_net_value(false);
if (_time_width == 0.0) {
_time_width = 1.0 / pstats_target_frame_rate;
}
normal_guide_bars();
force_redraw();
}
}
/**