summaryrefslogtreecommitdiff
path: root/src/resources/map/map.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2019-04-08 23:36:01 +0300
committerAndrei Karas <akaras@inbox.ru>2019-04-08 23:36:01 +0300
commit010455ce5fc860f41448537e14f30a8453ce5150 (patch)
tree95dafb8e18fe3f8ce4a0656866187025695888f9 /src/resources/map/map.cpp
parent226fea014e24ea69989c7ac2f7428926ec865663 (diff)
downloadmv-010455ce5fc860f41448537e14f30a8453ce5150.tar.gz
mv-010455ce5fc860f41448537e14f30a8453ce5150.tar.bz2
mv-010455ce5fc860f41448537e14f30a8453ce5150.tar.xz
mv-010455ce5fc860f41448537e14f30a8453ce5150.zip
If map too small, clear screen before drawing map
Clear map not works on software renderer.
Diffstat (limited to 'src/resources/map/map.cpp')
-rw-r--r--src/resources/map/map.cpp19
1 files changed, 18 insertions, 1 deletions
diff --git a/src/resources/map/map.cpp b/src/resources/map/map.cpp
index ae7570cda..2128cdcd3 100644
--- a/src/resources/map/map.cpp
+++ b/src/resources/map/map.cpp
@@ -163,7 +163,8 @@ Map::Map(const std::string &name,
mCachedDraw(false),
#endif // USE_OPENGL
mCustom(false),
- mDrawOnlyFringe(false)
+ mDrawOnlyFringe(false),
+ mClear(false)
{
config.addListener("OverlayDetail", this);
config.addListener("guialpha", this);
@@ -340,6 +341,9 @@ void Map::draw(Graphics *restrict const graphics,
if (localPlayer == nullptr)
return;
+ if (mClear)
+ mainGraphics->clearScreen();
+
BLOCK_START("Map::draw")
// Calculate range of tiles which are on-screen
const int endPixelY = graphics->mHeight + scrollY + mTileHeight - 1
@@ -1799,6 +1803,19 @@ int Map::calcMemoryChilds(const int level) const
return sz;
}
+void Map::screenResized()
+{
+ if (mWidth * mapTileSize < mainGraphics->mWidth ||
+ mHeight * mapTileSize < mainGraphics->mHeight)
+ {
+ mClear = true;
+ }
+ else
+ {
+ mClear = false;
+ }
+}
+
#ifdef USE_OPENGL
int Map::getAtlasCount() const restrict2
{