Commit Graph

172 Commits

Author SHA1 Message Date
Ben Loftis a7c4ab3247 fix thinko in canvas logic (fixes mouse cursor on desensitized playhead) 2023-05-01 08:49:27 -05:00
Paul Davis 9e0c1ff510 Revert "canvas: when an item is shown, potentially pick it as the current item"
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.
2023-03-30 09:54:56 -06:00
Paul Davis edca8209aa canvas: fix debug output after auto-fication 2023-03-24 14:19:16 -06:00
Paul Davis 3036414e08 tempo: auto-fication of another loop 2023-03-24 14:19:16 -06:00
Paul Davis 37cae2f971 canvas: when an item is shown, potentially pick it as the current item 2023-03-24 14:19:16 -06:00
Robin Gareus 509504acf2 Add API to set openGL backing scale 2023-02-04 22:25:52 +01:00
Robin Gareus d12dd4015d
Revert canvas debugging
This reverts commit 8359311849.
This reverts commit f377822891.
This reverts commit 859d6ebe4a.
This reverts commit 4cd7de7a6f.
2023-02-04 18:23:18 +01:00
Robin Gareus 8359311849 debug: allow to profile exposure (revert this later) 2023-02-01 19:41:11 +01:00
Robin Gareus 902b98588e canvas: profile render time / area 2023-02-01 01:25:27 +01:00
Robin Gareus 859d6ebe4a debug: log canvas exposure area 2023-01-21 17:36:22 +01:00
Paul Davis 4cd7de7a6f debugging: allow selection no-draw for canvas fill, outline, text, lineset and waveview 2023-01-20 18:13:12 -07:00
David Robillard bdacfb8724 Fix invalid use of Doxygen "@param" command
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.
2022-10-30 20:44:28 -04:00
Paul Davis 384530984a canvas: make "debug_render" into a per-canvas member variable
This allows us to debug rendering in specific canvases, rather
than all of them.
2022-09-03 16:46:41 -06:00
Paul Davis ae9c11fb01 fix redefined CANVAS_DEBUG warning 2022-06-21 17:35:01 -06:00
luz paz fb55878375
Fix source typos (heirarchy->hierarchy) 2022-04-08 21:38:00 +02:00
Mads Kiilerich 91b08d5f45
gtkmm: use get_realized() instead of deprecated Gtk::Widget::is_realized() 2022-04-08 20:20:32 +02:00
Paul Davis b6d0f8f661 canvas: add a drawing-request-freeze/thaw API
If queue_draw is "frozen", we simply accumulate drawing
requests in a (union) rectangle, and when finally "thawed"
the canvas submits a single redraw request for the entire
accumulated rect.

Although in theory this is all that GTK/GDK does for
draw requests, callgrind reveals significant costs
associated with the actual calltree for GtkWidget::queue_draw_area().

One potential cost is that GDK also maintains a list of
invalidated rectangles in addition to the union, and
for MIDI regions with thousands of notes, this can represent
real overhead. This approach dispenses with the rect list,
since our Canvas drawing model only uses the union rectangle
anyway.
2022-04-05 20:52:09 -06:00
Robin Gareus b58072f14c
Fix canvas tooltips
The tooltip should remain visible until the mouse leaves
the item's bounding box. Also do not start the tooltip
timeout if the item does not have a tooltip.
2022-04-04 20:50:49 +02:00
Robin Gareus 9e75235912
Fix crashes on ARM due to window-size overflow
On Intel systems ArdourCanvas::COORD_MAX (1.7e+307) was rounded
to (gint) -2147483648. gtk+ treats negative window size-requests
as 1px.

However on ARM, COORD_MAX was truncated to +2147483648, gtk+ limits
this to 65535. Most WM/Xwin systems cannot handle windows this large.
It also exceeds the max size of cairo [image] surfaces.

This issue was introduced in a1c67b4ad7
when "natural_size" was removed. Before that change infinitely large
canvas had a natural_size of 2x2 px.
2022-03-09 21:14:53 +01:00
Paul Davis 993c7c4bec canvas: manually remove changes from 6f91dc0799 and implement same goal in a different way
The AudioClipEditor features a scroll bar that is a part of the canvas. Because scroll
groups are at the top level of a canvas, the scroll bar is necessary within a scroll
group, which causes it to get confused about the difference between its own
position within the canvas and that of the scroll group. This commit introduces
a per-Item flag, _scroll_translation, which is true by default. If false, the
item will not have coordinates translated to reflect scroll group position.
2022-01-20 09:45:47 -07:00
Paul Davis 6f91dc0799 canvas: fix an issue with event coordinate translation by ScrollGroup
If there's a grabbed item (GtkCanvas only at present) then unless it belongs to the scroll
group used for scroll offset translation, the event coordinates should not be translated,
even if the mouse pointer moves into the scroll group.
2021-12-10 18:17:58 -07:00
Ben Loftis 972229a02f Remove some spurious printouts 2021-12-08 13:39:38 -06:00
Paul Davis a1699ff612 canvas: size_allocate() from GTK gives origin in parent coordinates.
Convert to canvas-relative origin when passing to root group for allocation
2021-10-03 19:47:18 -06:00
Paul Davis be461e95e1 canvas: remove debug output 2021-09-10 12:57:43 -06:00
Paul Davis b416caf1bb canvas: several steps further with box packing and size allocation 2021-08-13 12:51:37 -06:00
Paul Davis a1c67b4ad7 canvas: remove intrinsic size concept, fall back to requested size; converge on gtk style size_request 2021-08-13 12:51:37 -06:00
Paul Davis 4a700f270d canvas: remove debug output 2021-08-13 12:51:37 -06:00
Paul Davis 9c071cd6ef Canvas::queue_draw_item_area() now expands the passed-in rect appropriately
This means that a request to (re)draw the Rect (0.5,0.5,9.5,9.5)
will actually generate an expose event for (0,0,10,10)

