From e2edb5b7519606b31681a00bd01eaa732d75577d Mon Sep 17 00:00:00 2001
From: "Brad Payne (Vir Linden)" <vir@lindenlab.com>
Date: Wed, 29 Feb 2012 13:24:02 -0500
Subject: [PATCH] SH-3018 WIP - removed obsolete texture category and texture
 size consoles

---
 indra/newview/lldebugview.cpp                 |  26 --
 indra/newview/lltextureview.cpp               | 300 ------------------
 indra/newview/lltextureview.h                 |  35 --
 indra/newview/llviewermenu.cpp                |  16 -
 .../skins/default/xui/en/menu_viewer.xml      |  22 --
 5 files changed, 399 deletions(-)
 mode change 100644 => 100755 indra/newview/lltextureview.cpp

diff --git a/indra/newview/lldebugview.cpp b/indra/newview/lldebugview.cpp
index 7d3170cb765..bba5d7c4597 100644
--- a/indra/newview/lldebugview.cpp
+++ b/indra/newview/lldebugview.cpp
@@ -68,8 +68,6 @@ LLDebugView::~LLDebugView()
 	gDebugView = NULL;
 	gTextureView = NULL;
 	gSceneView = NULL;
-	gTextureSizeView = NULL;
-	gTextureCategoryView = NULL;
 }
 
 void LLDebugView::init()
@@ -122,30 +120,6 @@ void LLDebugView::init()
 	gTextureView = LLUICtrlFactory::create<LLTextureView>(tvp);
 	addChild(gTextureView);
 	//gTextureView->reshape(r.getWidth(), r.getHeight(), TRUE);
-
-
-	if(gAuditTexture)
-	{
-		r.set(150, rect.getHeight() - 50, 900 + LLImageGL::sTextureLoadedCounter.size() * 30, 100);
-		LLTextureSizeView::Params tsv ;
-		tsv.name("gTextureSizeView");
-		tsv.rect(r);
-		tsv.follows.flags(FOLLOWS_BOTTOM|FOLLOWS_LEFT);
-		tsv.visible(false);
-		gTextureSizeView = LLUICtrlFactory::create<LLTextureSizeView>(tsv);
-		addChild(gTextureSizeView);
-		gTextureSizeView->setType(LLTextureSizeView::TEXTURE_MEM_OVER_SIZE) ;
-
-		r.set(150, rect.getHeight() - 50, 900 + LLViewerTexture::getTotalNumOfCategories() * 30, 100);
-		LLTextureSizeView::Params tcv ;
-		tcv.name("gTextureCategoryView");
-		tcv.rect(r);
-		tcv.follows.flags(FOLLOWS_BOTTOM|FOLLOWS_LEFT);
-		tcv.visible(false);
-		gTextureCategoryView = LLUICtrlFactory::create<LLTextureSizeView>(tcv);
-		gTextureCategoryView->setType(LLTextureSizeView::TEXTURE_MEM_OVER_CATEGORY);
-		addChild(gTextureCategoryView);
-	}
 }
 
 void LLDebugView::draw()
diff --git a/indra/newview/lltextureview.cpp b/indra/newview/lltextureview.cpp
old mode 100644
new mode 100755
index 1c89766b267..69422bfc5a5
--- a/indra/newview/lltextureview.cpp
+++ b/indra/newview/lltextureview.cpp
@@ -57,8 +57,6 @@
 extern F32 texmem_lower_bound_scale;
 
 LLTextureView *gTextureView = NULL;
-LLTextureSizeView *gTextureSizeView = NULL;
-LLTextureSizeView *gTextureCategoryView = NULL;
 
 #define HIGH_PRIORITY 100000000.f
 
@@ -1049,302 +1047,4 @@ BOOL LLTextureView::handleKey(KEY key, MASK mask, BOOL called_from_parent)
 	return FALSE;
 }
 
