summaryrefslogtreecommitdiff
path: root/src/gui/widgets/layout.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-08-17 16:34:36 +0300
committerAndrei Karas <akaras@inbox.ru>2012-08-17 16:34:36 +0300
commitc6c4eef4e49bb4de90845408af9f642a1a4e224b (patch)
tree81d192e85b3c075cb2e52671bea4c3c0499dc3f2 /src/gui/widgets/layout.cpp
parent093e392dd84c920d26bca17d48ac6611393d087c (diff)
downloadmv-c6c4eef4e49bb4de90845408af9f642a1a4e224b.tar.gz
mv-c6c4eef4e49bb4de90845408af9f642a1a4e224b.tar.bz2
mv-c6c4eef4e49bb4de90845408af9f642a1a4e224b.tar.xz
mv-c6c4eef4e49bb4de90845408af9f642a1a4e224b.zip
Improve size calculations.
Diffstat (limited to 'src/gui/widgets/layout.cpp')
-rw-r--r--src/gui/widgets/layout.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/gui/widgets/layout.cpp b/src/gui/widgets/layout.cpp
index 990937e06..b7856da81 100644
--- a/src/gui/widgets/layout.cpp
+++ b/src/gui/widgets/layout.cpp
@@ -338,6 +338,8 @@ void LayoutArray::reflow(int nx, int ny, int nw, int nh)
std::vector<int> widths = getSizes(0, nw);
std::vector<int> heights = getSizes(1, nh);
+ const int szW = static_cast<int>(widths.size());
+ const int szH = static_cast<int>(heights.size());
int y = ny;
for (int gridY = 0; gridY < gridH; ++gridY)
{
@@ -348,10 +350,8 @@ void LayoutArray::reflow(int nx, int ny, int nw, int nh)
if (cell && cell->mType != LayoutCell::NONE)
{
int dx = x, dy = y, dw = 0, dh = 0;
- align(dx, dw, 0, *cell, &widths[gridX],
- static_cast<int>(widths.size() - gridX));
- align(dy, dh, 1, *cell, &heights[gridY],
- static_cast<int>(heights.size() - gridY));
+ align(dx, dw, 0, *cell, &widths[gridX], szW - gridX);
+ align(dy, dh, 1, *cell, &heights[gridY], szH - gridY);
cell->reflow(dx, dy, dw, dh);
}
x += widths[gridX] + mSpacing;