From 2ca9f7f94d94a808670fb81a13e3945084a023b9 Mon Sep 17 00:00:00 2001 From: Ingo Weyrich Date: Wed, 17 Jul 2019 22:10:46 +0200 Subject: [PATCH] Further small speedup for filebrowser --- rtgui/lwbuttonset.cc | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/rtgui/lwbuttonset.cc b/rtgui/lwbuttonset.cc index 6265c1039..1337c0ea5 100644 --- a/rtgui/lwbuttonset.cc +++ b/rtgui/lwbuttonset.cc @@ -18,7 +18,7 @@ */ #include "lwbuttonset.h" -LWButtonSet::LWButtonSet () : aw(0), ah(0), ax(0), ay(0) +LWButtonSet::LWButtonSet () : aw(0), ah(0), ax(-1), ay(-1) { } @@ -42,20 +42,21 @@ void LWButtonSet::getMinimalDimensions (int& w, int& h) w = 0; h = 0; - for (size_t i = 0; i < buttons.size(); i++) { + for (const auto entry : buttons) { int bw, bh; - buttons[i]->getSize (bw, bh); + entry->getSize(bw, bh); w += bw; - - if (bh > h) { - h = bh; - } + h = std::max(bh, h); } } void LWButtonSet::arrangeButtons (int x, int y, int w, int h) { + if (x == ax && y == ay && w == aw && ((h == -1 && ah == 0) || h == ah )) { + return; + } + int mw, mh; getMinimalDimensions (mw, mh);