X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;ds=sidebyside;f=libs%2Fgtkmm2ext%2Ffastmeter.cc;h=f3928910bca7de037c783fdb4e19535ccbb69886;hb=aeb1c7121136008fad747d371b756314a3f7e944;hp=df3f09735e8be6c002e7dc953a398debe4f95396;hpb=23e7cf10191270d70357ccf0ed9294f020c7b7ab;p=ardour.git diff --git a/libs/gtkmm2ext/fastmeter.cc b/libs/gtkmm2ext/fastmeter.cc index df3f09735e..f3928910bc 100644 --- a/libs/gtkmm2ext/fastmeter.cc +++ b/libs/gtkmm2ext/fastmeter.cc @@ -133,6 +133,14 @@ FastMeter::~FastMeter () { } +void +FastMeter::flush_pattern_cache () { + hb_pattern_cache.clear(); + hm_pattern_cache.clear(); + vb_pattern_cache.clear(); + vm_pattern_cache.clear(); +} + Cairo::RefPtr FastMeter::generate_meter_pattern ( int width, int height, int *clr, float *stp, int styleflags, bool horiz) @@ -222,7 +230,10 @@ FastMeter::generate_meter_pattern ( cairo_set_line_width(tc, 1.0); cairo_set_source_rgba(tc, .0, .0, .0, 0.4); //cairo_set_operator (tc, CAIRO_OPERATOR_SOURCE); - for (float y=0.5; y < height; y+= 2.0) { + for (int i = 0; float y = 0.5 + i * 2.0; ++i) { + if (y >= height) { + break; + } cairo_move_to(tc, 0, y); cairo_line_to(tc, width, y); cairo_stroke (tc); @@ -712,13 +723,15 @@ FastMeter::set (float lvl, float peak) current_level = lvl; - if (current_level == old_level && current_peak == old_peak && (hold_state == 0 || peak != -1)) { + const float pixscale = (orientation == Vertical) ? pixheight : pixwidth; +#define PIX(X) floor(pixscale * (X)) + if (PIX(current_level) == PIX(old_level) && PIX(current_peak) == PIX(old_peak) && (hold_state == 0 || peak != -1)) { return; } Glib::RefPtr win; - if ((win = get_window()) == 0) { + if (! (win = get_window())) { queue_draw (); return; }