Crapola - this is an experimental performance hack that must be reverted.
authornick_m <mainsbridge@gmail.com>
Tue, 12 Apr 2016 19:38:31 +0000 (05:38 +1000)
committernick_m <mainsbridge@gmail.com>
Fri, 27 May 2016 13:38:14 +0000 (23:38 +1000)
gtk2_ardour/audio_region_view.cc
gtk2_ardour/midi_region_view.cc
gtk2_ardour/region_view.cc
gtk2_ardour/streamview.cc
gtk2_ardour/time_axis_view_item.cc
gtk2_ardour/time_axis_view_item.h
gtk2_ardour/time_info_box.cc
libs/ardour/playlist.cc
libs/canvas/text.cc

index 95345440cdb99eb7e38ff77d3eb30efbe206d79a..ca0e5c68a90e0ac99c50d1070dace59eee6f69ac 100644 (file)
@@ -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);
 
index 9aac06151d7e64e9c0a154e77672257ac90cf199..3fbe2c83fc1d874a3e3f13af240692113620e4ae 100644 (file)
@@ -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 ();
 
index 8f863a90d7aac7495b36c326e8cd0e261e07d16e..a2a4712b464064dedd5ea340b5f4c747fe2d3f9e 100644 (file)
@@ -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) {
index c737f7842ce0335a248bf5af970d45a91ee2996c..28dd1ab8f10c775dad6db99ff39fed09aa0b788d 100644 (file)
@@ -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 ();
index 008dfabe7eff2b6e0a4c436d056c2079139a5a7e..cc38d12855708cc312ba2c68b5e78998d26eb55b 100644 (file)
@@ -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
index 63cc56411c7300bf912a1d782354f5e03986f2c7..749df465a4ed76d45be08814be38772991e81215 100644 (file)
@@ -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 ();
index de31dafc76a925987a9f0efa390c9002f44e8b75..eccb4700629cf26814020548c1f1de1a7def9708 100644 (file)
@@ -187,7 +187,7 @@ TimeInfoBox::region_property_change (boost::shared_ptr<ARDOUR::Region> /* r */,
         * RegionView (not Region itself).
         */
 
-       selection_changed ();
+       //selection_changed ();
 }
 
 bool
index 3301fe9f9ece1a7305f1a6bebd7f5d84af8b4825..2e96dee063bdb21a3228953e2c9cf843191d879d 100644 (file)
@@ -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
index d1f76eb1a3ff84c6566dafabd913874faa148fd1..3b309e51df68827367f7832a620b22139b3ceae5 100644 (file)
@@ -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;