Commit graph

60 commits

Author SHA1 Message Date
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
Paul Davis
e0533e9dd7 more profound changes to canvas scrolling, in particular find appropriate ScrollGroup for Canvas::{window,canvas}_to_{canvas,window}() 2014-06-03 16:13:12 -04:00
Paul Davis
54a56cd3c6 various changes to get independent scrolling to work better in canvas. mostly tweaks relating to how scroll offsets are used during rendering.
Event handling offsets still require work.
2014-06-03 16:12:00 -04:00
Paul Davis
c9f890bd7c avoid recursing through the entire canvas when scrolling - only scroll explicitly identified ScrollGroups 2014-06-03 16:10:27 -04:00
Paul Davis
97109672c7 initial redesign of canvas scrolling to facilitate independent x- and y-axis scrolling of specific groups within the canvas.
This commit should cause no change in behaviour, but contains all the code and changes necessary
for the next step
2014-06-03 16:09:06 -04:00
Robin Gareus
fed5599baa smooth visual curve drawing 2014-05-30 03:04:02 +02:00
Paul Davis
218a4664be add visibility/export control to libcanvas 2013-12-27 16:24:58 -05:00
Paul Davis
9b6135b2e1 change enter/exit event delivery to follow X Window model (inferior, ancestor, virtual, nonlinear) 2013-12-12 20:44:04 -05:00
Paul Davis
88732abd01 change event propagation to be based on parent/child lineage, not z-axis stacking, plus some more alterations to try to get enter/leave working 2013-12-12 10:03:33 -05:00
Paul Davis
7ce86cec7d handle enter/leave items when zooming and scrolling occur 2013-10-31 03:10:18 -04:00
Paul Davis
7bbd28aa08 notable changes to try to improve most of enter/leave handling for canvas items 2013-10-30 23:36:30 -04:00