summaryrefslogtreecommitdiff
path: root/src/gui/widgets/itemcontainer.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-09-16 18:38:56 +0300
committerAndrei Karas <akaras@inbox.ru>2012-09-16 18:38:56 +0300
commitf8fc3380197c078a6dcff02351d835c3022411e1 (patch)
tree0e6df38991b28539ebfadca4b4dcf6e521664ee6 /src/gui/widgets/itemcontainer.cpp
parentc530b85859d0de18891781877d22b438b7693087 (diff)
downloadmv-f8fc3380197c078a6dcff02351d835c3022411e1.tar.gz
mv-f8fc3380197c078a6dcff02351d835c3022411e1.tar.bz2
mv-f8fc3380197c078a6dcff02351d835c3022411e1.tar.xz
mv-f8fc3380197c078a6dcff02351d835c3022411e1.zip
Improve inventory resize speed.
Diffstat (limited to 'src/gui/widgets/itemcontainer.cpp')
-rw-r--r--src/gui/widgets/itemcontainer.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/gui/widgets/itemcontainer.cpp b/src/gui/widgets/itemcontainer.cpp
index 19f35ff02..aa254c30b 100644
--- a/src/gui/widgets/itemcontainer.cpp
+++ b/src/gui/widgets/itemcontainer.cpp
@@ -541,24 +541,27 @@ void ItemContainer::updateMatrix()
break;
}
+ int jMult = j * mGridColumns;
+ const int maxSize = mGridRows * mGridColumns;
for (std::vector<ItemIdPair*>::const_iterator iter = sortedItems.begin(),
iter_end = sortedItems.end(); iter != iter_end; ++ iter)
{
- if (j >= mGridRows)
+ if (jMult >= maxSize)
break;
- mShowMatrix[j * mGridColumns + i] = (*iter)->mId;
+ mShowMatrix[jMult + i] = (*iter)->mId;
i ++;
if (i >= mGridColumns)
{
i = 0;
j ++;
+ jMult += mGridColumns;
}
}
for (int idx = j * mGridColumns + i;
- idx < mGridRows * mGridColumns; idx ++)
+ idx < maxSize; idx ++)
{
mShowMatrix[idx] = -1;
}