summaryrefslogtreecommitdiff
path: root/plugin/drumgizmo_plugin.cc
diff options
context:
space:
mode:
authorAndré Nusser <andre.nusser@googlemail.com>2017-05-20 22:19:43 +0200
committerAndré Nusser <andre.nusser@googlemail.com>2017-05-20 22:19:43 +0200
commitf9372b88e6bfec45ff1d7582425d5bee585849d5 (patch)
tree0172d8ba69a0bf4f586f759291f704fe72982329 /plugin/drumgizmo_plugin.cc
parent54838a283cd4fdfd5a1a44c5ef6ca0051872f107 (diff)
Fix lazy evaluation issue in drumgizmo_plugin.cc
Diffstat (limited to 'plugin/drumgizmo_plugin.cc')
-rw-r--r--plugin/drumgizmo_plugin.cc32
1 files changed, 16 insertions, 16 deletions
diff --git a/plugin/drumgizmo_plugin.cc b/plugin/drumgizmo_plugin.cc
index 2b7f4b9..19b0b89 100644
--- a/plugin/drumgizmo_plugin.cc
+++ b/plugin/drumgizmo_plugin.cc
@@ -207,30 +207,30 @@ void DrumGizmoPlugin::onInlineRedraw(std::size_t width,
bool show_image{false};
std::size_t height = 0;
- if(bar_height <= max_height) {
+ if(bar_height <= max_height)
+ {
show_bar = true;
height += bar_height;
}
- if(bar_height + image_height <= max_height) {
+ if(bar_height + image_height <= max_height)
+ {
show_image = true;
height += image_height;
}
+ // They have to be called seperately to avoid lazy evaluation
+ bool nof_changed = settingsGetter.number_of_files.hasChanged();
+ bool nofl_changed = settingsGetter.number_of_files_loaded.hasChanged();
+ bool dls_changed = settingsGetter.drumkit_load_status.hasChanged();
+
bool context_needs_update =
- !context.data ||
- context.width != width ||
- context.height != height;
- bool bar_needs_update =
- settingsGetter.number_of_files.hasChanged() ||
- settingsGetter.number_of_files_loaded.hasChanged() ||
- settingsGetter.drumkit_load_status.hasChanged() ||
- context_needs_update;
+ !context.data || context.width != width || context.height != height;
+ bool bar_needs_update =
+ nof_changed || nofl_changed || dls_changed || context_needs_update;
bool image_needs_update = inline_image_first_draw || context_needs_update;
- // TODO: settingsGetter.inline_image_filename.hasChanged();
+ // TODO: settingsGetter.inline_image_filename.hasChanged();
bool something_needs_update =
- context_needs_update ||
- bar_needs_update ||
- image_needs_update;
+ context_needs_update || bar_needs_update || image_needs_update;
if (something_needs_update)
{
@@ -297,7 +297,7 @@ bool DrumGizmoPlugin::hasGUI()
return true;
}
-void* DrumGizmoPlugin::createWindow(void *parent)
+void* DrumGizmoPlugin::createWindow(void* parent)
{
plugin_gui = std::make_shared<GUI::MainWindow>(settings, parent);
resizeWindow(width, height);
@@ -434,7 +434,7 @@ void DrumGizmoPlugin::Output::pre(size_t nsamples)
}
}
-void DrumGizmoPlugin::Output::run(int ch, sample_t *samples, size_t nsamples)
+void DrumGizmoPlugin::Output::run(int ch, sample_t* samples, size_t nsamples)
{
assert(plugin.output_samples);