cairo single pixel line offset fix, part 2
This will need careful visual inspection of the items drawn by the affected code to make sure they are still precisely as intended
This commit is contained in:
parent
4c845eb2a0
commit
ec7d502959
|
@ -86,7 +86,7 @@ EditorCursor::set_position (samplepos_t sample)
|
||||||
double const new_pos = _editor.sample_to_pixel_unrounded (sample);
|
double const new_pos = _editor.sample_to_pixel_unrounded (sample);
|
||||||
|
|
||||||
if (rint(new_pos) != rint(_track_canvas_item->x ())) {
|
if (rint(new_pos) != rint(_track_canvas_item->x ())) {
|
||||||
_track_canvas_item->set_x (new_pos-0.5); //accommodate the 1/2 pixel "line" offset in cairo
|
_track_canvas_item->set_x (new_pos + 0.5); //accommodate the 1/2 pixel "line" offset in cairo
|
||||||
}
|
}
|
||||||
|
|
||||||
_current_sample = sample;
|
_current_sample = sample;
|
||||||
|
|
|
@ -636,10 +636,10 @@ MiniTimeline::render (Cairo::RefPtr<Cairo::Context> const& ctx, cairo_rectangle_
|
||||||
cairo_set_line_width (cr, 1.0);
|
cairo_set_line_width (cr, 1.0);
|
||||||
double r,g,b,a; Gtkmm2ext::color_to_rgba(_phead_color, r,g,b,a);
|
double r,g,b,a; Gtkmm2ext::color_to_rgba(_phead_color, r,g,b,a);
|
||||||
cairo_set_source_rgb (cr, r,g,b); // playhead color
|
cairo_set_source_rgb (cr, r,g,b); // playhead color
|
||||||
cairo_move_to (cr, xc - .5, 0);
|
cairo_move_to (cr, xc + .5, 0);
|
||||||
cairo_rel_line_to (cr, 0, height);
|
cairo_rel_line_to (cr, 0, height);
|
||||||
cairo_stroke (cr);
|
cairo_stroke (cr);
|
||||||
cairo_move_to (cr, xc - .5, height);
|
cairo_move_to (cr, xc + .5, height);
|
||||||
cairo_rel_line_to (cr, -3, 0);
|
cairo_rel_line_to (cr, -3, 0);
|
||||||
cairo_rel_line_to (cr, 3, -4);
|
cairo_rel_line_to (cr, 3, -4);
|
||||||
cairo_rel_line_to (cr, 3, 4);
|
cairo_rel_line_to (cr, 3, 4);
|
||||||
|
|
|
@ -207,7 +207,7 @@ MonoPanner::on_expose_event (GdkEventExpose*)
|
||||||
|
|
||||||
/* right box */
|
/* right box */
|
||||||
rounded_right_half_rectangle (context,
|
rounded_right_half_rectangle (context,
|
||||||
right - half_lr_box - .5,
|
right - half_lr_box + .5,
|
||||||
half_lr_box + step_down,
|
half_lr_box + step_down,
|
||||||
lr_box_size, lr_box_size, corner_radius);
|
lr_box_size, lr_box_size, corner_radius);
|
||||||
context->set_source_rgba (UINT_RGBA_R_FLT(f), UINT_RGBA_G_FLT(f), UINT_RGBA_B_FLT(f), UINT_RGBA_A_FLT(f));
|
context->set_source_rgba (UINT_RGBA_R_FLT(f), UINT_RGBA_G_FLT(f), UINT_RGBA_B_FLT(f), UINT_RGBA_A_FLT(f));
|
||||||
|
|
|
@ -331,8 +331,8 @@ PianoRollHeader::on_expose_event (GdkEventExpose* ev)
|
||||||
cr->move_to (0.5f, rect.y);
|
cr->move_to (0.5f, rect.y);
|
||||||
cr->line_to (0.5f, rect.y + rect.height);
|
cr->line_to (0.5f, rect.y + rect.height);
|
||||||
cr->stroke ();
|
cr->stroke ();
|
||||||
cr->move_to (get_width () - 0.5f, rect.y);
|
cr->move_to (get_width () + 0.5f, rect.y);
|
||||||
cr->line_to (get_width () - 0.5f, rect.y + rect.height);
|
cr->line_to (get_width () + 0.5f, rect.y + rect.height);
|
||||||
cr->stroke ();
|
cr->stroke ();
|
||||||
|
|
||||||
//pat->add_color_stop_rgb(0.0, 0.33, 0.33, 0.33);
|
//pat->add_color_stop_rgb(0.0, 0.33, 0.33, 0.33);
|
||||||
|
@ -446,7 +446,7 @@ PianoRollHeader::on_expose_event (GdkEventExpose* ev)
|
||||||
/* render the name of which C this is */
|
/* render the name of which C this is */
|
||||||
if (oct_rel == 0) {
|
if (oct_rel == 0) {
|
||||||
std::stringstream s;
|
std::stringstream s;
|
||||||
double y = floor (_view.note_to_y (i)) - 0.5f;
|
double y = floor (_view.note_to_y (i)) + 0.5f;
|
||||||
double note_height = floor (_view.note_to_y (i - 1)) - y;
|
double note_height = floor (_view.note_to_y (i - 1)) - y;
|
||||||
|
|
||||||
int cn = i / 12 - 1;
|
int cn = i / 12 - 1;
|
||||||
|
|
|
@ -197,12 +197,12 @@ PluginLoadStatsGui::draw_bar (GdkEventExpose* ev)
|
||||||
|
|
||||||
const int dx = w * i / 9.; // == DEFLECT (v)
|
const int dx = w * i / 9.; // == DEFLECT (v)
|
||||||
|
|
||||||
cairo_move_to (cr, x0 + dx - .5, y0);
|
cairo_move_to (cr, x0 + dx + .5, y0);
|
||||||
cairo_line_to (cr, x0 + dx - .5, y1);
|
cairo_line_to (cr, x0 + dx + .5, y1);
|
||||||
cairo_set_source_rgba (cr, 1., 1., 1., 1.);
|
cairo_set_source_rgba (cr, 1., 1., 1., 1.);
|
||||||
cairo_stroke (cr);
|
cairo_stroke (cr);
|
||||||
|
|
||||||
cairo_move_to (cr, x0 + dx - .5 * text_width, y1 + 1);
|
cairo_move_to (cr, x0 + dx + .5 * text_width, y1 + 1);
|
||||||
cairo_set_source_rgb (cr, fg.get_red_p (), fg.get_green_p (), fg.get_blue_p ());
|
cairo_set_source_rgb (cr, fg.get_red_p (), fg.get_green_p (), fg.get_blue_p ());
|
||||||
pango_cairo_show_layout (cr, layout->gobj ());
|
pango_cairo_show_layout (cr, layout->gobj ());
|
||||||
}
|
}
|
||||||
|
@ -225,7 +225,7 @@ PluginLoadStatsGui::draw_bar (GdkEventExpose* ev)
|
||||||
double xd0 = DEFLECT((_avg - _dev) / 1000.);
|
double xd0 = DEFLECT((_avg - _dev) / 1000.);
|
||||||
double xd1 = DEFLECT((_avg + _dev) / 1000.);
|
double xd1 = DEFLECT((_avg + _dev) / 1000.);
|
||||||
|
|
||||||
cairo_move_to (cr, x0 + xavg - .5, y0 - 1);
|
cairo_move_to (cr, x0 + xavg + .5, y0 - 1);
|
||||||
cairo_rel_line_to (cr, -5, -5);
|
cairo_rel_line_to (cr, -5, -5);
|
||||||
cairo_rel_line_to (cr, 10, 0);
|
cairo_rel_line_to (cr, 10, 0);
|
||||||
cairo_close_path (cr);
|
cairo_close_path (cr);
|
||||||
|
|
|
@ -599,8 +599,8 @@ PluginEqGui::redraw_analysis_area ()
|
||||||
cairo_set_line_cap (cr, CAIRO_LINE_CAP_ROUND);
|
cairo_set_line_cap (cr, CAIRO_LINE_CAP_ROUND);
|
||||||
cairo_set_source_rgb (cr, 1.0, 1.0, 1.0);
|
cairo_set_source_rgb (cr, 1.0, 1.0, 1.0);
|
||||||
cairo_set_line_width (cr, 1.0);
|
cairo_set_line_width (cr, 1.0);
|
||||||
cairo_move_to (cr, _pointer_in_area_freq - .5, -.5);
|
cairo_move_to (cr, _pointer_in_area_freq + .5, +.5);
|
||||||
cairo_line_to (cr, _pointer_in_area_freq - .5, _analysis_height - .5);
|
cairo_line_to (cr, _pointer_in_area_freq + .5, _analysis_height + .5);
|
||||||
cairo_stroke (cr);
|
cairo_stroke (cr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -637,7 +637,7 @@ PluginEqGui::draw_scales_phase (Gtk::Widget*, cairo_t *cr)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
y = roundf (y) - .5;
|
y = roundf (y) + .5;
|
||||||
|
|
||||||
cairo_set_source_rgba (cr, .8, .9, .2, 0.4);
|
cairo_set_source_rgba (cr, .8, .9, .2, 0.4);
|
||||||
cairo_move_to (cr, 0.0, y);
|
cairo_move_to (cr, 0.0, y);
|
||||||
|
@ -654,7 +654,7 @@ PluginEqGui::draw_scales_phase (Gtk::Widget*, cairo_t *cr)
|
||||||
cairo_move_to (cr, _analysis_width - t_ext.width - t_ext.x_bearing - 2.0, y - extents.descent);
|
cairo_move_to (cr, _analysis_width - t_ext.width - t_ext.x_bearing - 2.0, y - extents.descent);
|
||||||
cairo_show_text (cr, buf);
|
cairo_show_text (cr, buf);
|
||||||
|
|
||||||
y = roundf (y) - .5;
|
y = roundf (y) + .5;
|
||||||
// line
|
// line
|
||||||
cairo_set_source_rgba (cr, .8, .9, .2, 0.4);
|
cairo_set_source_rgba (cr, .8, .9, .2, 0.4);
|
||||||
cairo_move_to (cr, 0.0, y);
|
cairo_move_to (cr, 0.0, y);
|
||||||
|
|
|
@ -853,11 +853,11 @@ PluginPinWidget::draw_plugin_pin (cairo_t* cr, const CtrlWidget& w)
|
||||||
layout->set_text (w.name);
|
layout->set_text (w.name);
|
||||||
layout->get_pixel_size (text_width, text_height);
|
layout->get_pixel_size (text_width, text_height);
|
||||||
|
|
||||||
rounded_rectangle (cr, w.x + dx - .5 * text_width - 2, w.y - text_height - 2, text_width + 4, text_height + 2, 7);
|
rounded_rectangle (cr, w.x + dx + .5 * text_width - 2, w.y - text_height - 2, text_width + 4, text_height + 2, 7);
|
||||||
cairo_set_source_rgba (cr, 0, 0, 0, .5);
|
cairo_set_source_rgba (cr, 0, 0, 0, .5);
|
||||||
cairo_fill (cr);
|
cairo_fill (cr);
|
||||||
|
|
||||||
cairo_move_to (cr, w.x + dx - .5 * text_width, w.y - text_height - 1);
|
cairo_move_to (cr, w.x + dx + .5 * text_width, w.y - text_height - 1);
|
||||||
cairo_set_source_rgba (cr, 1., 1., 1., 1.);
|
cairo_set_source_rgba (cr, 1., 1., 1., 1.);
|
||||||
pango_cairo_show_layout (cr, layout->gobj ());
|
pango_cairo_show_layout (cr, layout->gobj ());
|
||||||
}
|
}
|
||||||
|
@ -880,7 +880,7 @@ double
|
||||||
PluginPinWidget::pin_x_pos (uint32_t i, double x0, double width, uint32_t n_total, uint32_t n_midi, bool midi)
|
PluginPinWidget::pin_x_pos (uint32_t i, double x0, double width, uint32_t n_total, uint32_t n_midi, bool midi)
|
||||||
{
|
{
|
||||||
if (!midi) { i += n_midi; }
|
if (!midi) { i += n_midi; }
|
||||||
return rint (x0 + (i + 1) * width / (1. + n_total)) - .5;
|
return rint (x0 + (i + 1) * width / (1. + n_total)) + .5;
|
||||||
}
|
}
|
||||||
|
|
||||||
const PluginPinWidget::CtrlWidget&
|
const PluginPinWidget::CtrlWidget&
|
||||||
|
|
|
@ -1308,7 +1308,7 @@ ProcessorEntry::PortIcon::on_expose_event (GdkEventExpose* ev)
|
||||||
for (uint32_t i = 0; i < _ports.n_total(); ++i) {
|
for (uint32_t i = 0; i < _ports.n_total(); ++i) {
|
||||||
set_routing_color (cr, i < _ports.n_midi());
|
set_routing_color (cr, i < _ports.n_midi());
|
||||||
const double x = ProcessorEntry::RoutingIcon::pin_x_pos (i, width, _ports.n_total(), 0 , false);
|
const double x = ProcessorEntry::RoutingIcon::pin_x_pos (i, width, _ports.n_total(), 0 , false);
|
||||||
cairo_rectangle (cr, x - .5 - dx * .5, 0, 1 + dx, height);
|
cairo_rectangle (cr, x + .5 - dx * .5, 0, 1 + dx, height);
|
||||||
cairo_fill(cr);
|
cairo_fill(cr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1460,7 +1460,7 @@ void
|
||||||
ProcessorEntry::RoutingIcon::draw_sidechain (cairo_t* cr, double x0, double y0, double height, bool midi)
|
ProcessorEntry::RoutingIcon::draw_sidechain (cairo_t* cr, double x0, double y0, double height, bool midi)
|
||||||
{
|
{
|
||||||
const double dx = 1 + rint (max(2., 2. * UIConfiguration::instance().get_ui_scale()));
|
const double dx = 1 + rint (max(2., 2. * UIConfiguration::instance().get_ui_scale()));
|
||||||
const double y1 = rint (height * .5) - .5;
|
const double y1 = rint (height * .5) + .5;
|
||||||
|
|
||||||
cairo_save (cr);
|
cairo_save (cr);
|
||||||
cairo_translate (cr, x0, y0);
|
cairo_translate (cr, x0, y0);
|
||||||
|
|
|
@ -131,7 +131,7 @@ RegionPeakCursor::set (AudioRegionView* arv, samplepos_t when, samplecnt_t sampl
|
||||||
_canvas_text->set_x_position (xpos + 3);
|
_canvas_text->set_x_position (xpos + 3);
|
||||||
_canvas_text->set_y_position (pos.y + 3);
|
_canvas_text->set_y_position (pos.y + 3);
|
||||||
|
|
||||||
_canvas_line->set_x (xpos - 0.5);
|
_canvas_line->set_x (xpos + 0.5);
|
||||||
_canvas_line->set_y0 (pos.y);
|
_canvas_line->set_y0 (pos.y);
|
||||||
_canvas_line->set_y1 (pos.y + arv->height ());
|
_canvas_line->set_y1 (pos.y + arv->height ());
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue