This is a follow up to 248e37ac0c.
A line at 0 with 1px width should draw from 0.5 to 1.5
(cairo pixel offset). The same line with a width of 3px
is -0.5 to 2.5.
The self.intersection code calculates this correctly, subtracting
shift, the drawing code however incorrectly added it.
This fixes MIDI track grid/note offset as well as a bleed
below the track.
This reverts commit 37cae2f971.
This changes causes issues with recursive calls to the enter/leave event handling
stacks in gtk2_adour. Semantically, the change makes perfect sense, but finding
a solution to the recursion is challenging.
This is mostly a simple lexical search+replace but the absence of operator< for
std::weak_ptr<T> leads to some complications, particularly with Evoral::Sequence
and ExportPortChannel.
> This group functionality can be convenient for performing
> intermediate compositing. One common use of a group is to
> render objects as opaque within the group, (so that they
> occlude each other), and then blend the result with
> translucence onto the destination.
https://www.cairographics.org/manual/cairo-cairo-t.html#cairo-push-group
The main use case where will be to render opaque layered
[MIDI] regions transparently onto a grid.
This is never for inline references to parameters, only for starting parameter
documentation blocks. The "@p" command is for this, although unfortunately
Doxygen doesn't actually do anything with it and it's just an alias for code
text.
I'm not good with a mouse, so I found it hard to edit animation lines.
The mouse position has to be quite precise, with only a small threshold.
Looking at the code, AutomationLine sets the threshold for the PolyLine
to 4.0 . That seems to be a distance, and better for me than what I
experience.
The actual code in PolyLine is however comparing it directly to the
squared distance, making it more sensitive than expected.
Fixed by computing the squared threshold - also including the line
width.
This fixes the following problem:
When automation lines with significant change are zoomed in time, the
slope gets smaller (towards horizontal) as the control points moves
further away from the visible area. That was rendered correctly, but the
corresponding mouse events happened as if the line had a steeper slope.
The problem was caused by the X value being clamped to the visible area,
without scaling the Y value correspondingly. It has apparently been like
that for a decode, since introduced in c4f0063a68.
The problem is fixed by introducing a clamp2 function that scales the Y
value if clamping the X value.
Note: An old comment says that math goes wrong unless clamping below
COORD_MAX. It is not clear to me what math it refers to, and especially
why we don't need similar clamping on the lower bounds.
And while rarely a real problem, I guess it would be more correct and a
slight optimization to skip all lines where both ends are outside the
same bound. In theory, as it is now, the mouse could catch an invisible
line close to the border.