summaryrefslogtreecommitdiff
path: root/src/resources/map/maplayer.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-12-31 22:53:42 +0300
committerAndrei Karas <akaras@inbox.ru>2016-12-31 22:53:42 +0300
commit896d41e4b073046c59933ea8829474bd82b9c506 (patch)
tree737bbfa3381f9d0ddd8629faf29dd6dce0ca4be3 /src/resources/map/maplayer.cpp
parent1962d62c1e209af7d61e85a4ed3675f0a16e5924 (diff)
downloadplus-896d41e4b073046c59933ea8829474bd82b9c506.tar.gz
plus-896d41e4b073046c59933ea8829474bd82b9c506.tar.bz2
plus-896d41e4b073046c59933ea8829474bd82b9c506.tar.xz
plus-896d41e4b073046c59933ea8829474bd82b9c506.zip
Improve special layers draw speed in same way like fringe layer.
Diffstat (limited to 'src/resources/map/maplayer.cpp')
-rw-r--r--src/resources/map/maplayer.cpp25
1 files changed, 20 insertions, 5 deletions
diff --git a/src/resources/map/maplayer.cpp b/src/resources/map/maplayer.cpp
index 5239403ed..249e67fdd 100644
--- a/src/resources/map/maplayer.cpp
+++ b/src/resources/map/maplayer.cpp
@@ -402,24 +402,39 @@ void MapLayer::drawSpecialLayer(Graphics *const graphics,
endX1 = specialWidth;
if (endX1 < 0)
endX1 = 0;
-
- for (int x = startX; x < endX1; x++)
+ int x0 = startX;
+ const MapItem *item0 = mSpecialLayer->mTiles[ptr + startX];
+ if (!item0 || item0->mType == MapItemType::EMPTY)
+ {
+ x0 += mSpecialLayer->mCache[ptr + startX];
+ }
+ for (int x = x0; x < endX1; x++)
{
const int px1 = x * mapTileSize - scrollX;
-
- const MapItem *item = mSpecialLayer->mTiles[ptr + x];
+ const MapItem *const item = mSpecialLayer->mTiles[ptr + x];
if (item)
{
item->draw(graphics, px1, py1,
mapTileSize, mapTileSize);
}
+ x += mSpecialLayer->mCache[ptr + x];
+ }
- item = mTempLayer->mTiles[ptr + x];
+ item0 = mTempLayer->mTiles[ptr + startX];
+ if (!item0 || item0->mType == MapItemType::EMPTY)
+ {
+ x0 += mTempLayer->mCache[ptr + startX];
+ }
+ for (int x = x0; x < endX1; x++)
+ {
+ const int px1 = x * mapTileSize - scrollX;
+ const MapItem *const item = mTempLayer->mTiles[ptr + x];
if (item)
{
item->draw(graphics, px1, py1,
mapTileSize, mapTileSize);
}
+ x += mSpecialLayer->mCache[ptr + x];
}
}