fix alignment of meter tick

This commit is contained in:
Robin Gareus 2013-07-05 04:26:35 +02:00
parent d4b1941796
commit c38898f1a6
2 changed files with 6 additions and 3 deletions

View file

@ -1054,17 +1054,20 @@ GainMeter::render_metrics (Gtk::Widget& w, vector<DataType> types)
for (vector<int>::const_iterator j = points.begin(); j != points.end(); ++j) {
gint pos;
float fraction = 0;
switch (*i) {
case DataType::AUDIO:
fraction = log_meter (*j);
pos = height - (gint) floor (height * fraction);
break;
case DataType::MIDI:
fraction = *j / 127.0;
pos = 1 + height - (gint) floor (height * fraction);
break;
}
gint const pos = 1 + height - (gint) floor (height * fraction);
float const linepos = min((float) height, (float)(pos + .5f));
cairo_set_line_width (cr, 1.0);

View file

@ -490,7 +490,7 @@ MeterStrip::render_metrics (Gtk::Widget& w, vector<DataType> types)
}
fraction = log_meter (j->first);
snprintf (buf, sizeof (buf), "%+2d", j->first);
pos = 1 + height - (gint) floor (height * fraction);
pos = height - (gint) floor (height * fraction);
cairo_move_to(cr, width-2.5, pos + .5);
cairo_line_to(cr, width, pos + .5);
cairo_stroke (cr);
@ -717,7 +717,7 @@ MeterStrip::render_ticks (Gtk::Widget& w, vector<DataType> types)
cairo_set_source_rgb (cr, c.get_red_p(), c.get_green_p(), c.get_blue_p());
}
fraction = log_meter (j->first);
pos = 1 + height - (gint) floor (height * fraction);
pos = height - (gint) floor (height * fraction);
cairo_move_to(cr, 0, pos + .5);
cairo_line_to(cr, 3, pos + .5);
cairo_stroke (cr);