From 77068bcf311801b747a2dba2afc442fb68b8baba Mon Sep 17 00:00:00 2001
From: Loren Shih <seraph@lindenlab.com>
Date: Mon, 17 May 2010 20:41:30 -0400
Subject: [PATCH] EXT-7385 FIXED Show load and discard level for loading
 textures

More debugging information is now shown for loading textures
---
 indra/newview/lltexturectrl.cpp | 40 ++++++++++++++++++++++++++-------
 1 file changed, 32 insertions(+), 8 deletions(-)

diff --git a/indra/newview/lltexturectrl.cpp b/indra/newview/lltexturectrl.cpp
index a1b3c8dabd5..f6479bd004f 100644
--- a/indra/newview/lltexturectrl.cpp
+++ b/indra/newview/lltexturectrl.cpp
@@ -1248,25 +1248,49 @@ void LLTextureCtrl::draw()
 
 	mTentativeLabel->setVisible( !mTexturep.isNull() && getTentative() );
 	
-	
 	// Show "Loading..." string on the top left corner while this texture is loading.
 	// Using the discard level, do not show the string if the texture is almost but not 
 	// fully loaded.
-	if ( mTexturep.notNull() &&
-		 (!mTexturep->isFullyLoaded()) &&
-		 (mShowLoadingPlaceholder == TRUE) && 
-		 (mTexturep->getDiscardLevel() != 1) &&
-		 (mTexturep->getDiscardLevel() != 0))
+	if (mTexturep.notNull() &&
+		(!mTexturep->isFullyLoaded()) &&
+		(mShowLoadingPlaceholder == TRUE) &&
+		(mTexturep->getDiscardLevel() != 1) &&
+		(mTexturep->getDiscardLevel() != 0))
 	{
+		U32 v_offset = 25;
 		LLFontGL* font = LLFontGL::getFontSansSerif();
 		font->renderUTF8(
-			mLoadingPlaceholderString, 0,
+			mLoadingPlaceholderString, 
+			0,
 			llfloor(interior.mLeft+3), 
-			llfloor(interior.mTop-25),
+			llfloor(interior.mTop-v_offset),
 			LLColor4::white,
 			LLFontGL::LEFT,
 			LLFontGL::BASELINE,
 			LLFontGL::DROP_SHADOW);
+		
+		// Show more detailed information if this agent is god.
+		if (gAgent.isGodlike())
+		{
+			LLFontGL* font = LLFontGL::getFontSansSerif();
+			std::string tdesc;
+			// Show what % the texture has loaded (0 to 100%, 100 is highest), and what level of detail (5 to 0, 0 is best).
+
+			v_offset += 12;
+			tdesc = llformat("  PK  : %d%%", U32(mTexturep->getDownloadProgress()*100.0));
+			font->renderUTF8(tdesc, 0, llfloor(interior.mLeft+3), llfloor(interior.mTop-v_offset),
+							 LLColor4::white, LLFontGL::LEFT, LLFontGL::BASELINE, LLFontGL::DROP_SHADOW);
+
+			v_offset += 12;
+			tdesc = llformat("  LVL: %d", mTexturep->getDiscardLevel());
+			font->renderUTF8(tdesc, 0, llfloor(interior.mLeft+3), llfloor(interior.mTop-v_offset),
+							 LLColor4::white, LLFontGL::LEFT, LLFontGL::BASELINE, LLFontGL::DROP_SHADOW);
+
+			v_offset += 12;
+			tdesc = llformat("  ID  : %s...", (mImageAssetID.asString().substr(0,10)).c_str());
+			font->renderUTF8(tdesc, 0, llfloor(interior.mLeft+3), llfloor(interior.mTop-v_offset),
+							 LLColor4::white, LLFontGL::LEFT, LLFontGL::BASELINE, LLFontGL::DROP_SHADOW);
+		}
 	}
 
 	LLUICtrl::draw();
-- 
GitLab