X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=libs%2Fgtkmm2ext%2Ffastmeter.cc;h=c144a963bbd673df7e6734a1b998140f3a8278c6;hb=0eb509ac2e023b556a43017c0d018be972b10673;hp=df3f09735e8be6c002e7dc953a398debe4f95396;hpb=8c9749e42faf7808034ed8b7afce4a2fe6dc6f33;p=ardour.git diff --git a/libs/gtkmm2ext/fastmeter.cc b/libs/gtkmm2ext/fastmeter.cc index df3f09735e..c144a963bb 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,7 +723,9 @@ 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; }