diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2014-12-31 06:52:47 -0500 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2014-12-31 07:20:48 -0500 |
commit | d8405e2ebe4b7250fb8eaaad7166f0e81479e0d7 (patch) | |
tree | 574d0ce0942ab213bed4284a95f69cd2a09b4151 /gtk2_ardour/audio_clock.cc | |
parent | 168d1879943859653e197237e9baf57f3feb909e (diff) |
add the ability to use cairo scaling to warp the rendering of the main clock text
Diffstat (limited to 'gtk2_ardour/audio_clock.cc')
-rw-r--r-- | gtk2_ardour/audio_clock.cc | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/gtk2_ardour/audio_clock.cc b/gtk2_ardour/audio_clock.cc index 4eb8a2e8aa..ae170b8548 100644 --- a/gtk2_ardour/audio_clock.cc +++ b/gtk2_ardour/audio_clock.cc @@ -95,6 +95,8 @@ AudioClock::AudioClock (const string& clock_name, bool transient, const string& , last_sdelta (0) , dragging (false) , drag_field (Field (0)) + , xscale (1.0) + , yscale (1.0) { set_flags (CAN_FOCUS); @@ -278,6 +280,15 @@ AudioClock::set_colors () } void +AudioClock::set_scale (double x, double y) +{ + xscale = x; + yscale = y; + + queue_draw (); +} + +void AudioClock::render (cairo_t* cr, cairo_rectangle_t*) { /* main layout: rounded rect, plus the text */ @@ -296,10 +307,22 @@ AudioClock::render (cairo_t* cr, cairo_rectangle_t*) cairo_fill (cr); } - cairo_move_to (cr, (get_width() - layout_width) / 2.0, (upper_height - layout_height) / 2.0); + double lw = layout_width * xscale; + double lh = layout_height * yscale; + cairo_move_to (cr, (get_width() - lw) / 2.0, (upper_height - lh) / 2.0); + + if (xscale != 1.0 || yscale != 1.0) { + cairo_save (cr); + cairo_scale (cr, xscale, yscale); + } + pango_cairo_show_layout (cr, _layout->gobj()); + if (xscale != 1.0 || yscale != 1.0) { + cairo_restore (cr); + } + if (_left_layout) { double h = get_height() - upper_height - separator_height; |