Bug 497128 - TimeGraphControl#paint is called too often
Summary: TimeGraphControl#paint is called too often
Status: NEW
Alias: None
Product: Tracecompass
Classification: Tools
Component: TMF (show other bugs)
Version: 2.1.0   Edit
Hardware: PC Linux
: P3 normal
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact: Project Inbox CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 497111
  Show dependency tree
 
Reported: 2016-06-30 19:16 EDT by Alexandre Montplaisir CLA
Modified: 2016-07-04 15:07 EDT (History)
1 user (show)

See Also:


Attachments
patch highlighting the bug (1.68 KB, patch)
2016-06-30 19:16 EDT, Alexandre Montplaisir CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Alexandre Montplaisir CLA 2016-06-30 19:16:02 EDT
Created attachment 262841 [details]
patch highlighting the bug

The method TimeGraphControl#paint redraws the complete time graph, states, labels, arrows, etc. It seems to be called way more often than necessary!

paint() is called:

* 2 times when scrolling up or down in the view
* 4 times when zooming in or out
* once when moving the mouse from the time graph to the tree (should be 0)
* 2 times when clicking on a row in the tree
* 3-4 times (depends on the view) when clicking anywhere in the timegraph (shouldn't redraw at all!)

The attached patch makes it print to stdout every time the method is called, to highlight the problem.
Comment 1 Patrick Tasse CLA 2016-07-04 14:13:13 EDT
* 2 times when scrolling up or down in the view

I see 1.

* 4 times when zooming in or out

I see 2: One immediately to show the new range using the existing model, and one after the zoom thread is completed using the new model.

* once when moving the mouse from the time graph to the tree (should be 0)

I see 1. The repaint occurs because the selected item's background color changes when the time graph gains focus on MouseEnter.

* 2 times when clicking on a row in the tree

I see 1.

* 3-4 times (depends on the view) when clicking anywhere in the timegraph (shouldn't redraw at all!)

I see 2: One on MouseDown because the selected item and selected time line may have changed, and one on MouseUp because the selected event (at the selection end time) may have changed.

It's possible that some of the extra paints you see are due to the attempts to fix GTK glitches in TimeGraphCombo.alignTreeItems(boolean)?
Comment 2 Alexandre Montplaisir CLA 2016-07-04 14:16:27 EDT
What platform are you on?

In my case it was Ubuntu 16.10 (daily) with SWT_GTK3=0.
Comment 3 Patrick Tasse CLA 2016-07-04 15:07:59 EDT
Windows and Ubuntu 14.04.

Scrolling up and down, and clicking on a tree item, I see 2 paints if it's a TimeGraphCombo, but only 1 if it's a TimeGraphViewer. I'm guessing it's due to the alignTreeItems.

At the end of a zoom thread I sometimes see 2 paints, sometimes 1, I'm not sure why.