13
0

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.
This commit is contained in:
Robin Gareus 2020-05-12 13:22:11 +02:00
parent 58a5e256a9
commit b36e6b8341
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04

View File

@ -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 ();
}
}
}