-//-----------------------------------------------------------------
-LLTextureSizeView::LLTextureSizeView(const LLTextureSizeView::Params& p) : LLContainerView(p)
-{
-	setVisible(FALSE) ;
-
-	mTextureSizeBarWidth = 30 ;
-}
-
-LLTextureSizeView::~LLTextureSizeView()
-{
-	if(mTextureSizeBar.size())
-	{
-		for(U32 i = 0 ; i < mTextureSizeBar.size() ; i++)
-		{
-			delete mTextureSizeBar[i] ;
-		}
-		mTextureSizeBar.clear() ;
-	}
-}
-void LLTextureSizeView::draw()
-{
-	if(mType == TEXTURE_MEM_OVER_SIZE)
-	{
-		drawTextureSizeGraph();
-	}
-	else
-	{
-		drawTextureCategoryGraph() ;
-	}
-	
-	LLView::draw();
-}
-
-BOOL LLTextureSizeView::handleHover(S32 x, S32 y, MASK mask) 
-{
-	if(x > mTextureSizeBarRect.mLeft && x < mTextureSizeBarRect.mRight)
-	{
-		mTextureSizeBar[(x - mTextureSizeBarRect.mLeft) / mTextureSizeBarWidth]->handleHover(x, y, mask, (mType == TEXTURE_MEM_OVER_SIZE)) ;
-	}
-
-	return TRUE ;
-}
-
-//draw real-time texture mem bar over size
-void LLTextureSizeView::drawTextureSizeGraph()
-{
-	if(mTextureSizeBar.size() == 0)
-	{
-		S32 line_height = (S32)(LLFontGL::getFontMonospace()->getLineHeight() + .5f);
-		mTextureSizeBar.resize(LLImageGL::sTextureLoadedCounter.size()) ;
-		mTextureSizeBarRect.set(700, line_height * 2 + 400, 700 + mTextureSizeBar.size() * mTextureSizeBarWidth, line_height * 2) ;
-		
-		for(U32 i = 0 ; i < mTextureSizeBar.size() ; i++)
-		{				
-			mTextureSizeBar[i] = new LLGLTexSizeBar(i, mTextureSizeBarRect.mLeft + i * mTextureSizeBarWidth , 
-				line_height * 2, mTextureSizeBarRect.mLeft + (i + 1) * mTextureSizeBarWidth, line_height) ;				
-		}			
-	}
-
-	F32 size_bar_scale = drawTextureSizeDistributionGraph() ;		
-	for(U32 i = 0 ; i < mTextureSizeBar.size() ; i++)
-	{
-		mTextureSizeBar[i]->setTop(LLImageGL::sTextureLoadedCounter[i], LLImageGL::sTextureBoundCounter[i], size_bar_scale) ;
-		mTextureSizeBar[i]->draw() ;
-	}		
-	LLImageGL::resetCurTexSizebar();
-}
-
-//draw background of texture size bar graph
-F32 LLTextureSizeView::drawTextureSizeDistributionGraph()
-{	
-	//scale
-	F32 scale = 1.0f ;
-	
-	LLGLSUIDefault gls_ui;
-
-	{
-		S32 count = 0 ;
-		for(U32 i = 0 ; i < LLImageGL::sTextureLoadedCounter.size() ; i++)
-		{
-			if(LLImageGL::sTextureLoadedCounter[i] > count)
-			{
-				count = LLImageGL::sTextureLoadedCounter[i] ;
-			}
-		}
-		if(count > mTextureSizeBarRect.getHeight())
-		{
-			scale = (F32)mTextureSizeBarRect.getHeight() / count ;
-		}
-	}
 
-	S32 line_height = (S32)(LLFontGL::getFontMonospace()->getLineHeight() + .5f);
-	S32 left = mTextureSizeBarRect.mLeft ;
-	S32 bottom = mTextureSizeBarRect.mBottom ;
-	S32 right = mTextureSizeBarRect.mRight ;
-	S32 top = mTextureSizeBarRect.mTop ;
-
-	gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
-	
-	//background rect
-	gl_rect_2d(left - 25, top + 30, right + 100, bottom - 25, LLColor4(0.0f, 0.0f, 0.0f, 0.25f)) ;
-
-	//--------------------------------------------------
-	gGL.color4f(1.0f, 0.5f, 0.5f, 0.75f);
-	gl_line_2d(left, bottom, right, bottom) ; //x axis
-	gl_line_2d(left, bottom, left, top) ; //y axis
-
-	//ruler
-	//--------------------------------------------------
-	gGL.color4f(1.0f, 0.5f, 0.5f, 0.5f);
-	for(S32 i = bottom + 50 ; i <= top ; i += 50)
-	{
-		gl_line_2d(left, i, right, i) ;
-	}
-
-	//texts
-	//--------------------------------------------------
-	F32 text_color[] = {1.f, 1.f, 1.f, 0.75f};	
-	std::string text;
-	
-	//-------
-	//x axis: size label
-	text = llformat("%d", 0) ;
-	LLFontGL::getFontMonospace()->renderUTF8(text, 0, left + 12, bottom - line_height / 2,
-									 text_color, LLFontGL::LEFT, LLFontGL::TOP);
-	for(U32 i = 1 ; i < mTextureSizeBar.size() ; i++)
-	{
-		text = llformat("%d", (1 << (i / 2)) + ((i & 1) ? ((1 << (i / 2)) >> 1) : 0)) ;
-		LLFontGL::getFontMonospace()->renderUTF8(text, 0, left + i * mTextureSizeBarWidth + 12, bottom - line_height / 2,
-									 text_color, LLFontGL::LEFT, LLFontGL::TOP);
-	}
-	text = llformat("(w + h)/2") ;
-	LLFontGL::getFontMonospace()->renderUTF8(text, 0, right + 10, bottom - line_height / 2,
-									 text_color, LLFontGL::LEFT, LLFontGL::TOP);
-	//-------
-
-	//y axis: number label
-	for(S32 i = bottom + 50 ; i <= top ; i += 50)
-	{
-		text = llformat("%d", (S32)((i - bottom) / scale)) ;
-		LLFontGL::getFontMonospace()->renderUTF8(text, 0, left - 20, i + line_height / 2 ,
-									 text_color, LLFontGL::LEFT, LLFontGL::TOP);
-		LLFontGL::getFontMonospace()->renderUTF8(text, 0, right + 5, i + line_height / 2 ,
-									 text_color, LLFontGL::LEFT, LLFontGL::TOP);
-	}
-
-	//--------------------------------------------------
-	F32 loaded_color[] = {1.0f, 0.0f, 0.0f, 0.75f};
-	gl_rect_2d(left + 70, top + line_height * 2, left + 90, top + line_height, loaded_color) ;
-	text = llformat("Loaded") ;
-	LLFontGL::getFontMonospace()->renderUTF8(text, 0, left + 100, top + line_height * 2,
-									 loaded_color, LLFontGL::LEFT, LLFontGL::TOP);
-
-	F32 bound_color[] = {1.0f, 1.0f, 0.0f, 0.75f};
-	gl_rect_2d(left + 170, top + line_height * 2, left + 190, top + line_height, bound_color) ;
-	text = llformat("Bound") ;
-	LLFontGL::getFontMonospace()->renderUTF8(text, 0, left + 200, top + line_height * 2,
-									 bound_color, LLFontGL::LEFT, LLFontGL::TOP);
-
-	//--------------------------------------------------
-
-	//title
-	text = llformat("Texture Size Distribution") ;
-	LLFontGL::getFontMonospace()->renderUTF8(text, 0, left + 250, top + line_height * 3,
-									 text_color, LLFontGL::LEFT, LLFontGL::TOP);
-	return scale ;
-}
-
-//draw real-time texture mem bar over category
-void LLTextureSizeView::drawTextureCategoryGraph()
-{
-	if(mTextureSizeBar.size() == 0)
-	{
-		S32 line_height = (S32)(LLFontGL::getFontMonospace()->getLineHeight() + .5f);
-		mTextureSizeBar.resize(LLViewerTexture::getTotalNumOfCategories()) ;
-		mTextureSizeBarRect.set(700, line_height * 2 + 400, 700 + mTextureSizeBar.size() * mTextureSizeBarWidth, line_height * 2) ;
-		
-		for(U32 i = 0 ; i < mTextureSizeBar.size() ; i++)
-		{				
-			mTextureSizeBar[i] = new LLGLTexSizeBar(i, mTextureSizeBarRect.mLeft + i * mTextureSizeBarWidth , 
-				line_height * 2, mTextureSizeBarRect.mLeft + (i + 1) * mTextureSizeBarWidth, line_height) ;				
-		}			
-	}
-
-	F32 size_bar_scale = drawTextureCategoryDistributionGraph() ;		
-	for(U32 i = 0 ; i < mTextureSizeBar.size() ; i++)
-	{
-		U32 k = LLViewerTexture::getIndexFromCategory(i) ;
-		mTextureSizeBar[i]->setTop(LLImageGL::sTextureMemByCategory[k] >> 20, LLImageGL::sTextureMemByCategoryBound[k] >> 20, size_bar_scale) ;
-		mTextureSizeBar[i]->draw() ;
-	}		
-	LLImageGL::resetCurTexSizebar();
-}
-
-//draw background for TEXTURE_MEM_OVER_CATEGORY
-F32 LLTextureSizeView::drawTextureCategoryDistributionGraph() 
-{
-	//scale
-	F32 scale = 4.0f ;
-	
-	LLGLSUIDefault gls_ui;
-
-	{
-		S32 count = 0 ;
-		for(U32 i = 0 ; i < LLImageGL::sTextureMemByCategory.size() ; i++)
-		{
-			S32 tmp = LLImageGL::sTextureMemByCategory[i] >> 20 ;
-			if(tmp > count)
-			{
-				count = tmp ;
-			}
-		}
-		if(count > mTextureSizeBarRect.getHeight() * 0.25f)
-		{
-			scale = (F32)mTextureSizeBarRect.getHeight() * 0.25f / count ;
-		}
-	}
-
-	S32 line_height = (S32)(LLFontGL::getFontMonospace()->getLineHeight() + .5f);
-	S32 left = mTextureSizeBarRect.mLeft ;
-	S32 bottom = mTextureSizeBarRect.mBottom ;
-	S32 right = mTextureSizeBarRect.mRight ;
-	S32 top = mTextureSizeBarRect.mTop ;
-
-	gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
-	
-	//background rect
-	gl_rect_2d(left - 25, top + 30, right + 100, bottom - 25, LLColor4(0.0f, 0.0f, 0.0f, 0.25f)) ;
-
-	//--------------------------------------------------
-	gGL.color4f(1.0f, 0.5f, 0.5f, 0.75f);
-	gl_line_2d(left, bottom, right, bottom) ; //x axis
-	gl_line_2d(left, bottom, left, top) ; //y axis
-
-	//ruler
-	//--------------------------------------------------
-	gGL.color4f(1.0f, 0.5f, 0.5f, 0.5f);
-	for(S32 i = bottom + 50 ; i <= top ; i += 50)
-	{
-		gl_line_2d(left, i, right, i) ;
-	}
-
-	//texts
-	//--------------------------------------------------
-	F32 text_color[] = {1.f, 1.f, 1.f, 0.75f};	
-	std::string text;
-	
-	//-------
-	//x axis: size label			
-	static char category[LLViewerTexture::MAX_GL_IMAGE_CATEGORY][4] = 
-	{"Non", "Bak", "Av", "Cld", "Scp", "Hi", "Trn", "Slt", "Hud", "Bsf", "UI", "Pvw", "Map", "Mvs", "Slf", "Loc", "Scr", "Dyn", "Mdi", "ALT", "Oth" } ;
-
-	text = llformat("%s", category[0]) ;
-	LLFontGL::getFontMonospace()->renderUTF8(text, 0, left + 12, bottom - line_height / 2,
-									 text_color, LLFontGL::LEFT, LLFontGL::TOP);
-	for(U32 i = 1 ; i < mTextureSizeBar.size() ; i++)
-	{
-		text = llformat("%s", category[i]) ;
-		LLFontGL::getFontMonospace()->renderUTF8(text, 0, left + i * mTextureSizeBarWidth + 12, bottom - line_height / 2,
-									 text_color, LLFontGL::LEFT, LLFontGL::TOP);
-	}
-	//-------
-
-	//y axis: number label
-	for(S32 i = bottom + 50 ; i <= top ; i += 50)
-	{
-		text = llformat("%d", (S32)((i - bottom) / scale)) ;
-		LLFontGL::getFontMonospace()->renderUTF8(text, 0, left - 20, i + line_height / 2 ,
-									 text_color, LLFontGL::LEFT, LLFontGL::TOP);
-		LLFontGL::getFontMonospace()->renderUTF8(text, 0, right + 5, i + line_height / 2 ,
-									 text_color, LLFontGL::LEFT, LLFontGL::TOP);
-	}
-
-	text = llformat("MB") ;
-	LLFontGL::getFontMonospace()->renderUTF8(text, 0, left - 20, top + line_height * 2 ,
-									 text_color, LLFontGL::LEFT, LLFontGL::TOP);
-	//--------------------------------------------------
-	F32 loaded_color[] = {1.0f, 0.0f, 0.0f, 0.75f};
-	gl_rect_2d(left + 70, top + line_height * 2, left + 90, top + line_height, loaded_color) ;
-	text = llformat("Loaded") ;
-	LLFontGL::getFontMonospace()->renderUTF8(text, 0, left + 100, top + line_height * 2,
-									 loaded_color, 
-									 LLFontGL::LEFT, LLFontGL::TOP);
-
-	F32 bound_color[] = {1.0f, 1.0f, 0.0f, 0.75f};
-	gl_rect_2d(left + 170, top + line_height * 2, left + 190, top + line_height, bound_color) ;
-	text = llformat("Bound") ;
-	LLFontGL::getFontMonospace()->renderUTF8(text, 0, left + 200, top + line_height * 2,
-									 bound_color, LLFontGL::LEFT, LLFontGL::TOP);
-
-	//--------------------------------------------------
-
-	//title
-	text = llformat("Texture Category Distribution") ;
-	LLFontGL::getFontMonospace()->renderUTF8(text, 0, left + 250, top + line_height * 3,
-									 text_color, LLFontGL::LEFT, LLFontGL::TOP);
-
-	return scale ;
-}
diff --git a/indra/newview/lltextureview.h b/indra/newview/lltextureview.h
index 3723eb737b4..900b4e17d82 100644
--- a/indra/newview/lltextureview.h
+++ b/indra/newview/lltextureview.h
@@ -75,41 +75,6 @@ class LLTextureView : public LLContainerView
 };
 
 class LLGLTexSizeBar;
