From ee1c85879d1ac6175a745e6cfe2d4e3f63fb9583 Mon Sep 17 00:00:00 2001 From: Lawrence Lee Date: Sat, 10 Oct 2020 12:11:59 -0700 Subject: [PATCH] Suppress unnecessary updates to scope back buffer Upon the resize signal, the scope back buffers were redrawn, even if there was no actual change to the size. This commit checks the size and only updates the back buffers if the size changed. --- rtgui/histogrampanel.cc | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/rtgui/histogrampanel.cc b/rtgui/histogrampanel.cc index 63d299fa5..8742c8bb0 100644 --- a/rtgui/histogrampanel.cc +++ b/rtgui/histogrampanel.cc @@ -403,14 +403,19 @@ void HistogramPanel::showRGBBar() void HistogramPanel::resized (Gtk::Allocation& req) { + static int old_height = 0; + static int old_width = 0; - if (!histogramArea->updatePending()) { + bool size_changed = + old_height != req.get_height() || old_width != req.get_width(); + + if (!histogramArea->updatePending() && size_changed) { histogramArea->updateBackBuffer (); histogramArea->queue_draw (); } // set histogramRGBArea invalid; - if (histogramRGBArea) { + if (histogramRGBArea && size_changed) { histogramRGBArea->updateBackBuffer(-1, -1, -1); histogramRGBArea->queue_draw (); } @@ -418,6 +423,8 @@ void HistogramPanel::resized (Gtk::Allocation& req) // Store current height of the histogram options.histogramHeight = get_height(); + old_height = req.get_height(); + old_width = req.get_width(); } void HistogramPanel::red_toggled () @@ -589,7 +596,7 @@ void HistogramPanel::rgbv_toggled () if (histogramRGBArea) { updateHistRGBAreaOptions(); - histogramRGBArea->updateBackBuffer (0, 0, 0); + histogramRGBArea->updateBackBuffer(-1, -1, -1); histogramRGBArea->queue_draw (); } }