diff options
author | Bent Bisballe Nyeng <deva@aasimon.org> | 2020-03-07 19:06:38 +0100 |
---|---|---|
committer | Bent Bisballe Nyeng <deva@aasimon.org> | 2020-03-07 19:06:38 +0100 |
commit | 365c6da71716c90730a5ca714edda264d0d6f93c (patch) | |
tree | c4cc605f5d6828a9c0e3fce45bd3076d68da5427 /plugin/drumgizmo_plugin.cc | |
parent | 50df3343adf8e0764934f09438d8ccfaa6dc33e9 (diff) |
Fix inline display flickering while loading.
Diffstat (limited to 'plugin/drumgizmo_plugin.cc')
-rw-r--r-- | plugin/drumgizmo_plugin.cc | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/plugin/drumgizmo_plugin.cc b/plugin/drumgizmo_plugin.cc index e7bc29e..494be4e 100644 --- a/plugin/drumgizmo_plugin.cc +++ b/plugin/drumgizmo_plugin.cc @@ -235,10 +235,15 @@ void DrumGizmoPlugin::onInlineRedraw(std::size_t width, bool nofl_changed = settingsGetter.number_of_files_loaded.hasChanged(); bool dls_changed = settingsGetter.drumkit_load_status.hasChanged(); + bool in_progress = + settingsGetter.number_of_files_loaded.getValue() < + settingsGetter.number_of_files.getValue(); + bool context_needs_update = !context.data || context.width != width || context.height != height; bool bar_needs_update = - nof_changed || nofl_changed || dls_changed || context_needs_update; + nof_changed || nofl_changed || dls_changed || context_needs_update | + in_progress; // Always update while loading to prevent flickering. bool image_needs_update = inline_image_first_draw || context_needs_update; // TODO: settingsGetter.inline_image_filename.hasChanged(); bool something_needs_update = @@ -254,15 +259,15 @@ void DrumGizmoPlugin::onInlineRedraw(std::size_t width, InlineCanvas canvas(context); GUI::Painter painter(canvas); + double progress = + (double)settingsGetter.number_of_files_loaded.getValue() / + (double)settingsGetter.number_of_files.getValue(); + if(show_bar && bar_needs_update) { box.setSize(context.width, bar_height); painter.drawImage(0, height - bar_height, box); - double progress = - (double)settingsGetter.number_of_files_loaded.getValue() / - (double)settingsGetter.number_of_files.getValue(); - int brd = 4; int val = (width - (2 * brd)) * progress; |