X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;ds=sidebyside;f=libs%2Fgtkmm2ext%2Fpixfader.cc;h=64ee449646e5f310d824258bccd61a29d6150933;hb=dcf852aae41a2d407f770324f30a5b5138a51039;hp=1e814fd147517b6aa6b0b2ae77f7a06e28cc0004;hpb=57ce447fd19bd794afe90748d466bbe172c2eab0;p=ardour.git diff --git a/libs/gtkmm2ext/pixfader.cc b/libs/gtkmm2ext/pixfader.cc index 1e814fd147..64ee449646 100644 --- a/libs/gtkmm2ext/pixfader.cc +++ b/libs/gtkmm2ext/pixfader.cc @@ -85,6 +85,15 @@ PixFader::~PixFader () if (_layout) _layout.clear (); // drop reference to existing layout } +void +PixFader::flush_pattern_cache () { + for (list::iterator f = _patterns.begin(); f != _patterns.end(); ++f) { + cairo_pattern_destroy ((*f)->pattern); + } + _patterns.clear(); +} + + cairo_pattern_t* PixFader::find_pattern (double afr, double afg, double afb, double abr, double abg, double abb, @@ -347,6 +356,9 @@ PixFader::on_size_request (GtkRequisition* req) void PixFader::on_size_allocate (Gtk::Allocation& alloc) { + int old_girth = _girth; + int old_span = _span; + CairoWidget::on_size_allocate(alloc); if (_orien == VERT) { @@ -357,7 +369,7 @@ PixFader::on_size_allocate (Gtk::Allocation& alloc) _span = alloc.get_width (); } - if (is_realized()) { + if (is_realized() && ((old_girth != _girth) || (old_span != _span))) { /* recreate patterns in case we've changed size */ create_patterns (); } @@ -700,7 +712,7 @@ PixFader::on_style_changed (const Glib::RefPtr&) _text = ""; set_text (txt, _centered_text, false); } - /* patterns are cached and re-created as needed + /* patterns are cached and re-created as needed * during 'expose' in the GUI thread */ _pattern = 0; queue_draw ();