summaryrefslogtreecommitdiff
path: root/src/map.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2011-07-17 21:08:56 +0300
committerAndrei Karas <akaras@inbox.ru>2011-07-17 22:31:22 +0300
commit932a7f3ca748f04448c72c5d31515bc3a8008144 (patch)
treecc8f8af7da04d8c1c724dde76c7f6e895293871f /src/map.cpp
parent3293fb7b5df3c93b7b6cccf56feb4fa42fd1ea41 (diff)
downloadmv-932a7f3ca748f04448c72c5d31515bc3a8008144.tar.gz
mv-932a7f3ca748f04448c72c5d31515bc3a8008144.tar.bz2
mv-932a7f3ca748f04448c72c5d31515bc3a8008144.tar.xz
mv-932a7f3ca748f04448c72c5d31515bc3a8008144.zip
Optimisation in drawing map in opengl mode.
Diffstat (limited to 'src/map.cpp')
-rw-r--r--src/map.cpp15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/map.cpp b/src/map.cpp
index d5d74f4df..6fbf28718 100644
--- a/src/map.cpp
+++ b/src/map.cpp
@@ -271,6 +271,7 @@ void MapLayer::updateOGL(Graphics *graphics, int startX, int startY,
const int yWidth = y * mWidth;
const int py0 = y * 32 + dy;
+ std::map<Image*, ImageVertexes*> imgSet;
for (int x = startX; x < endX; x++)
{
@@ -284,9 +285,17 @@ void MapLayer::updateOGL(Graphics *graphics, int startX, int startY,
{
if (lastImage != img)
{
- imgVert = new ImageVertexes();
- imgVert->image = img;
- row->images.push_back(imgVert);
+ imgSet[lastImage] = imgVert;
+ if (imgSet.find(img) != imgSet.end())
+ {
+ imgVert = imgSet[img];
+ }
+ else
+ {
+ imgVert = new ImageVertexes();
+ imgVert->image = img;
+ row->images.push_back(imgVert);
+ }
lastImage = img;
}
graphics->calcTile(imgVert, px, py);