13
0

test diff for patch change performance when caching colours.

This commit is contained in:
nick_m 2016-12-14 04:05:08 +11:00
parent c518bc3fb7
commit 176625d9e0
4 changed files with 26 additions and 6 deletions

View File

@ -126,6 +126,10 @@ MidiRegionView::MidiRegionView (ArdourCanvas::Container* parent,
, _mouse_changed_selection (false)
{
CANVAS_DEBUG_NAME (_note_group, string_compose ("note group for %1", get_item_name()));
_patch_change_outline = UIConfiguration::instance().color ("midi patch change outline");
_patch_change_fill = UIConfiguration::instance().color_mod ("midi patch change fill", "midi patch change fill");
_note_group->raise_to_top();
PublicEditor::DropDownKeys.connect (sigc::mem_fun (*this, &MidiRegionView::drop_down_keys));
@ -169,6 +173,10 @@ MidiRegionView::MidiRegionView (ArdourCanvas::Container* parent,
, _mouse_changed_selection (false)
{
CANVAS_DEBUG_NAME (_note_group, string_compose ("note group for %1", get_item_name()));
_patch_change_outline = UIConfiguration::instance().color ("midi patch change outline");
_patch_change_fill = UIConfiguration::instance().color_mod ("midi patch change fill", "midi patch change fill");
_note_group->raise_to_top();
PublicEditor::DropDownKeys.connect (sigc::mem_fun (*this, &MidiRegionView::drop_down_keys));
@ -1880,14 +1888,16 @@ MidiRegionView::add_canvas_patch_change (MidiModel::PatchChangePtr patch, const
// so we need to do something more sophisticated to keep its color
// appearance (MidiPatchChangeFill/MidiPatchChangeInactiveChannelFill)
// up to date.
boost::shared_ptr<PatchChange> patch_change = boost::shared_ptr<PatchChange>(
new PatchChange(*this, group,
displaytext,
height,
x, 1.0,
instrument_info(),
patch));
patch,
_patch_change_outline,
_patch_change_fill)
);
if (patch_change->item().width() < _pixel_width) {
// Show unless patch change is beyond the region bounds
@ -3830,6 +3840,9 @@ MidiRegionView::color_handler ()
{
RegionView::color_handler ();
_patch_change_outline = UIConfiguration::instance().color ("midi patch change outline");
_patch_change_fill = UIConfiguration::instance().color_mod ("midi patch change fill", "midi patch change fill");
for (Events::iterator i = _events.begin(); i != _events.end(); ++i) {
(*i)->set_selected ((*i)->selected()); // will change color
}

View File

@ -512,6 +512,9 @@ private:
bool _mouse_changed_selection;
ArdourCanvas::Color _patch_change_outline;
ArdourCanvas::Color _patch_change_fill;
Evoral::Beats snap_frame_to_grid_underneath (framepos_t p, int32_t divisions, bool shift_snap) const;
PBD::ScopedConnection _mouse_mode_connection;

View File

@ -49,7 +49,9 @@ PatchChange::PatchChange(MidiRegionView& region,
double x,
double y,
ARDOUR::InstrumentInfo& info,
ARDOUR::MidiModel::PatchChangePtr patch)
ARDOUR::MidiModel::PatchChangePtr patch,
ArdourCanvas::Color outline_color,
ArdourCanvas::Color fill_color)
: _region (region)
, _info (info)
, _patch (patch)
@ -58,8 +60,8 @@ PatchChange::PatchChange(MidiRegionView& region,
_flag = new ArdourCanvas::Flag (
parent,
height,
UIConfiguration::instance().color ("midi patch change outline"),
UIConfiguration::instance().color_mod ("midi patch change fill", "midi patch change fill"),
outline_color,
fill_color,
ArdourCanvas::Duple (x, y),
true);

View File

@ -40,7 +40,9 @@ public:
double x,
double y,
ARDOUR::InstrumentInfo& info,
ARDOUR::MidiModel::PatchChangePtr patch);
ARDOUR::MidiModel::PatchChangePtr patch,
ArdourCanvas::Color outline_color,
ArdourCanvas::Color fill_color);
~PatchChange();