diff options
author | Andrei Karas <akaras@inbox.ru> | 2011-07-17 16:50:57 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2011-07-17 16:50:57 +0300 |
commit | e183a929a3653446a6545ca764e47c47f7b00e50 (patch) | |
tree | 0c6002f48674dbeb6d6ce7a8db85cc39994f2770 /src/map.cpp | |
parent | d0e6d477d245610288ab622ecf47426a9dcbc400 (diff) | |
download | mv-e183a929a3653446a6545ca764e47c47f7b00e50.tar.gz mv-e183a929a3653446a6545ca764e47c47f7b00e50.tar.bz2 mv-e183a929a3653446a6545ca764e47c47f7b00e50.tar.xz mv-e183a929a3653446a6545ca764e47c47f7b00e50.zip |
Improve map reduce speed.
Diffstat (limited to 'src/map.cpp')
-rw-r--r-- | src/map.cpp | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/map.cpp b/src/map.cpp index 66bdbd4bc..fa9d014df 100644 --- a/src/map.cpp +++ b/src/map.cpp @@ -1816,10 +1816,18 @@ void Map::reduce() Image *img = layer->mTiles[x + y * layer->mWidth]; if (img) { - img->setAlphaVisible(true); - if (img->mBounds.w > 32 || img->mBounds.h > 32) + if (img->hasAlphaChannel() && img->isAlphaCalculated()) + { + if (!img->isAlphaVisible()) + { + dontHaveAlpha = true; + img->setAlphaVisible(false); + } + } + else if (img->mBounds.w > 32 || img->mBounds.h > 32) { correct = false; + img->setAlphaVisible(true); break; } else if (!img->isHasAlphaChannel()) @@ -1832,6 +1840,7 @@ void Map::reduce() Uint8 *arr = img->SDLgetAlphaChannel(); if (!arr) continue; + bool bad(false); bool stop(false); int width; @@ -1868,6 +1877,7 @@ void Map::reduce() img->setAlphaVisible(true); } } + img->setAlphaCalculated(true); } } if (!correct || !dontHaveAlpha) |