summaryrefslogtreecommitdiff
path: root/libs/widgets
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2019-08-26 23:34:20 +0200
committerRobin Gareus <robin@gareus.org>2019-08-26 23:34:20 +0200
commitb4addaaa0a4cbacb10cc80aded64cdc126545f8c (patch)
tree95266bb67075f1b839bea1e901bdd18b5a9c5850 /libs/widgets
parent2dbeaaffa6c08da9cb0ddc86128f71f4967424ec (diff)
Tweak icon_strip_width icon lines to align to pixels
Diffstat (limited to 'libs/widgets')
-rw-r--r--libs/widgets/ardour_icon.cc31
1 files changed, 16 insertions, 15 deletions
diff --git a/libs/widgets/ardour_icon.cc b/libs/widgets/ardour_icon.cc
index ada11e26be..32ad1d1b8d 100644
--- a/libs/widgets/ardour_icon.cc
+++ b/libs/widgets/ardour_icon.cc
@@ -932,22 +932,22 @@ static void icon_nudge_right (cairo_t *cr, const int width, const int height, co
/** mixer strip narrow/wide */
static void icon_strip_width (cairo_t *cr, const int width, const int height, const uint32_t fg_color)
{
- const double x0 = width * .2;
- const double x1 = width * .8;
+ const double xm = .5 + rint (width * .5);
+ const double ym = .5 + rint (height * .5);
- const double y0 = height * .25;
- const double y1 = height * .75;
+ const double dx = ceil (width * .3);
+ const double dy = ceil (height * .25);
- const double ym = height * .5;
+ const double x0 = xm - dx;
+ const double x1 = xm + dx;
+ const double y0 = ym - dy;
+ const double y1 = ym + dy;
- // arrow
- const double xa0= width * .39;
- const double xa1= width * .61;
- const double ya0= height * .35;
- const double ya1= height * .65;
+ const double arx = width * .15;
+ const double ary = height * .15;
Gtkmm2ext::set_source_rgba (cr, fg_color);
- cairo_set_line_width (cr, ceil (std::min (width, width) * .035));
+ cairo_set_line_width (cr, ceil (std::min (width, height) * .035));
// left + right
cairo_move_to (cr, x0, y0);
@@ -961,15 +961,15 @@ static void icon_strip_width (cairo_t *cr, const int width, const int height, co
// arrow left
cairo_move_to (cr, x0, ym);
- cairo_line_to (cr, xa0, ya0);
+ cairo_rel_line_to (cr, arx, -ary);
cairo_move_to (cr, x0, ym);
- cairo_line_to (cr, xa0, ya1);
+ cairo_rel_line_to (cr, arx, ary);
// arrow right
cairo_move_to (cr, x1, ym);
- cairo_line_to (cr, xa1, ya0);
+ cairo_rel_line_to (cr, -arx, -ary);
cairo_move_to (cr, x1, ym);
- cairo_line_to (cr, xa1, ya1);
+ cairo_rel_line_to (cr, -arx, ary);
cairo_stroke (cr);
}
@@ -1298,6 +1298,7 @@ ArdourWidgets::ArdourIcon::render (cairo_t *cr,
icon_tav_expand (cr, width, height);
break;
case ToolRange:
+ /* similar to icon_strip_width() but with outline */
icon_tool_range (cr, width, height);
break;
case ToolGrab: