summaryrefslogtreecommitdiff
path: root/gtk2_ardour/note_base.h
diff options
context:
space:
mode:
authornick_m <mainsbridge@gmail.com>2016-10-17 03:19:02 +1100
committernick_m <mainsbridge@gmail.com>2016-10-17 03:19:02 +1100
commitbf5933add60846818219402ebef0b0b47c7ce5f5 (patch)
tree9c557fc5e340cab95bf54575cfa9defe73860a5f /gtk2_ardour/note_base.h
parentbcea5fc9d366f478622a13d8f587ebcf0e8d13e9 (diff)
Performance: store NoteBase UIConfiguration colors between config changes.
Cumulative time in percent while wiggling the tempo lines rapidly. Before: MidiRegionview::update_sustained 12.02 NoteBase::base_color 6.43 MidiGhostRegion::update_note 3.12 Note::set 1.27 TempoMap::frame_at_quarter_note 0.59 _dynamic_cast 0.13 After: MidiRegionview::update_sustained 10.49 MidiGhostRegion::update_note 5.57 Note::set 2.52 TempoMap::frame_at_quarter_note 1.13 NoteBase::base_color 0.17 _dynamic_cast 0.17
Diffstat (limited to 'gtk2_ardour/note_base.h')
-rw-r--r--gtk2_ardour/note_base.h22
1 files changed, 14 insertions, 8 deletions
diff --git a/gtk2_ardour/note_base.h b/gtk2_ardour/note_base.h
index d55f87c552..54c53ff6d2 100644
--- a/gtk2_ardour/note_base.h
+++ b/gtk2_ardour/note_base.h
@@ -100,18 +100,16 @@ class NoteBase : public sigc::trackable
const boost::shared_ptr<NoteType> note() const { return _note; }
MidiRegionView& region_view() const { return _region; }
+ static void set_colors ();
+
inline static uint32_t meter_style_fill_color(uint8_t vel, bool selected) {
if (selected) {
- return UIConfiguration::instance().color_mod ("midi note selected", "midi note");
+ return _selected_mod_col;
} else if (vel < 64) {
- return UINT_INTERPOLATE(
- UIConfiguration::instance().color_mod ("midi note min", "midi note"),
- UIConfiguration::instance().color_mod ("midi note mid", "midi note"),
+ return UINT_INTERPOLATE(_min_col, _mid_col,
(vel / (double)63.0));
} else {
- return UINT_INTERPOLATE(
- UIConfiguration::instance().color_mod ("midi note mid", "midi note"),
- UIConfiguration::instance().color_mod ("midi note max", "midi note"),
+ return UINT_INTERPOLATE(_mid_col, _max_col,
((vel-64) / (double)63.0));
}
}
@@ -119,7 +117,7 @@ class NoteBase : public sigc::trackable
/// calculate outline colors from fill colors of notes
inline static uint32_t calculate_outline(uint32_t color, bool selected=false) {
if (selected) {
- return UIConfiguration::instance().color ("midi note selected outline");
+ return _selected_outline_col;
} else {
return UINT_INTERPOLATE(color, 0x000000ff, 0.5);
}
@@ -150,6 +148,14 @@ protected:
private:
bool event_handler (GdkEvent *);
+
+ static uint32_t _selected_mod_col;
+ static uint32_t _selected_outline_col;
+ static uint32_t _selected_col;
+ static uint32_t _min_col;
+ static uint32_t _mid_col;
+ static uint32_t _max_col;
+ static bool _color_init;
};
#endif /* __gtk_ardour_note_h__ */