summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornick_m <mainsbridge@gmail.com>2016-04-13 05:38:31 +1000
committernick_m <mainsbridge@gmail.com>2016-05-27 23:38:14 +1000
commit4f7a4cd23331d64acfabc52e978dcb3dde2e82ec (patch)
tree4bad0d36962295a4e69221f5cf9c2d562d306550
parentc6d9d8193b4258c75c0dee09fb3b067334a88402 (diff)
Crapola - this is an experimental performance hack that must be reverted.
-rw-r--r--gtk2_ardour/audio_region_view.cc24
-rw-r--r--gtk2_ardour/midi_region_view.cc4
-rw-r--r--gtk2_ardour/region_view.cc56
-rw-r--r--gtk2_ardour/streamview.cc15
-rw-r--r--gtk2_ardour/time_axis_view_item.cc16
-rw-r--r--gtk2_ardour/time_axis_view_item.h2
-rw-r--r--gtk2_ardour/time_info_box.cc2
-rw-r--r--libs/ardour/playlist.cc30
-rw-r--r--libs/canvas/text.cc12
9 files changed, 88 insertions, 73 deletions
diff --git a/gtk2_ardour/audio_region_view.cc b/gtk2_ardour/audio_region_view.cc
index 95345440cd..ca0e5c68a9 100644
--- a/gtk2_ardour/audio_region_view.cc
+++ b/gtk2_ardour/audio_region_view.cc
@@ -231,23 +231,24 @@ AudioRegionView::init (bool wfd)
}
const string line_name = _region->name() + ":gain";
+
gain_line.reset (new AudioRegionGainLine (line_name, *this, *group, audio_region()->envelope()));
update_envelope_visibility ();
gain_line->reset ();
- set_height (trackview.current_height()); // XXX not correct for Layered mode, but set_height() will fix later.
+ /* streamview will call set_height() */
+ //set_height (trackview.current_height()); // XXX not correct for Layered mode, but set_height() will fix later.
region_muted ();
region_sync_changed ();
region_resized (ARDOUR::bounds_change);
+ /* region_resized sets ghost region duration */
- for (vector<GhostRegion*>::iterator i = ghosts.begin(); i != ghosts.end(); ++i) {
- (*i)->set_duration (_region->length() / samples_per_pixel);
- }
+ /* region_locked is a synonym for region_renamed () which is called in region_muted() above */
+ //region_locked ();
- region_locked ();
envelope_active_changed ();
fade_in_active_changed ();
fade_out_active_changed ();
@@ -274,15 +275,14 @@ AudioRegionView::init (bool wfd)
setup_waveform_visibility ();
- pending_peak_data->raise_to_top ();
-
+ /* reset_width_dependent_items() does this:
if (frame_handle_start) {
frame_handle_start->raise_to_top ();
}
if (frame_handle_end) {
frame_handle_end->raise_to_top ();
}
-
+ */
/* XXX sync mark drag? */
}
@@ -449,6 +449,10 @@ AudioRegionView::region_resized (const PropertyChange& what_changed)
void
AudioRegionView::reset_width_dependent_items (double pixel_width)
{
+ if (pixel_width == _width) {
+ return;
+ }
+
RegionView::reset_width_dependent_items(pixel_width);
assert(_pixel_width == pixel_width);
@@ -530,6 +534,10 @@ AudioRegionView::setup_fade_handle_positions()
void
AudioRegionView::set_height (gdouble height)
{
+ if (height == _height) {
+ return;
+ }
+
RegionView::set_height (height);
pending_peak_data->set_y1 (height);
diff --git a/gtk2_ardour/midi_region_view.cc b/gtk2_ardour/midi_region_view.cc
index 9aac06151d..3fbe2c83fc 100644
--- a/gtk2_ardour/midi_region_view.cc
+++ b/gtk2_ardour/midi_region_view.cc
@@ -271,12 +271,12 @@ MidiRegionView::init (bool wfd)
RegionView::init (false);
- set_height (trackview.current_height());
+ //set_height (trackview.current_height());
region_muted ();
region_sync_changed ();
region_resized (ARDOUR::bounds_change);
- region_locked ();
+ //region_locked ();
set_colors ();
diff --git a/gtk2_ardour/region_view.cc b/gtk2_ardour/region_view.cc
index 8f863a90d7..a2a4712b46 100644
--- a/gtk2_ardour/region_view.cc
+++ b/gtk2_ardour/region_view.cc
@@ -178,13 +178,14 @@ RegionView::init (bool wfd)
_enable_display = true;
}
- set_height (trackview.current_height());
+ /* derived class calls set_height () including RegionView::set_height() in ::init() */
+ //set_height (trackview.current_height());
_region->PropertyChanged.connect (*this, invalidator (*this), boost::bind (&RegionView::region_changed, this, _1), gui_context());
- set_colors ();
-
- UIConfiguration::instance().ColorsChanged.connect (sigc::mem_fun (*this, &RegionView::color_handler));
+ /* derived class calls set_colors () including RegionView::set_colors() in ::init() */
+ //set_colors ();
+ //UIConfiguration::instance().ColorsChanged.connect (sigc::mem_fun (*this, &RegionView::color_handler));
/* XXX sync mark drag? */
}
@@ -588,7 +589,6 @@ RegionView::region_renamed ()
set_item_name (str, this);
set_name_text (str);
- reset_width_dependent_items (_pixel_width);
}
void
@@ -775,39 +775,25 @@ RegionView::update_coverage_frames (LayerDisplay d)
/* the color that will be used to show parts of regions that will not be heard */
uint32_t const non_playing_color = UIConfiguration::instance().color_mod ("covered region", "covered region base");
- while (t < end) {
-
- t++;
-
- /* is this region is on top at time t? */
- bool const new_me = (pl->top_unmuted_region_at (t) == _region);
+ t = pl->find_next_region_boundary (t, 1);
- /* finish off any old rect, if required */
- if (cr && me != new_me) {
- cr->set_x1 (trackview.editor().sample_to_pixel (t - position));
- }
-
- /* start off any new rect, if required */
- if (cr == 0 || me != new_me) {
- cr = new ArdourCanvas::Rectangle (group);
- _coverage_frames.push_back (cr);
- cr->set_x0 (trackview.editor().sample_to_pixel (t - position));
- cr->set_y0 (1);
- cr->set_y1 (_height + 1);
- cr->set_outline (false);
- cr->set_ignore_events (true);
- if (new_me) {
- cr->set_fill_color (UINT_RGBA_CHANGE_A (non_playing_color, 0));
- } else {
- cr->set_fill_color (non_playing_color);
- }
- }
+ /* is this region is on top at time t? */
+ bool const new_me = (pl->top_unmuted_region_at (t) == _region);
- t = pl->find_next_region_boundary (t, 1);
- if (t < 0) {
- break;
+ /* start off any new rect, if required */
+ if (cr == 0 || me != new_me) {
+ cr = new ArdourCanvas::Rectangle (group);
+ _coverage_frames.push_back (cr);
+ cr->set_x0 (trackview.editor().sample_to_pixel (t - position));
+ cr->set_y0 (1);
+ cr->set_y1 (_height + 1);
+ cr->set_outline (false);
+ cr->set_ignore_events (true);
+ if (new_me) {
+ cr->set_fill_color (UINT_RGBA_CHANGE_A (non_playing_color, 0));
+ } else {
+ cr->set_fill_color (non_playing_color);
}
- me = new_me;
}
if (cr) {
diff --git a/gtk2_ardour/streamview.cc b/gtk2_ardour/streamview.cc
index c737f7842c..28dd1ab8f1 100644
--- a/gtk2_ardour/streamview.cc
+++ b/gtk2_ardour/streamview.cc
@@ -119,7 +119,7 @@ StreamView::set_height (double h)
return -1;
}
- if (canvas_rect->y1() == h) {
+ if (height == h) {
return 0;
}
@@ -139,6 +139,10 @@ StreamView::set_samples_per_pixel (double fpp)
return -1;
}
+ if (fpp == _samples_per_pixel) {
+ return 0;
+ }
+
_samples_per_pixel = fpp;
for (i = region_views.begin(); i != region_views.end(); ++i) {
@@ -292,7 +296,8 @@ StreamView::playlist_layered (boost::weak_ptr<Track> wtr)
if (_layer_display == Stacked) {
update_contents_height ();
- update_coverage_frames ();
+ /* tricky. playlist_changed() does this as well, and its really inefficient. */
+ //update_coverage_frames ();
} else {
/* layering has probably been modified. reflect this in the canvas. */
layer_regions();
@@ -311,12 +316,12 @@ StreamView::playlist_switched (boost::weak_ptr<Track> wtr)
/* disconnect from old playlist */
playlist_connections.drop_connections ();
- undisplay_track ();
+ //undisplay_track ();
/* draw it */
-
+ tr->playlist()->freeze();
redisplay_track ();
-
+ tr->playlist()->thaw();
/* update layers count and the y positions and heights of our regions */
_layers = tr->playlist()->top_layer() + 1;
update_contents_height ();
diff --git a/gtk2_ardour/time_axis_view_item.cc b/gtk2_ardour/time_axis_view_item.cc
index 008dfabe7e..cc38d12855 100644
--- a/gtk2_ardour/time_axis_view_item.cc
+++ b/gtk2_ardour/time_axis_view_item.cc
@@ -160,7 +160,6 @@ TimeAxisViewItem::init (ArdourCanvas::Item* parent, double fpp, uint32_t base_co
{
group = new ArdourCanvas::Container (parent);
CANVAS_DEBUG_NAME (group, string_compose ("TAVI group for %1", get_item_name()));
- group->Event.connect (sigc::mem_fun (*this, &TimeAxisViewItem::canvas_group_event));
fill_color = base_color;
fill_color_name = "time axis view item base";
@@ -247,13 +246,14 @@ TimeAxisViewItem::init (ArdourCanvas::Item* parent, double fpp, uint32_t base_co
frame_handle_start = frame_handle_end = 0;
}
- set_color (base_color);
+ //set_color (base_color);
- set_duration (item_duration, this);
- set_position (start, this);
+ //set_duration (item_duration, this);
+ //set_position (start, this);
- Config->ParameterChanged.connect (*this, invalidator (*this), boost::bind (&TimeAxisViewItem::parameter_changed, this, _1), gui_context ());
- UIConfiguration::instance().ParameterChanged.connect (sigc::mem_fun (*this, &TimeAxisViewItem::parameter_changed));
+ group->Event.connect (sigc::mem_fun (*this, &TimeAxisViewItem::canvas_group_event));
+ //Config->ParameterChanged.connect (*this, invalidator (*this), boost::bind (&TimeAxisViewItem::parameter_changed, this, _1), gui_context ());
+ //UIConfiguration::instance().ParameterChanged.connect (sigc::mem_fun (*this, &TimeAxisViewItem::parameter_changed));
}
TimeAxisViewItem::~TimeAxisViewItem()
@@ -532,7 +532,7 @@ TimeAxisViewItem::set_name_text(const string& new_name)
name_text_width = pixel_width (new_name, NAME_FONT) + 2;
name_text->set (new_name);
manage_name_text ();
-
+ manage_name_highlight ();
}
/**
@@ -569,8 +569,6 @@ TimeAxisViewItem::set_height (double height)
selection_frame->set (frame->get().shrink (1.0));
}
}
-
- set_colors ();
}
void
diff --git a/gtk2_ardour/time_axis_view_item.h b/gtk2_ardour/time_axis_view_item.h
index 63cc56411c..749df465a4 100644
--- a/gtk2_ardour/time_axis_view_item.h
+++ b/gtk2_ardour/time_axis_view_item.h
@@ -235,9 +235,9 @@ class TimeAxisViewItem : public Selectable, public PBD::ScopedConnectionList
bool _recregion;
bool _automation; ///< true if this is an automation region view
bool _dragging;
+ double _width;
private:
- double _width;
void parameter_changed (std::string);
void manage_name_highlight ();
diff --git a/gtk2_ardour/time_info_box.cc b/gtk2_ardour/time_info_box.cc
index de31dafc76..eccb470062 100644
--- a/gtk2_ardour/time_info_box.cc
+++ b/gtk2_ardour/time_info_box.cc
@@ -187,7 +187,7 @@ TimeInfoBox::region_property_change (boost::shared_ptr<ARDOUR::Region> /* r */,
* RegionView (not Region itself).
*/
- selection_changed ();
+ //selection_changed ();
}
bool
diff --git a/libs/ardour/playlist.cc b/libs/ardour/playlist.cc
index 3301fe9f9e..2e96dee063 100644
--- a/libs/ardour/playlist.cc
+++ b/libs/ardour/playlist.cc
@@ -1822,6 +1822,7 @@ Playlist::regions_at (framepos_t frame)
for (RegionList::iterator i = rlist->begin(); i != rlist->end(); ) {
RegionList::iterator tmp = i;
+
++tmp;
if ((*i)->muted()) {
@@ -2047,23 +2048,25 @@ Playlist::find_next_region (framepos_t frame, RegionPoint point, int dir)
boost::shared_ptr<Region> r = (*i);
frameoffset_t distance;
+ const framepos_t first_frame = r->first_frame();
+ const framepos_t last_frame = r->last_frame();
- if (r->first_frame() > frame) {
+ if (first_frame > frame) {
- distance = r->first_frame() - frame;
+ distance = first_frame - frame;
if (distance < closest) {
- ret = r->first_frame();
+ ret = first_frame;
closest = distance;
}
}
- if (r->last_frame () > frame) {
+ if (last_frame > frame) {
- distance = r->last_frame () - frame;
+ distance = last_frame - frame;
if (distance < closest) {
- ret = r->last_frame ();
+ ret = last_frame;
closest = distance;
}
}
@@ -2075,23 +2078,25 @@ Playlist::find_next_region (framepos_t frame, RegionPoint point, int dir)
boost::shared_ptr<Region> r = (*i);
frameoffset_t distance;
+ const framepos_t first_frame = r->first_frame();
+ const framepos_t last_frame = r->last_frame();
- if (r->last_frame() < frame) {
+ if (last_frame < frame) {
- distance = frame - r->last_frame();
+ distance = frame - last_frame;
if (distance < closest) {
- ret = r->last_frame();
+ ret = last_frame;
closest = distance;
}
}
- if (r->first_frame() < frame) {
+ if (first_frame < frame) {
- distance = frame - r->first_frame();
+ distance = frame - first_frame;
if (distance < closest) {
- ret = r->first_frame();
+ ret = first_frame;
closest = distance;
}
}
@@ -2899,6 +2904,7 @@ Playlist::update_after_tempo_map_change ()
}
thaw ();
+ notify_contents_changed();
}
void
diff --git a/libs/canvas/text.cc b/libs/canvas/text.cc
index d1f76eb1a3..3b309e51df 100644
--- a/libs/canvas/text.cc
+++ b/libs/canvas/text.cc
@@ -70,6 +70,10 @@ Text::~Text ()
void
Text::set (string const & text)
{
+ if (text == _text) {
+ return;
+ }
+
begin_change ();
_text = text;
@@ -237,6 +241,10 @@ Text::compute_bounding_box () const
void
Text::set_alignment (Pango::Alignment alignment)
{
+ if (alignment == _alignment) {
+ return;
+ }
+
begin_change ();
_alignment = alignment;
@@ -261,6 +269,10 @@ Text::set_font_description (Pango::FontDescription font_description)
void
Text::set_color (Color color)
{
+ if (color == _color) {
+ return;
+ }
+
begin_change ();
_color = color;