Note: the above rects are of the form (x0,y0,x1,y1)
2021-08-13 12:51:27 -06:00
Paul Davis 12b4807bc9 add a very (very) basic resize/layout design to the canvas
Items call ::queue_resize(), which sets a flag in the canvas; at next idle, we call
Canvas::layout() which walks the item tree and recursively calls layout (depth first)
on all items needing a resize.

Only Container types implement layout, and so far only Box
2021-08-13 12:51:26 -06:00
Paul Davis aa62460081 Canvas: re-use Solver as much as possible, with possible (but not substantive) speedup; remove debug output 2021-08-13 12:51:26 -06:00
Paul Davis f5d67e6520 Canvas: temporary easy way to get debug output from Canvas::render() in a test program 2021-08-13 12:51:26 -06:00
Paul Davis d37202585f Canvas: root group should not fill or outline itself 2021-08-13 12:51:26 -06:00
Paul Davis 504d8fdab3 Canvas: size request using preferred_size() callstack 2021-08-13 12:51:26 -06:00
Paul Davis baea368223 Canvas: initiate size allocation process from GTK-level size allocate event 2021-08-13 12:51:25 -06:00
Robin Gareus 5957e14259
Remove unused #include<> (2/2)
PBD::stacktrace() is not used nor needed by default.
It should be used sparingly.
2021-05-05 17:57:16 +02:00
Paul Davis 4151ec1907 remove accumulated debug output 2020-03-25 15:12:30 -06:00
Paul Davis dbcf7dd666 more playhead-drag/click locate debugging 2020-03-25 13:50:23 -06:00
John Emmas 45dd6a8ed3 Add a missing semicolon 2020-01-05 10:29:35 +00:00
Robin Gareus 0b266a54f0
Return of image-surface backed canvas (windows graphics performance)
This partially reverts 2edbda2526.

Using cairo-groups increases performance on MacOS, and retains
retina-resolution.
However it adds a performance regression for MS Windows graphics
rendering. cairo-groups use a "similar" surface, not an image surface.
Empirically this adds significant overhead compared to rendering
using the CPU and using bitblt.
2020-01-04 00:30:07 +01:00
Robin Gareus 2edbda2526
Replace explicit image-surface with cairo pattern/group
For MacOS/X this is equivalent, rendering happens using a
CGBitmapContext + image-surface. Windows and Linux needs profiling
for respective equivalent surfaces.
2019-12-27 19:35:02 +01:00
Robin Gareus c3ab63a2ea
Allow for per-widget image-surface backing
This is an intermediate commit, before replacing image surfaces with
cairo pattern groups.

The eventual goal is to reduce flickering and/or use
CPU + bitblt for specific widgets instead of cairo
graphics-cards accel.

This also removes excessive calls to getenv() for every rendering
operation.
2019-12-27 19:34:56 +01:00
Robin Gareus cec5ce8f45
Update canvas/UI lib GPL boilerplate and (C) from git log 2019-08-03 15:53:17 +02:00
Robin Gareus 9a0a2a29b5 Fix NSGLView invalidation 2017-07-18 21:34:03 +02:00
Robin Gareus 601c317d70 Clean up library inheritance (colors.h, utils.h)
make libwidget independent of libcanvas.
Confine basics to pbd and gtkmm2ext.
2017-07-17 21:06:04 +02:00
Tim Mayberry 4ddf97f5a2 Add Canvas::get_microseconds_since_render_start() method
Initial use is for the WaveView class to determine whether on not to draw the
waveform in the GUI thread.
2017-06-26 08:40:47 +10:00
Tim Mayberry ab13e87ec2 Add Canvas::get_last_render_start_timestamp method 2017-06-26 08:40:47 +10:00
Tim Mayberry 8538ba35fe Only call Gtk::Widget::queue_draw_area in canvas when item and visible area intersect
Refactor GtkCanvas::request_redraw to use Rect::intersection
2017-06-26 08:40:47 +10:00
Tim Mayberry c4e31fc322 Add an optional ArdourCanvas::Item::prepare_for_render interface
Called when an item has requested a redraw and intersects with visible
canvas area.

Also add Canvas::prepare_for_render that will call Item::prepare_for_render for
items visible on the canvas.
2017-06-26 08:40:47 +10:00
Tim Mayberry dac25b8db9 Add PreRender signal to the canvas
Emitted by the canvas immediately before rendering.
2017-06-26 08:40:47 +10:00
Robin Gareus aff92a019d Stop tooltip timeout when a canvas-widget or item is hidden. 2017-04-17 01:45:25 +02:00