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"
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);