Further small speedup for filebrowser

This commit is contained in:
Ingo Weyrich 2019-07-17 22:10:46 +02:00
parent bbdd774afb
commit 2ca9f7f94d

View File

@ -18,7 +18,7 @@
*/ */
#include "lwbuttonset.h" #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; w = 0;
h = 0; h = 0;
for (size_t i = 0; i < buttons.size(); i++) { for (const auto entry : buttons) {
int bw, bh; int bw, bh;
buttons[i]->getSize (bw, bh); entry->getSize(bw, bh);
w += bw; w += bw;
h = std::max(bh, h);
if (bh > h) {
h = bh;
}
} }
} }
void LWButtonSet::arrangeButtons (int x, int y, int w, int 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; int mw, mh;
getMinimalDimensions (mw, mh); getMinimalDimensions (mw, mh);