-class LLTextureSizeView : public LLContainerView
-{
-protected:
-	LLTextureSizeView(const Params&);
-	friend class LLUICtrlFactory;
-public:	
-	~LLTextureSizeView();
-
-	/*virtual*/ void draw();
-	/*virtual*/ BOOL handleHover(S32 x, S32 y, MASK mask) ;
-	
-	void setType(S32 type) {mType = type ;}
-	enum
-	{
-		TEXTURE_MEM_OVER_SIZE,
-		TEXTURE_MEM_OVER_CATEGORY
-	};
-private:
-	//draw background for TEXTURE_MEM_OVER_SIZE
-	F32 drawTextureSizeDistributionGraph() ;
-	//draw real-time texture mem bar over size
-	void drawTextureSizeGraph();
-
-	//draw background for TEXTURE_MEM_OVER_CATEGORY
-	F32 drawTextureCategoryDistributionGraph() ;
-	//draw real-time texture mem bar over category
-	void drawTextureCategoryGraph();
 
-private:
-	std::vector<LLGLTexSizeBar*> mTextureSizeBar ;
-	LLRect mTextureSizeBarRect ;
-	S32    mTextureSizeBarWidth ;	
-	S32    mType ;
-};
 extern LLTextureView *gTextureView;
-extern LLTextureSizeView *gTextureSizeView;
-extern LLTextureSizeView *gTextureCategoryView;
 #endif // LL_TEXTURE_VIEW_H
diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp
index 99540ccce91..301b78ad4e9 100644
--- a/indra/newview/llviewermenu.cpp
+++ b/indra/newview/llviewermenu.cpp
@@ -511,14 +511,6 @@ class LLAdvancedToggleConsole : public view_listener_t
 		{
 			toggle_visibility( (void*)static_cast<LLUICtrl*>(gDebugView->mDebugConsolep));
 		}
-		else if (gTextureSizeView && "texture size" == console_type)
-		{
-			toggle_visibility( (void*)gTextureSizeView );
-		}
-		else if (gTextureCategoryView && "texture category" == console_type)
-		{
-			toggle_visibility( (void*)gTextureCategoryView );
-		}
 		else if ("fast timers" == console_type)
 		{
 			LLFloaterReg::toggleInstance("fast_timers");
@@ -551,14 +543,6 @@ class LLAdvancedCheckConsole : public view_listener_t
 		{
 			new_value = get_visibility( (void*)((LLView*)gDebugView->mDebugConsolep) );
 		}
-		else if (gTextureSizeView && "texture size" == console_type)
-		{
-			new_value = get_visibility( (void*)gTextureSizeView );
-		}
-		else if (gTextureCategoryView && "texture category" == console_type)
-		{
-			new_value = get_visibility( (void*)gTextureCategoryView );
-		}
 		else if ("fast timers" == console_type)
 		{
 			new_value = LLFloaterReg::instanceVisible("fast_timers");
diff --git a/indra/newview/skins/default/xui/en/menu_viewer.xml b/indra/newview/skins/default/xui/en/menu_viewer.xml
index cd8550b00db..389eea93d21 100644
--- a/indra/newview/skins/default/xui/en/menu_viewer.xml
+++ b/indra/newview/skins/default/xui/en/menu_viewer.xml
@@ -1890,28 +1890,6 @@
                function="Floater.Toggle"
                parameter="notifications_console" />
             </menu_item_call>
-            <menu_item_check
-               label="Texture Size Console"
-               name="Texture Size"
-               shortcut="control|shift|6">
-              <menu_item_check.on_check
-               function="Advanced.CheckConsole"
-               parameter="texture size" />
-              <menu_item_check.on_click
-               function="Advanced.ToggleConsole"
-               parameter="texture size" />
-            </menu_item_check>
-            <menu_item_check
-               label="Texture Category Console"
-               name="Texture Category"
-               shortcut="control|shift|7">
-              <menu_item_check.on_check
-               function="Advanced.CheckConsole"
-               parameter="texture category" />
-              <menu_item_check.on_click
-               function="Advanced.ToggleConsole"
-               parameter="texture category" />
-            </menu_item_check>
             <menu_item_check
              label="Fast Timers"
              name="Fast Timers"
-- 
GitLab