From 1143985bc7559e5f19d996eeac7a04c4a3edd30d Mon Sep 17 00:00:00 2001 From: bzzt Date: Wed, 20 Feb 2019 13:37:00 +0000 Subject: [PATCH] Do not update map texture if it did not change --- apps/openmw/mwrender/localmap.cpp | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/apps/openmw/mwrender/localmap.cpp b/apps/openmw/mwrender/localmap.cpp index 1650dc92c..6c8dfec60 100644 --- a/apps/openmw/mwrender/localmap.cpp +++ b/apps/openmw/mwrender/localmap.cpp @@ -613,7 +613,8 @@ void LocalMap::updatePlayer (const osg::Vec3f& position, const osg::Quat& orient if (!segment.mFogOfWarImage || !segment.mMapTexture) continue; - unsigned char* data = segment.mFogOfWarImage->data(); + uint32_t* data = (uint32_t*)segment.mFogOfWarImage->data(); + bool changed = false; for (int texV = 0; texV> 24); alpha = std::min( alpha, (uint8_t) (std::max(0.f, std::min(1.f, (sqrDist/sqrExploreRadius)))*255) ); - *(uint32_t*)data = (uint32_t) (alpha << 24); + uint32_t val = (uint32_t) (alpha << 24); + if ( *data != val) + { + *data = val; + changed = true; + } - data += 4; + ++data; } } - segment.mHasFogState = true; - segment.mFogOfWarImage->dirty(); + if (changed) + { + segment.mHasFogState = true; + segment.mFogOfWarImage->dirty(); + } } } }