Commit Graph

70 Commits

Author SHA1 Message Date
Paul Davis e64af8e4ed add a test for an environment variable before switching canvas single-expose off 2024-03-18 11:28:16 -06:00
Paul Davis 4b563ae518 move CairoCanvas::render() implementation for ArdourCanvas::Canvas into source
Note that this implementation only redraws a single (cairo_rectangle_t-defined) rect, and cannot
provide sub-rects the way that a normal GDK/GTK expose-driven redraw can
2024-03-18 10:50:36 -06:00
Paul Davis 71e085d825 ensure that the canvas fully redraws after style/visibility events 2024-03-18 10:49:15 -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
Paul Davis 4cd7de7a6f debugging: allow selection no-draw for canvas fill, outline, text, lineset and waveview 2023-01-20 18:13:12 -07: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 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
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
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
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 ecc2597870
Fix remaining doxygen warnings (!) 2019-09-30 21:03:29 +02:00
Robin Gareus bfec73b8c3
NO-OP: whitespace, indent 2019-09-30 21:03:20 +02: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 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
Tim Mayberry 9618b6dcbb Whitespace fixes in canvas.h 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
Robin Gareus 85b5741081 Allow to selectively use NSGLView Canvas
Various GdkEvents are not yet handled correctly, eg. unpacking a widget
from its container does not unmap it, nor are remaining widgets in the
contained re-positioned (size allocation does not change, nor does the
mapping). This affects eg. Mixbus Strips
2017-03-21 05:37:44 +01:00
Robin Gareus 60a0b8f645 Forward un/map events to NSGLView 2017-03-20 17:12:08 +01:00
Robin Gareus b5e613d453 Move NSGlView into libgtkmm2ext
This allows to re-use the concept with CairoWidget
2017-03-20 04:35:05 +01:00
Robin Gareus c371fc5115 Prepare NSView/OpenGL Canvas (to speed up rendering on [mac]OS[X]
This avoids Coregraphics (cairo_quartz_surface..) competely.
The openGL texture bypasses CG's slow argb_image and CGSColorMask
methods.
2017-03-19 22:49:17 +01:00
Paul Davis 4fa4b9a135 remove use of boost::optional to define "undefined" Canvas::Rect, and use Rect::empty instead.
This commit includes Rect::operator bool() which might be a candidate for removal in a future commit, in an attempt
to make the meaning clearer
2017-01-19 20:54:54 +01:00
Paul Davis 1552547f65 stop using gkd_pango_context_get() in ArdourCanvas::Canvas and require concrete instances to supply a Pango::Context; do this for GtkCanvas and Push2Canvas 2016-10-13 17:18:54 -04:00
Robin Gareus 160b24b137 fix crash when cleaning up canvas items
Backport from Mixbus. In Ardour this does not currently matter
since there is no top-level canvas destroyed top-down.

...
Editor::session_going_away
MixerStrip::~MixerStrip
MixbusStripCanvas::~MixbusStripCanvas
ArdourCanvas::GtkCanvas::~GtkCanvas
ArdourCanvas::Canvas::~Canvas
ArdourCanvas::Root::~Root
ArdourCanvas::Container::~Container
ArdourCanvas::Item::~Item
ArdourCanvas::Item::clear_items
GtkCanvas::item_going_away()
queue_draw_item_area()

..expose can take place async to garbage collection: crash in one of the
items.
2015-11-02 05:15:55 +01:00
Robin Gareus 22b07e0233 NOOP, remove trailing tabs/whitespace. 2015-10-05 16:17:49 +02:00
Paul Davis 4dc63966f0 globally remove all trailing whitespace from ardour code base.
Paul Davis was responsible for introducing almost all of this.
2015-10-04 14:51:05 -04:00
Ben Loftis bd6ef95989 add accessor methods for single_exposure 2015-02-12 11:35:35 -06:00
Ben Loftis b8ec035b24 _single_exposure is now a member variable for each GtkCanvas.
Gtk coalesces multiple exposes into a single combined rect.
If _single_exposure is disabled, we break apart the individual expose rects for the canvas rendering.
2015-02-12 11:35:35 -06:00
David Robillard 333c776e0e Fix MIDI region keyboard editing (add key handling to canvas). 2014-11-15 02:04:28 -05:00
Paul Davis ef56948d4a add background color property to Canvas::Canvas ; rearrange expose handling and include background fill
Conflicts:
	libs/canvas/canvas.cc
	libs/canvas/canvas/canvas.h
2014-11-10 10:43:25 -05:00
Robin Gareus b04414d170 allow to use cairo-image/software surface for canvas & cairowidgets 2014-10-28 02:15:10 +01:00
Robin Gareus 6dc3a4bf61 remove unused old API 2014-10-28 01:27:14 +01:00
Paul Davis df5a188825 further tweaks to canvas tooltip mechanism 2014-09-26 12:24:47 -04:00
Paul Davis bb68d83e43 display and position canvas tooltip window 2014-09-26 11:05:24 -04:00
Paul Davis d0dafc171c basic design of Canvas item tooltip mechanism.
No window yet to actually display the tooltip.
2014-09-25 21:43:15 -04:00
Paul Davis 69a92e67f0 Add Canvas::re_enter() which picks the current item again based on mouse pointer position and generates an enter event for it 2014-07-07 07:53:17 -04:00
John Emmas cef26a4e1e Change some declarations from 'struct' to 'class' (and vice-versa) 2014-06-29 13:56:41 +01:00
Paul Davis 3accf1d2af new API for TrackingText and similar items 2014-06-26 15:10:24 -04:00
Ben Loftis 2cc25a9d79 add scroll wheel handler to canvas 2014-06-24 10:33:28 -05:00
Paul Davis a8bd6ecc4f refactor Canvas so that all Items have children; add Container abstract base class; rename Group as "Layout" and retain only drawing semantics 2014-06-21 11:43:42 -04:00
Paul Davis f0c18abf55 remove global canvas scroll offset, to provide no-scroll-parent == no-scroll behaviour 2014-06-09 08:39:48 -04:00
Paul Davis ef9bf58359 fix problems with expose/redraws from canvas where requested area goes way outside the integer range allowed by GTK/GDK 2014-06-05 14:42:46 -04:00