From 059b561dd2fbbc115d815a41d58b8bb76f603074 Mon Sep 17 00:00:00 2001
From: Oz Linden <oz@lindenlab.com>
Date: Wed, 4 Feb 2015 05:31:13 -0800
Subject: [PATCH] allow visually muted results to be cached from const methods

---
 indra/newview/llvoavatar.cpp | 2 +-
 indra/newview/llvoavatar.h   | 7 ++++---
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp
index 44fbceed14a..cfe83cb0b6b 100755
--- a/indra/newview/llvoavatar.cpp
+++ b/indra/newview/llvoavatar.cpp
@@ -3080,7 +3080,7 @@ void LLVOAvatar::slamPosition()
 	mRoot->updateWorldMatrixChildren();
 }
 
-bool LLVOAvatar::isVisuallyMuted()
+bool LLVOAvatar::isVisuallyMuted() const
 {
 	bool muted = false;
 
diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h
index 2921a3a3f9d..f0f8bbe21b9 100755
--- a/indra/newview/llvoavatar.h
+++ b/indra/newview/llvoavatar.h
@@ -385,7 +385,7 @@ class LLVOAvatar :
 
 public:
 	U32 		renderImpostor(LLColor4U color = LLColor4U(255,255,255,255), S32 diffuse_channel = 0);
-	bool		isVisuallyMuted();
+	bool		isVisuallyMuted() const;
 	void		setCachedVisualMute(bool muted)						{ mCachedVisualMute = muted;	};
 	void		forceUpdateVisualMuteSettings();
 
@@ -422,8 +422,9 @@ class LLVOAvatar :
 	S32	 		mUpdatePeriod;
 	S32  		mNumInitFaces; //number of faces generated when creating the avatar drawable, does not inculde splitted faces due to long vertex buffer.
 
-	bool		mCachedVisualMute;				// cached return value for isVisuallyMuted()
-	F64			mCachedVisualMuteUpdateTime;	// Time to update mCachedVisualMute
+	// the isVisuallyMuted method uses these mutable values to avoid recalculating too frequently
+	mutable bool mCachedVisualMute;	// cached return value for isVisuallyMuted()
+	mutable F64 mCachedVisualMuteUpdateTime; // Time to update mCachedVisualMute
 
 	VisualMuteSettings		mVisuallyMuteSetting;			// Always or never visually mute this AV
 
-- 
GitLab