diff options
author | Robin Gareus <robin@gareus.org> | 2020-05-12 13:22:11 +0200 |
---|---|---|
committer | Robin Gareus <robin@gareus.org> | 2020-05-12 13:22:11 +0200 |
commit | b36e6b8341ef8e044b1fbadd9462c454a82b85e3 (patch) | |
tree | 56f67feb4e0beedb9d0fc270f0652c86f963a477 /libs/widgets/ardour_button.cc | |
parent | 58a5e256a9df97903b59f53f43aef6e4a52febcc (diff) |
Optimize drawing of buttons with changing text
When a button has a fixed size, there's no need to call queue_resize().
This fixes an issue with the ArdourClock info displays when slaved.
The Timecode and Delta display text changes in small intervals and
caused excessive CPU load due to GUI size-requests + redraws.
Diffstat (limited to 'libs/widgets/ardour_button.cc')
-rw-r--r-- | libs/widgets/ardour_button.cc | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/libs/widgets/ardour_button.cc b/libs/widgets/ardour_button.cc index 4c1ac05a93..a0000e4dc6 100644 --- a/libs/widgets/ardour_button.cc +++ b/libs/widgets/ardour_button.cc @@ -212,7 +212,12 @@ ArdourButton::set_text (const std::string& str, bool markup) set_text_internal (); /* on_size_request() will fill in _text_width/height * so queue it even if _sizing_text != "" */ - queue_resize (); + if (_sizing_text.empty ()) { + queue_resize (); + } else { + _layout->get_pixel_size (_text_width, _text_height); + CairoWidget::set_dirty (); + } } } |