summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2017-01-19 00:22:05 +0100
committerPaul Davis <paul@linuxaudiosystems.com>2017-01-19 00:24:54 +0100
commitf6061b32b26384ff7ff3858926089230b5219015 (patch)
tree967d2937cf1ab9769ea051ed472f2501a2e70511
parentc91c028c376625c1a842d75119af6251fb5df810 (diff)
fix code for ArdourButton so that an existing translation component to the cairo transformation matrix is honored correctly
-rw-r--r--gtk2_ardour/ardour_button.cc18
1 files changed, 13 insertions, 5 deletions
diff --git a/gtk2_ardour/ardour_button.cc b/gtk2_ardour/ardour_button.cc
index 5522f01bcd..470cafa2eb 100644
--- a/gtk2_ardour/ardour_button.cc
+++ b/gtk2_ardour/ardour_button.cc
@@ -382,7 +382,7 @@ ArdourButton::render (cairo_t* cr, cairo_rectangle_t *)
// Text, if any
if (!_pixbuf && ((_elements & Text)==Text) && !_text.empty()) {
assert(_layout);
-#if 0 // DEBUG style (print on hover)
+#if 1 // DEBUG style (print on hover)
if (_hovering || (_elements & Inactive)) {
bool layout_font = true;
Pango::FontDescription fd = _layout->get_font_description();
@@ -428,8 +428,17 @@ ArdourButton::render (cairo_t* cr, cairo_rectangle_t *)
ww = get_width();
wh = get_height();
- cairo_save (cr);
- cairo_rotate(cr, _angle * M_PI / 180.0);
+ cairo_matrix_t m1;
+ cairo_get_matrix (cr, &m1);
+ cairo_matrix_t m2 = m1;
+ m2.x0 = 0;
+ m2.y0 = 0;
+ cairo_set_matrix (cr, &m2);
+
+ if (_angle) {
+ cairo_rotate(cr, _angle * M_PI / 180.0);
+ }
+
cairo_device_to_user(cr, &ww, &wh);
xa = text_margin + (ww - _text_width - 2 * text_margin) * _xalign;
ya = (wh - _text_height) * _yalign;
@@ -440,10 +449,9 @@ ArdourButton::render (cairo_t* cr, cairo_rectangle_t *)
*/
if (_xalign < 0) xa = ceil(.5 + (ww * fabs(_xalign) + text_margin));
- cairo_move_to (cr, xa, ya);
+ cairo_move_to (cr, xa + m1.x0, ya + m1.y0);
pango_cairo_update_layout(cr, _layout->gobj());
pango_cairo_show_layout (cr, _layout->gobj());
- cairo_restore (cr);
}
cairo_restore (cr);
}