From 8e67ecf3dcd5f168806389a1048b2632582feedb Mon Sep 17 00:00:00 2001
From: Dave Parks <davep@lindenlab.com>
Date: Wed, 3 Feb 2010 12:33:32 -0600
Subject: Optimization pass. -- Further instrumentation of idle update --
 Removed mActiveQ from LLPipeline, instead making calm objects static during
 LLVOVolume::idleUpdate -- Further instrumentation of flexible object update
 -- Converted LLDynamicArray and LLMap members of LLViewerObjectList to stl
 counterparts -- Increased number of update bins in LLViewerObjectList from 16
 to 128 (objects will be processed every 128 frames instead of every 16, or ~
 90% fewer objects processed per frame) -- Removed unused
 "renderObjectsForSelect" code. -- Reenabled LOD updates for objects further
 than 24m from camera

---
 indra/newview/llagent.cpp            |   3 +
 indra/newview/llappviewer.cpp        |   8 +-
 indra/newview/lldrawable.cpp         |   3 -
 indra/newview/llflexibleobject.cpp   |  15 ++-
 indra/newview/llglsandbox.cpp        |  24 +++--
 indra/newview/llviewerobject.cpp     |   3 +
 indra/newview/llviewerobjectlist.cpp | 171 ++++++++++++++++++-----------------
 indra/newview/llviewerobjectlist.h   |  31 ++++---
 indra/newview/llviewerwindow.cpp     |   4 +-
 indra/newview/llvoclouds.cpp         |   4 +-
 indra/newview/llvotextbubble.cpp     |   3 +
 indra/newview/llvovolume.cpp         |  17 +++-
 indra/newview/llworld.cpp            |   3 +
 indra/newview/pipeline.cpp           |  64 +++----------
 indra/newview/pipeline.h             |   5 +-
 15 files changed, 185 insertions(+), 173 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp
index 2354323a66..9f2186f7f7 100644
--- a/indra/newview/llagent.cpp
+++ b/indra/newview/llagent.cpp
@@ -3017,6 +3017,9 @@ void LLAgent::endAnimationUpdateUI()
 //-----------------------------------------------------------------------------
 void LLAgent::updateCamera()
 {
+	static LLFastTimer::DeclareTimer ftm("Camera");
+	LLFastTimer t(ftm);
+
 	//Ventrella - changed camera_skyward to the new global "mCameraUpVector"
 	mCameraUpVector = LLVector3::z_axis;
 	//LLVector3	camera_skyward(0.f, 0.f, 1.f);
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp
index 2d694eefd3..9eb793783b 100644
--- a/indra/newview/llappviewer.cpp
+++ b/indra/newview/llappviewer.cpp
@@ -3599,13 +3599,15 @@ void LLAppViewer::idle()
 
 	{
 		// Handle pending gesture processing
+		static LLFastTimer::DeclareTimer ftm("Agent Position");
+		LLFastTimer t(ftm);
 		LLGestureManager::instance().update();
 
 		gAgent.updateAgentPosition(gFrameDTClamped, yaw, current_mouse.mX, current_mouse.mY);
 	}
 
 	{
-		LLFastTimer t(FTM_OBJECTLIST_UPDATE); // Actually "object update"
+		LLFastTimer t(FTM_OBJECTLIST_UPDATE); 
 		
         if (!(logoutRequestSent() && hasSavedFinalSnapshot()))
 		{
@@ -3639,6 +3641,8 @@ void LLAppViewer::idle()
 	//
 
 	{
+		static LLFastTimer::DeclareTimer ftm("HUD Effects");
+		LLFastTimer t(ftm);
 		LLSelectMgr::getInstance()->updateEffects();
 		LLHUDManager::getInstance()->cleanupEffects();
 		LLHUDManager::getInstance()->sendEffects();
@@ -3895,7 +3899,7 @@ void LLAppViewer::sendLogoutRequest()
 static F32 CheckMessagesMaxTime = CHECK_MESSAGES_DEFAULT_MAX_TIME;
 #endif
 
-static LLFastTimer::DeclareTimer FTM_IDLE_NETWORK("Network");
+static LLFastTimer::DeclareTimer FTM_IDLE_NETWORK("Idle Network");
 
 void LLAppViewer::idleNetwork()
 {
diff --git a/indra/newview/lldrawable.cpp b/indra/newview/lldrawable.cpp
index d60330024a..244fed791f 100644
--- a/indra/newview/lldrawable.cpp
+++ b/indra/newview/lldrawable.cpp
@@ -386,8 +386,6 @@ void LLDrawable::makeActive()
 			mParent->makeActive();
 		}
 
-		gPipeline.setActive(this, TRUE);
-
 		//all child objects must also be active
 		llassert_always(mVObjp);
 		
@@ -434,7 +432,6 @@ void LLDrawable::makeStatic(BOOL warning_enabled)
 	if (isState(ACTIVE))
 	{
 		clearState(ACTIVE);
-		gPipeline.setActive(this, FALSE);
 
 		if (mParent.notNull() && mParent->isActive() && warning_enabled)
 		{
diff --git a/indra/newview/llflexibleobject.cpp b/indra/newview/llflexibleobject.cpp
index aea2de8e92..561965d021 100644
--- a/indra/newview/llflexibleobject.cpp
+++ b/indra/newview/llflexibleobject.cpp
@@ -51,6 +51,9 @@
 
 /*static*/ F32 LLVolumeImplFlexible::sUpdateFactor = 1.0f;
 
+static LLFastTimer::DeclareTimer FTM_FLEXIBLE_REBUILD("Rebuild");
+static LLFastTimer::DeclareTimer FTM_DO_FLEXIBLE_UPDATE("Update");
+
 // LLFlexibleObjectData::pack/unpack now in llprimitive.cpp
 
 //-----------------------------------------------
@@ -194,7 +197,6 @@ void LLVolumeImplFlexible::remapSections(LLFlexibleObjectSection *source, S32 so
 	}
 }
 
-
 //-----------------------------------------------------------------------------
 void LLVolumeImplFlexible::setAttributesOfAllSections(LLVector3* inScale)
 {
@@ -363,6 +365,7 @@ inline S32 log2(S32 x)
 
 void LLVolumeImplFlexible::doFlexibleUpdate()
 {
+	LLFastTimer ftm(FTM_DO_FLEXIBLE_UPDATE);
 	LLVolume* volume = mVO->getVolume();
 	LLPath *path = &volume->getPath();
 	if (mSimulateRes == 0)
@@ -693,7 +696,10 @@ BOOL LLVolumeImplFlexible::doUpdateGeometry(LLDrawable *drawable)
 	}
 
 	volume->updateRelativeXform();
-	doFlexibleUpdate();
+	{
+		LLFastTimer t(FTM_DO_FLEXIBLE_UPDATE);
+		doFlexibleUpdate();
+	}
 	
 	// Object may have been rotated, which means it needs a rebuild.  See SL-47220
 	BOOL	rotated = FALSE;
@@ -710,7 +716,10 @@ BOOL LLVolumeImplFlexible::doUpdateGeometry(LLDrawable *drawable)
 		volume->regenFaces();
 		volume->mDrawable->setState(LLDrawable::REBUILD_VOLUME);
 		volume->dirtySpatialGroup();
-		doFlexibleRebuild();
+		{
+			LLFastTimer t(FTM_FLEXIBLE_REBUILD);
+			doFlexibleRebuild();
+		}
 		volume->genBBoxes(isVolumeGlobal());
 	}
 	else if (!mUpdated || rotated)
diff --git a/indra/newview/llglsandbox.cpp b/indra/newview/llglsandbox.cpp
index 750a9d478f..8569e208eb 100644
--- a/indra/newview/llglsandbox.cpp
+++ b/indra/newview/llglsandbox.cpp
@@ -897,19 +897,21 @@ void LLViewerObjectList::renderObjectBeacons()
 		S32 last_line_width = -1;
 		// gGL.begin(LLRender::LINES); // Always happens in (line_width != last_line_width)
 		
-		for (S32 i = 0; i < mDebugBeacons.count(); i++)
+		BOOL flush = FALSE;
+		for (std::vector<LLDebugBeacon>::iterator iter = mDebugBeacons.begin(); iter != mDebugBeacons.end(); ++iter)
 		{
-			const LLDebugBeacon &debug_beacon = mDebugBeacons[i];
+			const LLDebugBeacon &debug_beacon = *iter;
 			LLColor4 color = debug_beacon.mColor;
 			color.mV[3] *= 0.25f;
 			S32 line_width = debug_beacon.mLineWidth;
 			if (line_width != last_line_width)
 			{
-				if (i > 0)
+				if (flush)
 				{
 					gGL.end();
-					gGL.flush();
 				}
+				flush = TRUE;
+				gGL.flush();
 				glLineWidth( (F32)line_width );
 				last_line_width = line_width;
 				gGL.begin(LLRender::LINES);
@@ -936,18 +938,20 @@ void LLViewerObjectList::renderObjectBeacons()
 		S32 last_line_width = -1;
 		// gGL.begin(LLRender::LINES); // Always happens in (line_width != last_line_width)
 		
-		for (S32 i = 0; i < mDebugBeacons.count(); i++)
+		BOOL flush = FALSE;
+		for (std::vector<LLDebugBeacon>::iterator iter = mDebugBeacons.begin(); iter != mDebugBeacons.end(); ++iter)
 		{
-			const LLDebugBeacon &debug_beacon = mDebugBeacons[i];
+			const LLDebugBeacon &debug_beacon = *iter;
 
 			S32 line_width = debug_beacon.mLineWidth;
 			if (line_width != last_line_width)
 			{
-				if (i > 0)
+				if (flush)
 				{
 					gGL.end();
-					gGL.flush();
 				}
+				flush = TRUE;
+				gGL.flush();
 				glLineWidth( (F32)line_width );
 				last_line_width = line_width;
 				gGL.begin(LLRender::LINES);
@@ -969,9 +973,9 @@ void LLViewerObjectList::renderObjectBeacons()
 		gGL.flush();
 		glLineWidth(1.f);
 
-		for (S32 i = 0; i < mDebugBeacons.count(); i++)
+		for (std::vector<LLDebugBeacon>::iterator iter = mDebugBeacons.begin(); iter != mDebugBeacons.end(); ++iter)
 		{
-			LLDebugBeacon &debug_beacon = mDebugBeacons[i];
+			LLDebugBeacon &debug_beacon = *iter;
 			if (debug_beacon.mString == "")
 			{
 				continue;
diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp
index 886f1d9ef5..4fdfc37d6c 100644
--- a/indra/newview/llviewerobject.cpp
+++ b/indra/newview/llviewerobject.cpp
@@ -2001,6 +2001,9 @@ BOOL LLViewerObject::isActive() const
 
 BOOL LLViewerObject::idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time)
 {
+	static LLFastTimer::DeclareTimer ftm("Viewer Object");
+	LLFastTimer t(ftm);
+
 	if (mDead)
 	{
 		// It's dead.  Don't update it.
diff --git a/indra/newview/llviewerobjectlist.cpp b/indra/newview/llviewerobjectlist.cpp
index 96828ee1b6..6347090f71 100644
--- a/indra/newview/llviewerobjectlist.cpp
+++ b/indra/newview/llviewerobjectlist.cpp
@@ -93,7 +93,7 @@ extern LLPipeline	gPipeline;
 
 // Statics for object lookup tables.
 U32						LLViewerObjectList::sSimulatorMachineIndex = 1; // Not zero deliberately, to speed up index check.
-LLMap<U64, U32>			LLViewerObjectList::sIPAndPortToIndex;
+std::map<U64, U32>			LLViewerObjectList::sIPAndPortToIndex;
 std::map<U64, LLUUID>	LLViewerObjectList::sIndexAndLocalIDToUUID;
 
 LLViewerObjectList::LLViewerObjectList()
@@ -571,10 +571,9 @@ void LLViewerObjectList::processCachedObjectUpdate(LLMessageSystem *mesgsys,
 
 void LLViewerObjectList::dirtyAllObjectInventory()
 {
-	S32 count = mObjects.count();
-	for(S32 i = 0; i < count; ++i)
+	for (vobj_list_t::iterator iter = mObjects.begin(); iter != mObjects.end(); ++iter)
 	{
-		mObjects[i]->dirtyInventory();
+		(*iter)->dirtyInventory();
 	}
 }
 
@@ -587,14 +586,14 @@ void LLViewerObjectList::updateApparentAngles(LLAgent &agent)
 	S32 num_updates, max_value;
 	if (NUM_BINS - 1 == mCurBin)
 	{
-		num_updates = mObjects.count() - mCurLazyUpdateIndex;
-		max_value = mObjects.count();
+		num_updates = (S32) mObjects.size() - mCurLazyUpdateIndex;
+		max_value = (S32) mObjects.size();
 		gTextureList.setUpdateStats(TRUE);
 	}
 	else
 	{
-		num_updates = (mObjects.count() / NUM_BINS) + 1;
-		max_value = llmin(mObjects.count(), mCurLazyUpdateIndex + num_updates);
+		num_updates = ((S32) mObjects.size() / NUM_BINS) + 1;
+		max_value = llmin((S32) mObjects.size(), mCurLazyUpdateIndex + num_updates);
 	}
 
 
@@ -647,7 +646,7 @@ void LLViewerObjectList::updateApparentAngles(LLAgent &agent)
 	}
 
 	mCurLazyUpdateIndex = max_value;
-	if (mCurLazyUpdateIndex == mObjects.count())
+	if (mCurLazyUpdateIndex == mObjects.size())
 	{
 		mCurLazyUpdateIndex = 0;
 	}
@@ -694,20 +693,26 @@ void LLViewerObjectList::update(LLAgent &agent, LLWorld &world)
 	
 	// Make a copy of the list in case something in idleUpdate() messes with it
 	std::vector<LLViewerObject*> idle_list;
-	idle_list.reserve( mActiveObjects.size() );
+	
+	static LLFastTimer::DeclareTimer idle_copy("Idle Copy");
 
- 	for (std::set<LLPointer<LLViewerObject> >::iterator active_iter = mActiveObjects.begin();
-		active_iter != mActiveObjects.end(); active_iter++)
 	{
-		objectp = *active_iter;
-		if (objectp)
+		LLFastTimer t(idle_copy);
+		idle_list.reserve( mActiveObjects.size() );
+
+ 		for (std::set<LLPointer<LLViewerObject> >::iterator active_iter = mActiveObjects.begin();
+			active_iter != mActiveObjects.end(); active_iter++)
 		{
-			idle_list.push_back( objectp );
-		}
-		else
-		{	// There shouldn't be any NULL pointers in the list, but they have caused
-			// crashes before.  This may be idleUpdate() messing with the list.
-			llwarns << "LLViewerObjectList::update has a NULL objectp" << llendl;
+			objectp = *active_iter;
+			if (objectp)
+			{
+				idle_list.push_back( objectp );
+			}
+			else
+			{	// There shouldn't be any NULL pointers in the list, but they have caused
+				// crashes before.  This may be idleUpdate() messing with the list.
+				llwarns << "LLViewerObjectList::update has a NULL objectp" << llendl;
+			}
 		}
 	}
 
@@ -807,7 +812,7 @@ void LLViewerObjectList::update(LLAgent &agent, LLWorld &world)
 	}
 	*/
 
-	LLViewerStats::getInstance()->mNumObjectsStat.addValue(mObjects.count());
+	LLViewerStats::getInstance()->mNumObjectsStat.addValue((S32) mObjects.size());
 	LLViewerStats::getInstance()->mNumActiveObjectsStat.addValue(num_active_objects);
 	LLViewerStats::getInstance()->mNumSizeCulledStat.addValue(mNumSizeCulled);
 	LLViewerStats::getInstance()->mNumVisCulledStat.addValue(mNumVisCulled);
@@ -815,9 +820,9 @@ void LLViewerObjectList::update(LLAgent &agent, LLWorld &world)
 
 void LLViewerObjectList::clearDebugText()
 {
-	for (S32 i = 0; i < mObjects.count(); i++)
+	for (vobj_list_t::iterator iter = mObjects.begin(); iter != mObjects.end(); ++iter)
 	{
-		mObjects[i]->setDebugText("");
+		(*iter)->setDebugText("");
 	}
 }
 
@@ -856,7 +861,7 @@ void LLViewerObjectList::cleanupReferences(LLViewerObject *objectp)
 
 	if (objectp->isOnMap())
 	{
-		mMapObjects.removeObj(objectp);
+		removeFromMap(objectp);
 	}
 
 	// Don't clean up mObject references, these will be cleaned up more efficiently later!
@@ -913,10 +918,10 @@ void LLViewerObjectList::killObjects(LLViewerRegion *regionp)
 {
 	LLViewerObject *objectp;
 
-	S32 i;
-	for (i = 0; i < mObjects.count(); i++)
+	
+	for (vobj_list_t::iterator iter = mObjects.begin(); iter != mObjects.end(); ++iter)
 	{
-		objectp = mObjects[i];
+		objectp = *iter;
 		
 		if (objectp->mRegionp == regionp)
 		{
@@ -933,10 +938,9 @@ void LLViewerObjectList::killAllObjects()
 	// Used only on global destruction.
 	LLViewerObject *objectp;
 
-	for (S32 i = 0; i < mObjects.count(); i++)
+	for (vobj_list_t::iterator iter = mObjects.begin(); iter != mObjects.end(); ++iter)
 	{
-		objectp = mObjects[i];
-		
+		objectp = *iter;
 		killObject(objectp);
 		llassert(objectp->isDead());
 	}
@@ -945,7 +949,7 @@ void LLViewerObjectList::killAllObjects()
 
 	if(!mObjects.empty())
 	{
-		llwarns << "LLViewerObjectList::killAllObjects still has entries in mObjects: " << mObjects.count() << llendl;
+		llwarns << "LLViewerObjectList::killAllObjects still has entries in mObjects: " << mObjects.size() << llendl;
 		mObjects.clear();
 	}
 
@@ -970,16 +974,15 @@ void LLViewerObjectList::cleanDeadObjects(BOOL use_timer)
 		return;
 	}
 
-	S32 i = 0;
 	S32 num_removed = 0;
 	LLViewerObject *objectp;
-	while (i < mObjects.count())
+	for (vobj_list_t::iterator iter = mObjects.begin(); iter != mObjects.end(); )
 	{
 		// Scan for all of the dead objects and remove any "global" references to them.
-		objectp = mObjects[i];
+		objectp = *iter;
 		if (objectp->isDead())
 		{
-			mObjects.remove(i);
+			iter = mObjects.erase(iter);
 			num_removed++;
 
 			if (num_removed == mNumDeadObjects)
@@ -990,8 +993,7 @@ void LLViewerObjectList::cleanDeadObjects(BOOL use_timer)
 		}
 		else
 		{
-			// iterate, this isn't a dead object.
-			i++;
+			++iter;
 		}
 	}
 
@@ -1041,12 +1043,11 @@ void LLViewerObjectList::shiftObjects(const LLVector3 &offset)
 	}
 
 	LLViewerObject *objectp;
-	S32 i;
-	for (i = 0; i < mObjects.count(); i++)
+	for (vobj_list_t::iterator iter = mObjects.begin(); iter != mObjects.end(); ++iter)
 	{
-		objectp = getObject(i);
+		objectp = *iter;
 		// There could be dead objects on the object list, so don't update stuff if the object is dead.
-		if (objectp)
+		if (!objectp->isDead())
 		{
 			objectp->updatePositionCaches();
 
@@ -1076,9 +1077,9 @@ void LLViewerObjectList::renderObjectsForMap(LLNetMap &netmap)
 
 	F32 max_radius = gSavedSettings.getF32("MiniMapPrimMaxRadius");
 
-	for (S32 i = 0; i < mMapObjects.count(); i++)
+	for (vobj_list_t::iterator iter = mMapObjects.begin(); iter != mMapObjects.end(); ++iter)
 	{
-		LLViewerObject* objectp = mMapObjects[i];
+		LLViewerObject* objectp = *iter;
 		if (!objectp->getRegion() || objectp->isOrphaned() || objectp->isAttachment())
 		{
 			continue;
@@ -1144,21 +1145,14 @@ void LLViewerObjectList::renderObjectBounds(const LLVector3 &center)
 {
 }
 
-void LLViewerObjectList::renderObjectsForSelect(LLCamera &camera, const LLRect& screen_rect, BOOL pick_parcel_wall, BOOL render_transparent)
-{
-	generatePickList(camera);
-	renderPickList(screen_rect, pick_parcel_wall, render_transparent);
-}
-
 void LLViewerObjectList::generatePickList(LLCamera &camera)
 {
 		LLViewerObject *objectp;
 		S32 i;
 		// Reset all of the GL names to zero.
-		for (i = 0; i < mObjects.count(); i++)
+		for (vobj_list_t::iterator iter = mObjects.begin(); iter != mObjects.end(); ++iter)
 		{
-			objectp = mObjects[i];
-			objectp->mGLName = 0;
+			(*iter)->mGLName = 0;
 		}
 
 		mSelectPickList.clear();
@@ -1321,17 +1315,19 @@ void LLViewerObjectList::addDebugBeacon(const LLVector3 &pos_agent,
 										const LLColor4 &text_color,
 										S32 line_width)
 {
-	LLDebugBeacon *beaconp = mDebugBeacons.reserve_block(1);
-	beaconp->mPositionAgent = pos_agent;
-	beaconp->mString = string;
-	beaconp->mColor = color;
-	beaconp->mTextColor = text_color;
-	beaconp->mLineWidth = line_width;
+	LLDebugBeacon beacon;
+	beacon.mPositionAgent = pos_agent;
+	beacon.mString = string;
+	beacon.mColor = color;
+	beacon.mTextColor = text_color;
+	beacon.mLineWidth = line_width;
+
+	mDebugBeacons.push_back(beacon);
 }
 
 void LLViewerObjectList::resetObjectBeacons()
 {
-	mDebugBeacons.reset();
+	mDebugBeacons.clear();
 }
 
 LLViewerObject *LLViewerObjectList::createObjectViewer(const LLPCode pcode, LLViewerRegion *regionp)
@@ -1349,7 +1345,7 @@ LLViewerObject *LLViewerObjectList::createObjectViewer(const LLPCode pcode, LLVi
 
 	mUUIDObjectMap[fullid] = objectp;
 
-	mObjects.put(objectp);
+	mObjects.push_back(objectp);
 
 	updateActive(objectp);
 
@@ -1388,7 +1384,7 @@ LLViewerObject *LLViewerObjectList::createObject(const LLPCode pcode, LLViewerRe
 					gMessageSystem->getSenderIP(),
 					gMessageSystem->getSenderPort());
 
-	mObjects.put(objectp);
+	mObjects.push_back(objectp);
 
 	updateActive(objectp);
 
@@ -1411,11 +1407,11 @@ LLViewerObject *LLViewerObjectList::replaceObject(const LLUUID &id, const LLPCod
 S32 LLViewerObjectList::findReferences(LLDrawable *drawablep) const
 {
 	LLViewerObject *objectp;
-	S32 i;
 	S32 num_refs = 0;
-	for (i = 0; i < mObjects.count(); i++)
+	
+	for (vobj_list_t::const_iterator iter = mObjects.begin(); iter != mObjects.end(); ++iter)
 	{
-		objectp = mObjects[i];
+		objectp = *iter;
 		if (objectp->mDrawable.notNull())
 		{
 			num_refs += objectp->mDrawable->findReferences(drawablep);
@@ -1460,15 +1456,15 @@ void LLViewerObjectList::orphanize(LLViewerObject *childp, U32 parent_id, U32 ip
 	// Unknown parent, add to orpaned child list
 	U64 parent_info = getIndex(parent_id, ip, port);
 
-	if (-1 == mOrphanParents.find(parent_info))
+	if (std::find(mOrphanParents.begin(), mOrphanParents.end(), parent_info) == mOrphanParents.end())
 	{
-		mOrphanParents.put(parent_info);
+		mOrphanParents.push_back(parent_info);
 	}
 
 	LLViewerObjectList::OrphanInfo oi(parent_info, childp->mID);
-	if (-1 == mOrphanChildren.find(oi))
+	if (std::find(mOrphanChildren.begin(), mOrphanChildren.end(), oi) == mOrphanChildren.end())
 	{
-		mOrphanChildren.put(oi);
+		mOrphanChildren.push_back(oi);
 		mNumOrphans++;
 	}
 }
@@ -1491,28 +1487,29 @@ void LLViewerObjectList::findOrphans(LLViewerObject* objectp, U32 ip, U32 port)
 	// See if we are a parent of an orphan.
 	// Note:  This code is fairly inefficient but it should happen very rarely.
 	// It can be sped up if this is somehow a performance issue...
-	if (0 == mOrphanParents.count())
+	if (mOrphanParents.empty())
 	{
 		// no known orphan parents
 		return;
 	}
-	if (-1 == mOrphanParents.find(getIndex(objectp->mLocalID, ip, port)))
+	if (std::find(mOrphanParents.begin(), mOrphanParents.end(), getIndex(objectp->mLocalID, ip, port)) == mOrphanParents.end())
 	{
 		// did not find objectp in OrphanParent list
 		return;
 	}
 
-	S32 i;
 	U64 parent_info = getIndex(objectp->mLocalID, ip, port);
 	BOOL orphans_found = FALSE;
 	// Iterate through the orphan list, and set parents of matching children.
-	for (i = 0; i < mOrphanChildren.count(); i++)
-	{
-		if (mOrphanChildren[i].mParentInfo != parent_info)
+
+	for (std::vector<OrphanInfo>::iterator iter = mOrphanChildren.begin(); iter != mOrphanChildren.end(); )
+	{	
+		if (iter->mParentInfo != parent_info)
 		{
+			++iter;
 			continue;
 		}
-		LLViewerObject *childp = findObject(mOrphanChildren[i].mChildInfo);
+		LLViewerObject *childp = findObject(iter->mChildInfo);
 		if (childp)
 		{
 			if (childp == objectp)
@@ -1546,29 +1543,35 @@ void LLViewerObjectList::findOrphans(LLViewerObject* objectp, U32 ip, U32 port)
 
 			objectp->addChild(childp);
 			orphans_found = TRUE;
+			++iter;
 		}
 		else
 		{
 			llinfos << "Missing orphan child, removing from list" << llendl;
-			mOrphanChildren.remove(i);
-			i--;
+
+			iter = mOrphanChildren.erase(iter);
 		}
 	}
 
 	// Remove orphan parent and children from lists now that they've been found
-	mOrphanParents.remove(mOrphanParents.find(parent_info));
-
-	i = 0;
-	while (i < mOrphanChildren.count())
 	{
-		if (mOrphanChildren[i].mParentInfo == parent_info)
+		std::vector<U64>::iterator iter = std::find(mOrphanParents.begin(), mOrphanParents.end(), parent_info);
+		if (iter != mOrphanParents.end())
+		{
+			mOrphanParents.erase(iter);
+		}
+	}
+	
+	for (std::vector<OrphanInfo>::iterator iter = mOrphanChildren.begin(); iter != mOrphanChildren.end(); )
+	{
+		if (iter->mParentInfo == parent_info)
 		{
-			mOrphanChildren.remove(i);
+			iter = mOrphanChildren.erase(iter);
 			mNumOrphans--;
 		}
 		else
 		{
-			i++;
+			++iter;
 		}
 	}
 
diff --git a/indra/newview/llviewerobjectlist.h b/indra/newview/llviewerobjectlist.h
index ace5c5038e..8d3d2c4b44 100644
--- a/indra/newview/llviewerobjectlist.h
+++ b/indra/newview/llviewerobjectlist.h
@@ -38,8 +38,6 @@
 
 // common includes
 #include "llstat.h"
-#include "lldarrayptr.h"
-#include "llmap.h"			// *TODO: switch to std::map
 #include "llstring.h"
 
 // project includes
@@ -50,7 +48,7 @@ class LLNetMap;
 class LLDebugBeacon;
 
 const U32 CLOSE_BIN_SIZE = 10;
-const U32 NUM_BINS = 16;
+const U32 NUM_BINS = 128;
 
 // GL name = position in object list + GL_NAME_INDEX_OFFSET so that
 // we can have special numbers like zero.
@@ -111,13 +109,12 @@ public:
 	void updateAvatarVisibility();
 
 	// Selection related stuff
-	void renderObjectsForSelect(LLCamera &camera, const LLRect& screen_rect, BOOL pick_parcel_wall = FALSE, BOOL render_transparent = TRUE);
 	void generatePickList(LLCamera &camera);
 	void renderPickList(const LLRect& screen_rect, BOOL pick_parcel_wall, BOOL render_transparent);
 
 	LLViewerObject *getSelectedObject(const U32 object_id);
 
-	inline S32 getNumObjects() { return mObjects.count(); }
+	inline S32 getNumObjects() { return (S32) mObjects.size(); }
 
 	void addToMap(LLViewerObject *objectp);
 	void removeFromMap(LLViewerObject *objectp);
@@ -131,7 +128,7 @@ public:
 
 	S32 findReferences(LLDrawable *drawablep) const; // Find references to drawable in all objects, and return value.
 
-	S32 getOrphanParentCount() const { return mOrphanParents.count(); }
+	S32 getOrphanParentCount() const { return (S32) mOrphanParents.size(); }
 	S32 getOrphanCount() const { return mNumOrphans; }
 	void orphanize(LLViewerObject *childp, U32 parent_id, U32 ip, U32 port);
 	void findOrphans(LLViewerObject* objectp, U32 ip, U32 port);
@@ -179,26 +176,28 @@ public:
 	S32 mNumUnknownKills;
 	S32 mNumDeadObjects;
 protected:
-	LLDynamicArray<U64>	mOrphanParents;	// LocalID/ip,port of orphaned objects
-	LLDynamicArray<OrphanInfo> mOrphanChildren;	// UUID's of orphaned objects
+	std::vector<U64>	mOrphanParents;	// LocalID/ip,port of orphaned objects
+	std::vector<OrphanInfo> mOrphanChildren;	// UUID's of orphaned objects
 	S32 mNumOrphans;
 
-	LLDynamicArrayPtr<LLPointer<LLViewerObject>, 256> mObjects;
+	typedef std::vector<LLPointer<LLViewerObject> > vobj_list_t;
+
+	vobj_list_t mObjects;
 	std::set<LLPointer<LLViewerObject> > mActiveObjects;
 
-	LLDynamicArrayPtr<LLPointer<LLViewerObject> > mMapObjects;
+	vobj_list_t mMapObjects;
 
 	typedef std::map<LLUUID, LLPointer<LLViewerObject> > vo_map;
 	vo_map mDeadObjects;	// Need to keep multiple entries per UUID
 
 	std::map<LLUUID, LLPointer<LLViewerObject> > mUUIDObjectMap;
 
-	LLDynamicArray<LLDebugBeacon> mDebugBeacons;
+	std::vector<LLDebugBeacon> mDebugBeacons;
 
 	S32 mCurLazyUpdateIndex;
 
 	static U32 sSimulatorMachineIndex;
-	static LLMap<U64, U32> sIPAndPortToIndex;
+	static std::map<U64, U32> sIPAndPortToIndex;
 
 	static std::map<U64, LLUUID> sIndexAndLocalIDToUUID;
 
@@ -260,12 +259,16 @@ inline LLViewerObject *LLViewerObjectList::getObject(const S32 index)
 
 inline void LLViewerObjectList::addToMap(LLViewerObject *objectp)
 {
-	mMapObjects.put(objectp);
+	mMapObjects.push_back(objectp);
 }
 
 inline void LLViewerObjectList::removeFromMap(LLViewerObject *objectp)
 {
-	mMapObjects.removeObj(objectp);
+	std::vector<LLPointer<LLViewerObject> >::iterator iter = std::find(mMapObjects.begin(), mMapObjects.end(), objectp);
+	if (iter != mMapObjects.end())
+	{
+		mMapObjects.erase(iter);
+	}
 }
 
 
diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp
index cd6b9e2c50..de4317b2de 100644
--- a/indra/newview/llviewerwindow.cpp
+++ b/indra/newview/llviewerwindow.cpp
@@ -2316,6 +2316,9 @@ void append_xui_tooltip(LLView* viewp, LLToolTip::Params& params)
 // event processing.
 void LLViewerWindow::updateUI()
 {
+	static LLFastTimer::DeclareTimer ftm("Update UI");
+	LLFastTimer t(ftm);
+
 	static std::string last_handle_msg;
 
 	// animate layout stacks so we have up to date rect for world view
@@ -2895,7 +2898,6 @@ void LLViewerWindow::saveLastMouse(const LLCoordGL &point)
 // Must be called after displayObjects is called, which sets the mGLName parameter
 // NOTE: This function gets called 3 times:
 //  render_ui_3d: 			FALSE, FALSE, TRUE
-//  renderObjectsForSelect:	TRUE, pick_parcel_wall, FALSE
 //  render_hud_elements:	FALSE, FALSE, FALSE
 void LLViewerWindow::renderSelections( BOOL for_gl_pick, BOOL pick_parcel_walls, BOOL for_hud )
 {
diff --git a/indra/newview/llvoclouds.cpp b/indra/newview/llvoclouds.cpp
index 177cb16c50..5153cef709 100644
--- a/indra/newview/llvoclouds.cpp
+++ b/indra/newview/llvoclouds.cpp
@@ -77,9 +77,11 @@ BOOL LLVOClouds::isActive() const
 	return TRUE;
 }
 
-
 BOOL LLVOClouds::idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time)
 {
+	static LLFastTimer::DeclareTimer ftm("Idle Clouds");
+	LLFastTimer t(ftm);
+
 	if (!(gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_CLOUDS)))
 	{
 		return TRUE;
diff --git a/indra/newview/llvotextbubble.cpp b/indra/newview/llvotextbubble.cpp
index 75beab519e..428ef20006 100644
--- a/indra/newview/llvotextbubble.cpp
+++ b/indra/newview/llvotextbubble.cpp
@@ -84,6 +84,9 @@ BOOL LLVOTextBubble::isActive() const
 
 BOOL LLVOTextBubble::idleUpdate(LLAgent &agent, LLWorld	&world, const F64 &time)
 {
+	static LLFastTimer::DeclareTimer ftm("Text Bubble");
+	LLFastTimer t(ftm);
+
 	F32 dt = mUpdateTimer.getElapsedTimeF32();
 	// Die after a few seconds.
 	if (dt > 1.5f)
diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp
index bfe38c14ba..3cdf485d7d 100644
--- a/indra/newview/llvovolume.cpp
+++ b/indra/newview/llvovolume.cpp
@@ -597,6 +597,9 @@ BOOL LLVOVolume::idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time)
 {
 	LLViewerObject::idleUpdate(agent, world, time);
 
+	static LLFastTimer::DeclareTimer ftm("Volume");
+	LLFastTimer t(ftm);
+
 	if (mDead || mDrawable.isNull())
 	{
 		return TRUE;
@@ -618,6 +621,18 @@ BOOL LLVOVolume::idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time)
 		mVolumeImpl->doIdleUpdate(agent, world, time);
 	}
 
+	const S32 MAX_ACTIVE_OBJECT_QUIET_FRAMES = 40;
+
+	if (mDrawable->isActive())
+	{
+		if (mDrawable->isRoot() && 
+			mDrawable->mQuietCount++ > MAX_ACTIVE_OBJECT_QUIET_FRAMES && 
+			(!mDrawable->getParent() || !mDrawable->getParent()->isActive()))
+		{
+			mDrawable->makeStatic();
+		}
+	}
+
 	return TRUE;
 }
 
@@ -1035,7 +1050,7 @@ BOOL LLVOVolume::calcLOD()
 	S32 cur_detail = 0;
 	
 	F32 radius = getVolume()->mLODScaleBias.scaledVec(getScale()).length();
-	F32 distance = llmin(mDrawable->mDistanceWRTCamera, MAX_LOD_DISTANCE);
+	F32 distance = mDrawable->mDistanceWRTCamera; //llmin(mDrawable->mDistanceWRTCamera, MAX_LOD_DISTANCE);
 	distance *= sDistanceFactor;
 			
 	F32 rampDist = LLVOVolume::sLODFactor * 2;
diff --git a/indra/newview/llworld.cpp b/indra/newview/llworld.cpp
index 118d7f8d08..d7e5b464a6 100644
--- a/indra/newview/llworld.cpp
+++ b/indra/newview/llworld.cpp
@@ -657,6 +657,9 @@ void LLWorld::updateParticles()
 
 void LLWorld::updateClouds(const F32 dt)
 {
+	static LLFastTimer::DeclareTimer ftm("World Clouds");
+	LLFastTimer t(ftm);
+
 	if (gSavedSettings.getBOOL("FreezeTime") ||
 		!gSavedSettings.getBOOL("SkyUseClassicClouds"))
 	{
diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp
index 4f4fc83819..d5f87b73fe 100644
--- a/indra/newview/pipeline.cpp
+++ b/indra/newview/pipeline.cpp
@@ -116,7 +116,6 @@ const F32 BACKLIGHT_DAY_MAGNITUDE_AVATAR = 0.2f;
 const F32 BACKLIGHT_NIGHT_MAGNITUDE_AVATAR = 0.1f;
 const F32 BACKLIGHT_DAY_MAGNITUDE_OBJECT = 0.1f;
 const F32 BACKLIGHT_NIGHT_MAGNITUDE_OBJECT = 0.08f;
-const S32 MAX_ACTIVE_OBJECT_QUIET_FRAMES = 40;
 const S32 MAX_OFFSCREEN_GEOMETRY_CHANGES_PER_FRAME = 10;
 const U32 REFLECTION_MAP_RES = 128;
 
@@ -1411,38 +1410,26 @@ void LLPipeline::updateMove()
 
 	assertInitialized();
 
-	for (LLDrawable::drawable_set_t::iterator iter = mRetexturedList.begin();
-		 iter != mRetexturedList.end(); ++iter)
 	{
-		LLDrawable* drawablep = *iter;
-		if (drawablep && !drawablep->isDead())
-		{
-			drawablep->updateTexture();
-		}
-	}
-	mRetexturedList.clear();
+		static LLFastTimer::DeclareTimer ftm("Retexture");
+		LLFastTimer t(ftm);
 
-	updateMovedList(mMovedList);
-
-	for (LLDrawable::drawable_set_t::iterator iter = mActiveQ.begin();
-		 iter != mActiveQ.end(); )
-	{
-		LLDrawable::drawable_set_t::iterator curiter = iter++;
-		LLDrawable* drawablep = *curiter;
-		if (drawablep && !drawablep->isDead()) 
+		for (LLDrawable::drawable_set_t::iterator iter = mRetexturedList.begin();
+			 iter != mRetexturedList.end(); ++iter)
 		{
-			if (drawablep->isRoot() && 
-				drawablep->mQuietCount++ > MAX_ACTIVE_OBJECT_QUIET_FRAMES && 
-				(!drawablep->getParent() || !drawablep->getParent()->isActive()))
+			LLDrawable* drawablep = *iter;
+			if (drawablep && !drawablep->isDead())
 			{
-				drawablep->makeStatic(); // removes drawable and its children from mActiveQ
-				iter = mActiveQ.upper_bound(drawablep); // next valid entry
+				drawablep->updateTexture();
 			}
 		}
-		else
-		{
-			mActiveQ.erase(curiter);
-		}
+		mRetexturedList.clear();
+	}
+
+	{
+		static LLFastTimer::DeclareTimer ftm("Moved List");
+		LLFastTimer t(ftm);
+		updateMovedList(mMovedList);
 	}
 
 	//balance octrees
@@ -3058,12 +3045,6 @@ void LLPipeline::renderGeom(LLCamera& camera, BOOL forceVBOUpdate)
 		}
 	}
 
-	if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_PICKING))
-	{
-		LLAppViewer::instance()->pingMainloopTimeout("Pipeline:RenderForSelect");
-		gObjectList.renderObjectsForSelect(camera, gViewerWindow->getWindowRectScaled());
-	}
-	else
 	{
 		LLFastTimer t(FTM_POOLS);
 		
@@ -4797,10 +4778,6 @@ void LLPipeline::findReferences(LLDrawable *drawablep)
 		llinfos << "In mRetexturedList" << llendl;
 	}
 	
-	if (mActiveQ.find(drawablep) != mActiveQ.end())
-	{
-		llinfos << "In mActiveQ" << llendl;
-	}
 	if (std::find(mBuildQ1.begin(), mBuildQ1.end(), drawablep) != mBuildQ1.end())
 	{
 		llinfos << "In mBuildQ1" << llendl;
@@ -4957,19 +4934,6 @@ void LLPipeline::setLight(LLDrawable *drawablep, BOOL is_light)
 	}
 }
 
-void LLPipeline::setActive(LLDrawable *drawablep, BOOL active)
-{
-	assertInitialized();
-	if (active)
-	{
-		mActiveQ.insert(drawablep);
-	}
-	else
-	{
-		mActiveQ.erase(drawablep);
-	}
-}
-
 //static
 void LLPipeline::toggleRenderType(U32 type)
 {
diff --git a/indra/newview/pipeline.h b/indra/newview/pipeline.h
index 67004a5f2d..c5285943e8 100644
--- a/indra/newview/pipeline.h
+++ b/indra/newview/pipeline.h
@@ -270,8 +270,7 @@ public:
 	void shiftObjects(const LLVector3 &offset);
 
 	void setLight(LLDrawable *drawablep, BOOL is_light);
-	void setActive(LLDrawable *drawablep, BOOL active);
-
+	
 	BOOL hasRenderBatches(const U32 type) const;
 	LLCullResult::drawinfo_list_t::iterator beginRenderMap(U32 type);
 	LLCullResult::drawinfo_list_t::iterator endRenderMap(U32 type);
@@ -589,8 +588,6 @@ protected:
 
 	LLViewerObject::vobj_list_t		mCreateQ;
 		
-	LLDrawable::drawable_set_t		mActiveQ;
-	
 	LLDrawable::drawable_set_t		mRetexturedList;
 
 	class HighlightItem
-- 
cgit v1.2.3


From 979ddb2ec952f836f7cde7cbc85559b8e9582416 Mon Sep 17 00:00:00 2001
From: Dave Parks <davep@lindenlab.com>
Date: Thu, 4 Feb 2010 23:41:54 -0600
Subject: No more matrix ops in UI code.

---
 indra/llrender/llfontgl.cpp      |  30 ++++-------
 indra/llrender/llrender.cpp      | 106 ++++++++++++++++++++++++++++++++++--
 indra/llrender/llrender.h        |  18 ++++++-
 indra/llui/lltabcontainer.cpp    |  12 ++---
 indra/llui/llui.cpp              | 112 +++++++++++++++++++++++++--------------
 indra/llui/llviewborder.cpp      |  58 --------------------
 indra/llui/llviewborder.h        |   3 +-
 indra/newview/llhudrender.cpp    |  12 ++---
 indra/newview/llhudtext.cpp      |   2 +-
 indra/newview/llmediactrl.cpp    |   8 +--
 indra/newview/llnetmap.cpp       |  15 ++++++
 indra/newview/llviewerwindow.cpp |  14 ++++-
 12 files changed, 249 insertions(+), 141 deletions(-)

(limited to 'indra')

diff --git a/indra/llrender/llfontgl.cpp b/indra/llrender/llfontgl.cpp
index 1de1d6ded4..129f3e7999 100644
--- a/indra/llrender/llfontgl.cpp
+++ b/indra/llrender/llfontgl.cpp
@@ -151,14 +151,16 @@ S32 LLFontGL::render(const LLWString &wstr, S32 begin_offset, F32 x, F32 y, cons
 		}
 	}
 
-	gGL.pushMatrix();
-	glLoadIdentity();
-	gGL.translatef(floorf(sCurOrigin.mX*sScaleX), floorf(sCurOrigin.mY*sScaleY), sCurOrigin.mZ);
+	gGL.pushUIMatrix();
+
+	gGL.loadUIIdentity();
+	
+	gGL.translateUI(floorf(sCurOrigin.mX*sScaleX), floorf(sCurOrigin.mY*sScaleY), sCurOrigin.mZ);
 
 	// this code snaps the text origin to a pixel grid to start with
 	F32 pixel_offset_x = llround((F32)sCurOrigin.mX) - (sCurOrigin.mX);
 	F32 pixel_offset_y = llround((F32)sCurOrigin.mY) - (sCurOrigin.mY);
-	gGL.translatef(-pixel_offset_x, -pixel_offset_y, 0.f);
+	gGL.translateUI(-pixel_offset_x, -pixel_offset_y, 0.f);
 
 	LLFastTimer t(FTM_RENDER_FONTS);
 
@@ -246,9 +248,6 @@ S32 LLFontGL::render(const LLWString &wstr, S32 begin_offset, F32 x, F32 y, cons
 	}
 
 
-	// Remember last-used texture to avoid unnecesssary bind calls.
-	LLImageGL *last_bound_texture = NULL;
-
 	for (i = begin_offset; i < begin_offset + length; i++)
 	{
 		llwchar wch = wstr[i];
@@ -261,12 +260,8 @@ S32 LLFontGL::render(const LLWString &wstr, S32 begin_offset, F32 x, F32 y, cons
 		}
 		// Per-glyph bitmap texture.
 		LLImageGL *image_gl = mFontFreetype->getFontBitmapCache()->getImageGL(fgi->mBitmapNum);
-		if (last_bound_texture != image_gl)
-		{
-			gGL.getTexUnit(0)->bind(image_gl);
-			last_bound_texture = image_gl;
-		}
-
+		gGL.getTexUnit(0)->bind(image_gl);
+	
 		if ((start_x + scaled_max_pixels) < (cur_x + fgi->mXBearing + fgi->mWidth))
 		{
 			// Not enough room for this character.
@@ -330,10 +325,7 @@ S32 LLFontGL::render(const LLWString &wstr, S32 begin_offset, F32 x, F32 y, cons
 		
 		// recursively render ellipses at end of string
 		// we've already reserved enough room
-		gGL.pushMatrix();
-		//glLoadIdentity();
-		//gGL.translatef(sCurOrigin.mX, sCurOrigin.mY, 0.0f);
-		//glScalef(sScaleX, sScaleY, 1.f);
+		gGL.pushUIMatrix();
 		renderUTF8(std::string("..."), 
 				0,
 				cur_x / sScaleX, (F32)y,
@@ -344,10 +336,10 @@ S32 LLFontGL::render(const LLWString &wstr, S32 begin_offset, F32 x, F32 y, cons
 				S32_MAX, max_pixels,
 				right_x,
 				FALSE); 
-		gGL.popMatrix();
+		gGL.popUIMatrix();
 	}
 
-	gGL.popMatrix();
+	gGL.popUIMatrix();
 
 	return chars_drawn;
 }
diff --git a/indra/llrender/llrender.cpp b/indra/llrender/llrender.cpp
index f97d81126e..cde60b7e25 100644
--- a/indra/llrender/llrender.cpp
+++ b/indra/llrender/llrender.cpp
@@ -49,6 +49,9 @@ F64 gGLLastProjection[16];
 F64 gGLProjection[16];
 S32	gGLViewport[4];
 
+U32 LLRender::sUICalls = 0;
+U32 LLRender::sUIVerts = 0;
+
 static const U32 LL_NUM_TEXTURE_LAYERS = 16; 
 
 static GLenum sGLTextureType[] =
@@ -255,10 +258,9 @@ bool LLTexUnit::bind(LLImageGL* texture, bool for_rendering, bool forceBind)
 		return false ;
 	}
 
-	gGL.flush();
-
 	if ((mCurrTexture != texture->getTexName()) || forceBind)
 	{
+		gGL.flush();
 		activate();
 		enable(texture->getTarget());
 		mCurrTexture = texture->getTexName();
@@ -445,6 +447,8 @@ void LLTexUnit::setTextureBlendType(eTextureBlendType type)
 		return;
 	}
 
+	gGL.flush();
+
 	activate();
 	mCurrBlendType = type;
 	S32 scale_amount = 1;
@@ -756,6 +760,7 @@ LLRender::LLRender()
 
 	mCurrAlphaFunc = CF_DEFAULT;
 	mCurrAlphaFuncVal = 0.01f;
+	mCurrSceneBlendType = BT_ALPHA;
 }
 
 LLRender::~LLRender()
@@ -818,6 +823,80 @@ void LLRender::popMatrix()
 	glPopMatrix();
 }
 
+void LLRender::translateUI(F32 x, F32 y, F32 z)
+{
+	if (mUIOffset.empty())
+	{
+		llerrs << "Need to push a UI translation frame before offsetting" << llendl;
+	}
+
+	mUIOffset.front().mV[0] += x;
+	mUIOffset.front().mV[1] += y;
+	mUIOffset.front().mV[2] += z;
+}
+
+void LLRender::scaleUI(F32 x, F32 y, F32 z)
+{
+	if (mUIScale.empty())
+	{
+		llerrs << "Need to push a UI transformation frame before scaling." << llendl;
+	}
+
+	mUIScale.front().scaleVec(LLVector3(x,y,z));
+}
+
+void LLRender::pushUIMatrix()
+{
+	mUIOffset.push_front(mUIOffset.front());
+	if (mUIScale.empty())
+	{
+		mUIScale.push_front(LLVector3(1,1,1));
+	}
+	else
+	{
+		mUIScale.push_front(mUIScale.front());
+	}
+}
+
+void LLRender::popUIMatrix()
+{
+	if (mUIOffset.empty())
+	{
+		llerrs << "UI offset stack blown." << llendl;
+	}
+	mUIOffset.pop_front();
+	mUIScale.pop_front();
+}
+
+LLVector3 LLRender::getUITranslation()
+{
+	if (mUIOffset.empty())
+	{
+		llerrs << "UI offset stack empty." << llendl;
+	}
+	return mUIOffset.front();
+}
+
+LLVector3 LLRender::getUIScale()
+{
+	if (mUIScale.empty())
+	{
+		llerrs << "UI scale stack empty." << llendl;
+	}
+	return mUIScale.front();
+}
+
+
+void LLRender::loadUIIdentity()
+{
+	if (mUIOffset.empty())
+	{
+		llerrs << "Need to push UI translation frame before clearing offset." << llendl;
+	}
+	mUIOffset.front().setVec(0,0,0);
+	mUIScale.front().setVec(1,1,1);
+}
+
 void LLRender::setColorMask(bool writeColor, bool writeAlpha)
 {
 	setColorMask(writeColor, writeColor, writeColor, writeAlpha);
@@ -840,6 +919,11 @@ void LLRender::setColorMask(bool writeColorR, bool writeColorG, bool writeColorB
 
 void LLRender::setSceneBlendType(eBlendType type)
 {
+	if (mCurrSceneBlendType == type)
+	{
+		return;
+	}
+
 	flush();
 	switch (type) 
 	{
@@ -868,6 +952,7 @@ void LLRender::setSceneBlendType(eBlendType type)
 			llerrs << "Unknown Scene Blend Type: " << type << llendl;
 			break;
 	}
+	mCurrSceneBlendType = type;
 }
 
 void LLRender::setAlphaRejectSettings(eCompareFunc func, F32 value)
@@ -1009,6 +1094,12 @@ void LLRender::flush()
 		}
 #endif
 				
+		if (!mUIOffset.empty())
+		{
+			sUICalls++;
+			sUIVerts += mCount;
+		}
+
 		mBuffer->setBuffer(immediate_mask);
 		mBuffer->drawArrays(mMode, 0, mCount);
 		
@@ -1028,7 +1119,16 @@ void LLRender::vertex3f(const GLfloat& x, const GLfloat& y, const GLfloat& z)
 		return;
 	}
 
-	mVerticesp[mCount] = LLVector3(x,y,z);
+	if (mUIOffset.empty())
+	{
+		mVerticesp[mCount] = LLVector3(x,y,z);
+	}
+	else
+	{
+		LLVector3 vert = (LLVector3(x,y,z)+mUIOffset.front()).scaledVec(mUIScale.front());
+		mVerticesp[mCount] = vert;
+	}
+
 	mCount++;
 	if (mCount < 4096)
 	{
diff --git a/indra/llrender/llrender.h b/indra/llrender/llrender.h
index 0121a190ee..6e38fac67b 100644
--- a/indra/llrender/llrender.h
+++ b/indra/llrender/llrender.h
@@ -286,6 +286,14 @@ public:
 	void pushMatrix();
 	void popMatrix();
 
+	void translateUI(F32 x, F32 y, F32 z);
+	void scaleUI(F32 x, F32 y, F32 z);
+	void pushUIMatrix();
+	void popUIMatrix();
+	void loadUIIdentity();
+	LLVector3 getUITranslation();
+	LLVector3 getUIScale();
+
 	void flush();
 
 	void begin(const GLuint& mode);
@@ -333,7 +341,9 @@ public:
 	};
 
 public:
-
+	static U32 sUICalls;
+	static U32 sUIVerts;
+	
 private:
 	bool				mDirty;
 	U32				mCount;
@@ -350,7 +360,13 @@ private:
 	std::vector<LLTexUnit*>		mTexUnits;
 	LLTexUnit*			mDummyTexUnit;
 
+	U32				mCurrSceneBlendType;
+
 	F32				mMaxAnisotropy;
+
+	std::list<LLVector3> mUIOffset;
+	std::list<LLVector3> mUIScale;
+
 };
 
 extern F64 gGLModelView[16];
diff --git a/indra/llui/lltabcontainer.cpp b/indra/llui/lltabcontainer.cpp
index 6be76605fd..f11bc2173c 100644
--- a/indra/llui/lltabcontainer.cpp
+++ b/indra/llui/lltabcontainer.cpp
@@ -402,15 +402,15 @@ void LLTabContainer::draw()
 		if( mIsVertical && has_scroll_arrows )
 		{
 			// Redraw the arrows so that they appears on top.
-			gGL.pushMatrix();
-			gGL.translatef((F32)mPrevArrowBtn->getRect().mLeft, (F32)mPrevArrowBtn->getRect().mBottom, 0.f);
+			gGL.pushUIMatrix();
+			gGL.translateUI((F32)mPrevArrowBtn->getRect().mLeft, (F32)mPrevArrowBtn->getRect().mBottom, 0.f);
 			mPrevArrowBtn->draw();
-			gGL.popMatrix();
+			gGL.popUIMatrix();
 
-			gGL.pushMatrix();
-			gGL.translatef((F32)mNextArrowBtn->getRect().mLeft, (F32)mNextArrowBtn->getRect().mBottom, 0.f);
+			gGL.pushUIMatrix();
+			gGL.translateUI((F32)mNextArrowBtn->getRect().mLeft, (F32)mNextArrowBtn->getRect().mBottom, 0.f);
 			mNextArrowBtn->draw();
-			gGL.popMatrix();
+			gGL.popUIMatrix();
 		}
 	}
 
diff --git a/indra/llui/llui.cpp b/indra/llui/llui.cpp
index d0ed3b6fca..0e2e8bf8ed 100644
--- a/indra/llui/llui.cpp
+++ b/indra/llui/llui.cpp
@@ -39,6 +39,7 @@
 
 // Linden library includes
 #include "v2math.h"
+#include "m3math.h"
 #include "v4color.h"
 #include "llrender.h"
 #include "llrect.h"
@@ -180,19 +181,19 @@ void gl_rect_2d_offset_local( S32 left, S32 top, S32 right, S32 bottom, const LL
 
 void gl_rect_2d_offset_local( S32 left, S32 top, S32 right, S32 bottom, S32 pixel_offset, BOOL filled)
 {
-	gGL.pushMatrix();
+	gGL.pushUIMatrix();
 	left += LLFontGL::sCurOrigin.mX;
 	right += LLFontGL::sCurOrigin.mX;
 	bottom += LLFontGL::sCurOrigin.mY;
 	top += LLFontGL::sCurOrigin.mY;
 
-	glLoadIdentity();
+	gGL.loadUIIdentity();
 	gl_rect_2d(llfloor((F32)left * LLUI::sGLScaleFactor.mV[VX]) - pixel_offset,
 				llfloor((F32)top * LLUI::sGLScaleFactor.mV[VY]) + pixel_offset,
 				llfloor((F32)right * LLUI::sGLScaleFactor.mV[VX]) + pixel_offset,
 				llfloor((F32)bottom * LLUI::sGLScaleFactor.mV[VY]) - pixel_offset,
 				filled);
-	gGL.popMatrix();
+	gGL.popUIMatrix();
 }
 
 
@@ -508,9 +509,9 @@ void gl_draw_scaled_image_with_border(S32 x, S32 y, S32 width, S32 height, LLTex
 		gGL.getTexUnit(0)->setTextureAlphaBlend(LLTexUnit::TBO_MULT, LLTexUnit::TBS_TEX_ALPHA, LLTexUnit::TBS_VERT_ALPHA);
 	}
 
-	gGL.pushMatrix();
+	gGL.pushUIMatrix();
 	{
-		gGL.translatef((F32)x, (F32)y, 0.f);
+		gGL.translateUI((F32)x, (F32)y, 0.f);
 
 		gGL.getTexUnit(0)->bind(image);
 
@@ -637,7 +638,7 @@ void gl_draw_scaled_image_with_border(S32 x, S32 y, S32 width, S32 height, LLTex
 		}
 		gGL.end();
 	}
-	gGL.popMatrix();
+	gGL.popUIMatrix();
 
 	if (solid_color)
 	{
@@ -660,39 +661,72 @@ void gl_draw_scaled_rotated_image(S32 x, S32 y, S32 width, S32 height, F32 degre
 
 	LLGLSUIDefault gls_ui;
 
-	gGL.pushMatrix();
+
+	gGL.getTexUnit(0)->bind(image);
+
+	gGL.color4fv(color.mV);
+
+	if (degrees == 0.f)
 	{
-		gGL.translatef((F32)x, (F32)y, 0.f);
-		if( degrees )
+		gGL.pushUIMatrix();
+		gGL.translateUI((F32)x, (F32)y, 0.f);
+			
+		gGL.begin(LLRender::QUADS);
 		{
-			F32 offset_x = F32(width/2);
-			F32 offset_y = F32(height/2);
-			gGL.translatef( offset_x, offset_y, 0.f);
-			glRotatef( degrees, 0.f, 0.f, 1.f );
-			gGL.translatef( -offset_x, -offset_y, 0.f );
+			gGL.texCoord2f(uv_rect.mRight, uv_rect.mTop);
+			gGL.vertex2i(width, height );
+
+			gGL.texCoord2f(uv_rect.mLeft, uv_rect.mTop);
+			gGL.vertex2i(0, height );
+
+			gGL.texCoord2f(uv_rect.mLeft, uv_rect.mBottom);
+			gGL.vertex2i(0, 0);
+
+			gGL.texCoord2f(uv_rect.mRight, uv_rect.mBottom);
+			gGL.vertex2i(width, 0);
 		}
+		gGL.end();
+		gGL.popUIMatrix();
+	}
+	else
+	{
+		gGL.pushUIMatrix();
+		gGL.translateUI((F32)x, (F32)y, 0.f);
+	
+		F32 offset_x = F32(width/2);
+		F32 offset_y = F32(height/2);
+
+		gGL.translateUI(offset_x, offset_y, 0.f);
 
+		LLMatrix3 quat(0.f, 0.f, degrees*DEG_TO_RAD);
+		
 		gGL.getTexUnit(0)->bind(image);
 
 		gGL.color4fv(color.mV);
 		
 		gGL.begin(LLRender::QUADS);
 		{
+			LLVector3 v;
+
+			v = LLVector3(offset_x, offset_y, 0.f) * quat;
 			gGL.texCoord2f(uv_rect.mRight, uv_rect.mTop);
-			gGL.vertex2i(width, height );
+			gGL.vertex2i(v.mV[0], v.mV[1] );
 
+			v = LLVector3(-offset_x, offset_y, 0.f) * quat;
 			gGL.texCoord2f(uv_rect.mLeft, uv_rect.mTop);
-			gGL.vertex2i(0, height );
+			gGL.vertex2i(v.mV[0], v.mV[1] );
 
+			v = LLVector3(-offset_x, -offset_y, 0.f) * quat;
 			gGL.texCoord2f(uv_rect.mLeft, uv_rect.mBottom);
-			gGL.vertex2i(0, 0);
+			gGL.vertex2i(v.mV[0], v.mV[1] );
 
+			v = LLVector3(offset_x, -offset_y, 0.f) * quat;
 			gGL.texCoord2f(uv_rect.mRight, uv_rect.mBottom);
-			gGL.vertex2i(width, 0);
+			gGL.vertex2i(v.mV[0], v.mV[1] );
 		}
 		gGL.end();
+		gGL.popUIMatrix();
 	}
-	gGL.popMatrix();
 }
 
 
@@ -747,9 +781,9 @@ void gl_arc_2d(F32 center_x, F32 center_y, F32 radius, S32 steps, BOOL filled, F
 		end_angle += F_TWO_PI;
 	}
 
-	gGL.pushMatrix();
+	gGL.pushUIMatrix();
 	{
-		gGL.translatef(center_x, center_y, 0.f);
+		gGL.translateUI(center_x, center_y, 0.f);
 
 		// Inexact, but reasonably fast.
 		F32 delta = (end_angle - start_angle) / steps;
@@ -780,15 +814,15 @@ void gl_arc_2d(F32 center_x, F32 center_y, F32 radius, S32 steps, BOOL filled, F
 		}
 		gGL.end();
 	}
-	gGL.popMatrix();
+	gGL.popUIMatrix();
 }
 
 void gl_circle_2d(F32 center_x, F32 center_y, F32 radius, S32 steps, BOOL filled)
 {
-	gGL.pushMatrix();
+	gGL.pushUIMatrix();
 	{
 		gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
-		gGL.translatef(center_x, center_y, 0.f);
+		gGL.translateUI(center_x, center_y, 0.f);
 
 		// Inexact, but reasonably fast.
 		F32 delta = F_TWO_PI / steps;
@@ -819,7 +853,7 @@ void gl_circle_2d(F32 center_x, F32 center_y, F32 radius, S32 steps, BOOL filled
 		}
 		gGL.end();
 	}
-	gGL.popMatrix();
+	gGL.popUIMatrix();
 }
 
 // Renders a ring with sides (tube shape)
@@ -846,9 +880,9 @@ void gl_deep_circle( F32 radius, F32 depth, S32 steps )
 
 void gl_ring( F32 radius, F32 width, const LLColor4& center_color, const LLColor4& side_color, S32 steps, BOOL render_center )
 {
-	gGL.pushMatrix();
+	gGL.pushUIMatrix();
 	{
-		gGL.translatef(0.f, 0.f, -width / 2);
+		gGL.translateUI(0.f, 0.f, -width / 2);
 		if( render_center )
 		{
 			gGL.color4fv(center_color.mV);
@@ -857,11 +891,11 @@ void gl_ring( F32 radius, F32 width, const LLColor4& center_color, const LLColor
 		else
 		{
 			gl_washer_2d(radius, radius - width, steps, side_color, side_color);
-			gGL.translatef(0.f, 0.f, width);
+			gGL.translateUI(0.f, 0.f, width);
 			gl_washer_2d(radius - width, radius, steps, side_color, side_color);
 		}
 	}
-	gGL.popMatrix();
+	gGL.popUIMatrix();
 }
 
 // Draw gray and white checkerboard with black border
@@ -1050,9 +1084,9 @@ void gl_segmented_rect_2d_tex(const S32 left,
 	S32 width = llabs(right - left);
 	S32 height = llabs(top - bottom);
 
-	gGL.pushMatrix();
+	gGL.pushUIMatrix();
 
-	gGL.translatef((F32)left, (F32)bottom, 0.f);
+	gGL.translateUI((F32)left, (F32)bottom, 0.f);
 	LLVector2 border_uv_scale((F32)border_size / (F32)texture_width, (F32)border_size / (F32)texture_height);
 
 	if (border_uv_scale.mV[VX] > 0.5f)
@@ -1193,7 +1227,7 @@ void gl_segmented_rect_2d_tex(const S32 left,
 	}
 	gGL.end();
 
-	gGL.popMatrix();
+	gGL.popUIMatrix();
 }
 
 void gl_segmented_rect_2d_fragment_tex(const S32 left, 
@@ -1210,9 +1244,9 @@ void gl_segmented_rect_2d_fragment_tex(const S32 left,
 	S32 width = llabs(right - left);
 	S32 height = llabs(top - bottom);
 
-	gGL.pushMatrix();
+	gGL.pushUIMatrix();
 
-	gGL.translatef((F32)left, (F32)bottom, 0.f);
+	gGL.translateUI((F32)left, (F32)bottom, 0.f);
 	LLVector2 border_uv_scale((F32)border_size / (F32)texture_width, (F32)border_size / (F32)texture_height);
 
 	if (border_uv_scale.mV[VX] > 0.5f)
@@ -1383,7 +1417,7 @@ void gl_segmented_rect_2d_fragment_tex(const S32 left,
 	}
 	gGL.end();
 
-	gGL.popMatrix();
+	gGL.popUIMatrix();
 }
 
 void gl_segmented_rect_3d_tex(const LLVector2& border_scale, const LLVector3& border_width, 
@@ -1591,7 +1625,7 @@ void LLUI::dirtyRect(LLRect rect)
 //static
 void LLUI::translate(F32 x, F32 y, F32 z)
 {
-	gGL.translatef(x,y,z);
+	gGL.translateUI(x,y,z);
 	LLFontGL::sCurOrigin.mX += (S32) x;
 	LLFontGL::sCurOrigin.mY += (S32) y;
 	LLFontGL::sCurOrigin.mZ += z;
@@ -1600,14 +1634,14 @@ void LLUI::translate(F32 x, F32 y, F32 z)
 //static
 void LLUI::pushMatrix()
 {
-	gGL.pushMatrix();
+	gGL.pushUIMatrix();
 	LLFontGL::sOriginStack.push_back(LLFontGL::sCurOrigin);
 }
 
 //static
 void LLUI::popMatrix()
 {
-	gGL.popMatrix();
+	gGL.popUIMatrix();
 	LLFontGL::sCurOrigin = *LLFontGL::sOriginStack.rbegin();
 	LLFontGL::sOriginStack.pop_back();
 }
@@ -1615,7 +1649,7 @@ void LLUI::popMatrix()
 //static 
 void LLUI::loadIdentity()
 {
-	glLoadIdentity();
+	gGL.loadUIIdentity(); 
 	LLFontGL::sCurOrigin.mX = 0;
 	LLFontGL::sCurOrigin.mY = 0;
 	LLFontGL::sCurOrigin.mZ = 0;
diff --git a/indra/llui/llviewborder.cpp b/indra/llui/llviewborder.cpp
index 30717f87de..bd9c43c97f 100644
--- a/indra/llui/llviewborder.cpp
+++ b/indra/llui/llviewborder.cpp
@@ -125,14 +125,6 @@ void LLViewBorder::draw()
 			llassert( FALSE );  // not implemented
 		}
 	}
-	else
-	if( STYLE_TEXTURE == mStyle )
-	{
-		if( mTexture )
-		{
-			drawTextures();
-		}
-	}
 
 	LLView::draw();
 }
@@ -255,56 +247,6 @@ void LLViewBorder::drawTwoPixelLines()
 	gl_line_2d(left+1, bottom+1, right-1, bottom+1);
 }
 
-void LLViewBorder::drawTextures()
-{
-	//LLGLSUIDefault gls_ui;
-
-	//llassert( FALSE );  // TODO: finish implementing
-
-	//gGL.color4fv(UI_VERTEX_COLOR.mV);
-
-	//gGL.getTexUnit(0)->bind(mTexture);
-	//gGL.getTexUnit(0)->setTextureAddressMode(LLTexUnit::TAM_WRAP);
-
-	//drawTextureTrapezoid(   0.f, mBorderWidth, getRect().getWidth(),  0,					0 );
-	//drawTextureTrapezoid(  90.f, mBorderWidth, getRect().getHeight(), (F32)getRect().getWidth(),0 );
-	//drawTextureTrapezoid( 180.f, mBorderWidth, getRect().getWidth(),  (F32)getRect().getWidth(),(F32)getRect().getHeight() );
-	//drawTextureTrapezoid( 270.f, mBorderWidth, getRect().getHeight(), 0,					(F32)getRect().getHeight() );
-}
-
-
-void LLViewBorder::drawTextureTrapezoid( F32 degrees, S32 width, S32 length, F32 start_x, F32 start_y )
-{
-	gGL.pushMatrix();
-	{
-		gGL.translatef(start_x, start_y, 0.f);
-		glRotatef( degrees, 0, 0, 1 );
-
-		gGL.begin(LLRender::QUADS);
-		{
-			//      width, width   /---------\ length-width, width		//
-			//	   			      /           \							//
-			//				     /			   \						//
-			//				    /---------------\						//
-			//    			0,0					  length, 0				//
-
-			gGL.texCoord2f( 0, 0 );
-			gGL.vertex2i( 0, 0 );
-
-			gGL.texCoord2f( (GLfloat)length, 0 );
-			gGL.vertex2i( length, 0 );
-
-			gGL.texCoord2f( (GLfloat)(length - width), (GLfloat)width );
-			gGL.vertex2i( length - width, width );
-
-			gGL.texCoord2f( (GLfloat)width, (GLfloat)width );
-			gGL.vertex2i( width, width );
-		}
-		gGL.end();
-	}
-	gGL.popMatrix();
-}
-
 BOOL LLViewBorder::getBevelFromAttribute(LLXMLNodePtr node, LLViewBorder::EBevel& bevel_style)
 {
 	if (node->hasAttribute("bevel_style"))
diff --git a/indra/llui/llviewborder.h b/indra/llui/llviewborder.h
index 92fd569325..342e84fd93 100644
--- a/indra/llui/llviewborder.h
+++ b/indra/llui/llviewborder.h
@@ -99,8 +99,7 @@ private:
 	void		drawOnePixelLines();
 	void		drawTwoPixelLines();
 	void		drawTextures();
-	void		drawTextureTrapezoid( F32 degrees, S32 width, S32 length, F32 start_x, F32 start_y );
-
+	
 	EBevel		mBevel;
 	EStyle		mStyle;
 	LLUIColor	mHighlightLight;
diff --git a/indra/newview/llhudrender.cpp b/indra/newview/llhudrender.cpp
index a02dc3355b..325c9c260c 100644
--- a/indra/newview/llhudrender.cpp
+++ b/indra/newview/llhudrender.cpp
@@ -121,24 +121,24 @@ void hud_render_text(const LLWString &wstr, const LLVector3 &pos_agent,
 	glMatrixMode(GL_PROJECTION);
 	glPushMatrix();
 	glMatrixMode(GL_MODELVIEW);
-	
+	gGL.pushMatrix();
 	LLUI::pushMatrix();
 		
 	gl_state_for_2d(world_view_rect.getWidth(), world_view_rect.getHeight());
 	gViewerWindow->setup3DViewport();
-	//gViewerWindow->setup2DRender();
-
+	
 	winX -= world_view_rect.mLeft;
 	winY -= world_view_rect.mBottom;
 	LLUI::loadIdentity();
+	glLoadIdentity();
 	LLUI::translate((F32) winX*1.0f/LLFontGL::sScaleX, (F32) winY*1.0f/(LLFontGL::sScaleY), -(((F32) winZ*2.f)-1.f));
-	//glRotatef(angle * RAD_TO_DEG, axis.mV[VX], axis.mV[VY], axis.mV[VZ]);
-	//glScalef(right_scale, up_scale, 1.f);
 	F32 right_x;
 	
 	font.render(wstr, 0, 0, 0, color, LLFontGL::LEFT, LLFontGL::BASELINE, style, shadow, wstr.length(), 1000, &right_x);
+
 	LLUI::popMatrix();
-	
+	gGL.popMatrix();
+
 	glMatrixMode(GL_PROJECTION);
 	glPopMatrix();
 	glMatrixMode(GL_MODELVIEW);
diff --git a/indra/newview/llhudtext.cpp b/indra/newview/llhudtext.cpp
index 8ad94b957d..8d1d27444b 100644
--- a/indra/newview/llhudtext.cpp
+++ b/indra/newview/llhudtext.cpp
@@ -555,7 +555,7 @@ void LLHUDText::renderText(BOOL for_select)
 		}
 	}
 	/// Reset the default color to white.  The renderer expects this to be the default. 
-	glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
+	gGL.color4f(1.0f, 1.0f, 1.0f, 1.0f);
 	if (for_select)
 	{
 		gGL.getTexUnit(0)->enable(LLTexUnit::TT_TEXTURE);
diff --git a/indra/newview/llmediactrl.cpp b/indra/newview/llmediactrl.cpp
index d464862eed..6fd6958d2e 100644
--- a/indra/newview/llmediactrl.cpp
+++ b/indra/newview/llmediactrl.cpp
@@ -724,14 +724,14 @@ void LLMediaCtrl::draw()
 		LLGLSUIDefault gls_ui;
 		LLGLDisable gls_alphaTest( GL_ALPHA_TEST );
 
-		gGL.pushMatrix();
+		gGL.pushUIMatrix();
 		{
 			if (mIgnoreUIScale)
 			{
-				glLoadIdentity();
+				gGL.loadUIIdentity();
 				// font system stores true screen origin, need to scale this by UI scale factor
 				// to get render origin for this view (with unit scale)
-				gGL.translatef(floorf(LLFontGL::sCurOrigin.mX * LLUI::sGLScaleFactor.mV[VX]), 
+				gGL.translateUI(floorf(LLFontGL::sCurOrigin.mX * LLUI::sGLScaleFactor.mV[VX]), 
 							floorf(LLFontGL::sCurOrigin.mY * LLUI::sGLScaleFactor.mV[VY]), 
 							LLFontGL::sCurOrigin.mZ);
 			}
@@ -825,7 +825,7 @@ void LLMediaCtrl::draw()
 			gGL.end();
 			gGL.setSceneBlendType(LLRender::BT_ALPHA);
 		}
-		gGL.popMatrix();
+		gGL.popUIMatrix();
 	
 	}
 	else
diff --git a/indra/newview/llnetmap.cpp b/indra/newview/llnetmap.cpp
index 234fe13217..05623198ab 100644
--- a/indra/newview/llnetmap.cpp
+++ b/indra/newview/llnetmap.cpp
@@ -153,6 +153,18 @@ void LLNetMap::draw()
 	// Prepare a scissor region
 	F32 rotation = 0;
 
+	gGL.pushMatrix();
+	gGL.pushUIMatrix();
+	
+	LLVector3 offset = gGL.getUITranslation();
+	LLVector3 scale = gGL.getUIScale();
+
+	glLoadIdentity();
+	gGL.loadUIIdentity();
+
+	glScalef(scale.mV[0], scale.mV[1], scale.mV[2]);
+	gGL.translatef(offset.mV[0], offset.mV[1], offset.mV[2]);
+	
 	{
 		LLLocalClipRect clip(getLocalRect());
 		{
@@ -435,6 +447,9 @@ void LLNetMap::draw()
 		}
 	}
 	
+	gGL.popMatrix();
+	gGL.popUIMatrix();
+
 	LLUICtrl::draw();
 }
 
diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp
index de4317b2de..f6227c2dd6 100644
--- a/indra/newview/llviewerwindow.cpp
+++ b/indra/newview/llviewerwindow.cpp
@@ -476,6 +476,10 @@ public:
 			}
             ypos += y_inc;
 
+			addText(xpos, ypos, llformat("UI Verts/Calls: %d/%d", LLRender::sUIVerts, LLRender::sUICalls));
+			LLRender::sUICalls = LLRender::sUIVerts = 0;
+			ypos += y_inc;
+
 			addText(xpos,ypos, llformat("%d/%d Nodes visible", gPipeline.mNumVisibleNodes, LLSpatialGroup::sNodeCount));
 			
 			ypos += y_inc;
@@ -1843,12 +1847,15 @@ void LLViewerWindow::drawDebugText()
 {
 	gGL.color4f(1,1,1,1);
 	gGL.pushMatrix();
+	gGL.pushUIMatrix();
 	{
 		// scale view by UI global scale factor and aspect ratio correction factor
-		glScalef(mDisplayScale.mV[VX], mDisplayScale.mV[VY], 1.f);
+		gGL.scaleUI(mDisplayScale.mV[VX], mDisplayScale.mV[VY], 1.f);
 		mDebugText->draw();
 	}
+	gGL.popUIMatrix();
 	gGL.popMatrix();
+
 	gGL.flush();
 }
 
@@ -1896,9 +1903,11 @@ void LLViewerWindow::draw()
 	// No translation needed, this view is glued to 0,0
 
 	gGL.pushMatrix();
+	LLUI::pushMatrix();
 	{
+		
 		// scale view by UI global scale factor and aspect ratio correction factor
-		glScalef(mDisplayScale.mV[VX], mDisplayScale.mV[VY], 1.f);
+		gGL.scaleUI(mDisplayScale.mV[VX], mDisplayScale.mV[VY], 1.f);
 
 		LLVector2 old_scale_factor = LLUI::sGLScaleFactor;
 		// apply camera zoom transform (for high res screenshots)
@@ -1964,6 +1973,7 @@ void LLViewerWindow::draw()
 
 		LLUI::sGLScaleFactor = old_scale_factor;
 	}
+	LLUI::popMatrix();
 	gGL.popMatrix();
 
 #if LL_DEBUG
-- 
cgit v1.2.3


From 92e07a0c5eb97ea4f839eaf824699d403ac56c6d Mon Sep 17 00:00:00 2001
From: Dave Parks <davep@lindenlab.com>
Date: Fri, 5 Feb 2010 00:32:31 -0600
Subject: EXT-4060 Fix for FSAA not taking effect until relog.  Biggest change
 is that FSAA now relies on framebuffer objects and framebuffer objects are
 enabled by default)

---
 indra/newview/app_settings/settings.xml |  2 +-
 indra/newview/llviewercontrol.cpp       |  1 +
 indra/newview/llviewerwindow.cpp        | 13 +++++++------
 3 files changed, 9 insertions(+), 7 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml
index c7300fcee2..8a447502b0 100644
--- a/indra/newview/app_settings/settings.xml
+++ b/indra/newview/app_settings/settings.xml
@@ -7384,7 +7384,7 @@
       <key>Type</key>
       <string>Boolean</string>
       <key>Value</key>
-      <integer>0</integer>
+      <integer>1</integer>
     </map>
     <key>RenderUseFarClip</key>
     <map>
diff --git a/indra/newview/llviewercontrol.cpp b/indra/newview/llviewercontrol.cpp
index 64eabe65cf..827d34138f 100644
--- a/indra/newview/llviewercontrol.cpp
+++ b/indra/newview/llviewercontrol.cpp
@@ -514,6 +514,7 @@ void settings_setup_listeners()
 	gSavedSettings.getControl("RenderAvatarVP")->getSignal()->connect(boost::bind(&handleSetShaderChanged, _2));
 	gSavedSettings.getControl("VertexShaderEnable")->getSignal()->connect(boost::bind(&handleSetShaderChanged, _2));
 	gSavedSettings.getControl("RenderUIBuffer")->getSignal()->connect(boost::bind(&handleReleaseGLBufferChanged, _2));
+	gSavedSettings.getControl("RenderFSAASamples")->getSignal()->connect(boost::bind(&handleReleaseGLBufferChanged, _2));
 	gSavedSettings.getControl("RenderShadowResolutionScale")->getSignal()->connect(boost::bind(&handleReleaseGLBufferChanged, _2));
 	gSavedSettings.getControl("RenderGlow")->getSignal()->connect(boost::bind(&handleReleaseGLBufferChanged, _2));
 	gSavedSettings.getControl("RenderGlow")->getSignal()->connect(boost::bind(&handleSetShaderChanged, _2));
diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp
index 77e4663433..3e1306ae3c 100644
--- a/indra/newview/llviewerwindow.cpp
+++ b/indra/newview/llviewerwindow.cpp
@@ -1362,7 +1362,7 @@ LLViewerWindow::LLViewerWindow(
 		gSavedSettings.getBOOL("DisableVerticalSync"),
 		!gNoRender,
 		ignore_pixel_depth,
-		gSavedSettings.getU32("RenderFSAASamples"));
+		0); //gSavedSettings.getU32("RenderFSAASamples"));
 
 	if (!LLAppViewer::instance()->restoreErrorTrap())
 	{
@@ -4713,8 +4713,9 @@ BOOL LLViewerWindow::changeDisplaySettings(BOOL fullscreen, LLCoordScreen size,
 		return TRUE;
 	}
 
-	U32 fsaa = gSavedSettings.getU32("RenderFSAASamples");
-	U32 old_fsaa = mWindow->getFSAASamples();
+	//U32 fsaa = gSavedSettings.getU32("RenderFSAASamples");
+	//U32 old_fsaa = mWindow->getFSAASamples();
+
 	// going from windowed to windowed
 	if (!old_fullscreen && !fullscreen)
 	{
@@ -4724,7 +4725,7 @@ BOOL LLViewerWindow::changeDisplaySettings(BOOL fullscreen, LLCoordScreen size,
 			mWindow->setSize(size);
 		}
 
-		if (fsaa == old_fsaa)
+		//if (fsaa == old_fsaa)
 		{
 			return TRUE;
 		}
@@ -4753,13 +4754,13 @@ BOOL LLViewerWindow::changeDisplaySettings(BOOL fullscreen, LLCoordScreen size,
 		gSavedSettings.setS32("WindowY", old_pos.mY);
 	}
 	
-	mWindow->setFSAASamples(fsaa);
+	//mWindow->setFSAASamples(fsaa);
 
 	result_first_try = mWindow->switchContext(fullscreen, size, disable_vsync);
 	if (!result_first_try)
 	{
 		// try to switch back
-		mWindow->setFSAASamples(old_fsaa);
+		//mWindow->setFSAASamples(old_fsaa);
 		result_second_try = mWindow->switchContext(old_fullscreen, old_size, disable_vsync);
 
 		if (!result_second_try)
-- 
cgit v1.2.3


From 43ca4e104b613c95a1147751122f7ff007542e5c Mon Sep 17 00:00:00 2001
From: Dave Parks <davep@lindenlab.com>
Date: Fri, 5 Feb 2010 11:19:14 -0600
Subject: EXT-4209 Fix for sculptie prims not updating geometry when texture is
 loaded.

---
 indra/newview/llviewertexture.cpp | 63 ++++++++++++++++++++++++++++++++-
 indra/newview/llviewertexture.h   | 15 ++++++--
 indra/newview/llvovolume.cpp      | 73 +++++++++++++++++++++++++++++----------
 indra/newview/llvovolume.h        |  6 ++--
 4 files changed, 134 insertions(+), 23 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp
index 0ad269392d..06fdb2a3b2 100644
--- a/indra/newview/llviewertexture.cpp
+++ b/indra/newview/llviewertexture.cpp
@@ -496,7 +496,9 @@ void LLViewerTexture::init(bool firstinit)
 	mAdditionalDecodePriority = 0.f ;	
 	mParcelMedia = NULL ;
 	mNumFaces = 0 ;
+	mNumVolumes = 0;
 	mFaceList.clear() ;
+	mVolumeList.clear();
 }
 
 //virtual 
@@ -508,7 +510,7 @@ S8 LLViewerTexture::getType() const
 void LLViewerTexture::cleanup()
 {
 	mFaceList.clear() ;
-	
+	mVolumeList.clear();
 	if(mGLTexturep)
 	{
 		mGLTexturep->cleanup();
@@ -661,6 +663,42 @@ S32 LLViewerTexture::getNumFaces() const
 	return mNumFaces ;
 }
 
+
+//virtual
+void LLViewerTexture::addVolume(LLVOVolume* volumep) 
+{
+	if( mNumVolumes >= mVolumeList.size())
+	{
+		mVolumeList.resize(2 * mNumVolumes + 1) ;		
+	}
+	mVolumeList[mNumVolumes] = volumep ;
+	volumep->setIndexInTex(mNumVolumes) ;
+	mNumVolumes++ ;
+	mLastVolumeListUpdateTimer.reset() ;
+}
+
+//virtual
+void LLViewerTexture::removeVolume(LLVOVolume* volumep) 
+{
+	if(mNumVolumes > 1)
+	{
+		S32 index = volumep->getIndexInTex() ; 
+		mVolumeList[index] = mVolumeList[--mNumVolumes] ;
+		mVolumeList[index]->setIndexInTex(index) ;
+	}
+	else 
+	{
+		mVolumeList.clear() ;
+		mNumVolumes = 0 ;
+	}
+	mLastVolumeListUpdateTimer.reset() ;
+}
+
+S32 LLViewerTexture::getNumVolumes() const
+{
+	return mNumVolumes ;
+}
+
 void LLViewerTexture::reorganizeFaceList()
 {
 	static const F32 MAX_WAIT_TIME = 20.f; // seconds
@@ -680,6 +718,27 @@ void LLViewerTexture::reorganizeFaceList()
 	mFaceList.erase(mFaceList.begin() + mNumFaces, mFaceList.end());
 }
 
+void LLViewerTexture::reorganizeVolumeList()
+{
+	static const F32 MAX_WAIT_TIME = 20.f; // seconds
+	static const U32 MAX_EXTRA_BUFFER_SIZE = 4 ;
+
+	if(mNumVolumes + MAX_EXTRA_BUFFER_SIZE > mVolumeList.size())
+	{
+		return ;
+	}
+
+	if(mLastVolumeListUpdateTimer.getElapsedTimeF32() < MAX_WAIT_TIME)
+	{
+		return ;
+	}
+
+	mLastVolumeListUpdateTimer.reset() ;
+	mVolumeList.erase(mVolumeList.begin() + mNumVolumes, mVolumeList.end());
+}
+
+
+
 //virtual
 void LLViewerTexture::switchToCachedImage()
 {
@@ -1598,6 +1657,7 @@ void LLViewerFetchedTexture::updateVirtualSize()
 	}
 	mNeedsResetMaxVirtualSize = TRUE ;
 	reorganizeFaceList() ;
+	reorganizeVolumeList();
 }
 
 bool LLViewerFetchedTexture::updateFetch()
@@ -3252,6 +3312,7 @@ F32 LLViewerMediaTexture::getMaxVirtualSize()
 
 	mNeedsResetMaxVirtualSize = TRUE ;
 	reorganizeFaceList() ;
+	reorganizeVolumeList();
 
 	return mMaxVirtualSize ;
 }
diff --git a/indra/newview/llviewertexture.h b/indra/newview/llviewertexture.h
index 79d9c4e7bb..85f03b5839 100644
--- a/indra/newview/llviewertexture.h
+++ b/indra/newview/llviewertexture.h
@@ -134,7 +134,9 @@ public:
 	static S32 getIndexFromCategory(S32 category) ;
 	static S32 getCategoryFromIndex(S32 index) ;
 
-	typedef std::vector<LLFace*> ll_face_list_t ;
+	typedef std::vector<LLFace*> ll_face_list_t;
+	typedef std::vector<LLVOVolume*> ll_volume_list_t;
+
 
 protected:
 	virtual ~LLViewerTexture();
@@ -178,6 +180,11 @@ public:
 	S32 getNumFaces() const;
 	const ll_face_list_t* getFaceList() const {return &mFaceList;}
 
+	virtual void addVolume(LLVOVolume* volumep);
+	virtual void removeVolume(LLVOVolume* volumep);
+	S32 getNumVolumes() const;
+	const ll_volume_list_t* getVolumeList() const { return &mVolumeList; }
+
 	void generateGLTexture() ;
 	void destroyGLTexture() ;
 	
@@ -242,7 +249,7 @@ protected:
 	void cleanup() ;
 	void init(bool firstinit) ;	
 	void reorganizeFaceList() ;
-
+	void reorganizeVolumeList() ;
 private:
 	//note: do not make this function public.
 	/*virtual*/ LLImageGL* getGLTexture() const ;
@@ -269,6 +276,10 @@ protected:
 	U32               mNumFaces ;
 	LLFrameTimer      mLastFaceListUpdateTimer ;
 
+	ll_volume_list_t  mVolumeList;
+	U32					mNumVolumes;
+	LLFrameTimer	  mLastVolumeListUpdateTimer;
+
 	//do not use LLPointer here.
 	LLViewerMediaTexture* mParcelMedia ;
 
diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp
index 3cdf485d7d..25ed931fb5 100644
--- a/indra/newview/llvovolume.cpp
+++ b/indra/newview/llvovolume.cpp
@@ -192,6 +192,7 @@ LLVOVolume::LLVOVolume(const LLUUID &id, const LLPCode pcode, LLViewerRegion *re
 
 	mMediaImplList.resize(getNumTEs());
 	mLastFetchedMediaVersion = -1;
+	mIndexInTex = 0;
 }
 
 LLVOVolume::~LLVOVolume()
@@ -226,6 +227,11 @@ void LLVOVolume::markDead()
 		{
 			removeMediaImpl(i);
 		}
+
+		if (mSculptTexture.notNull())
+		{
+			mSculptTexture->removeVolume(this);
+		}
 	}
 	
 	LLViewerObject::markDead();
@@ -740,7 +746,9 @@ void LLVOVolume::updateTextureVirtualSize()
 	{
 		LLSculptParams *sculpt_params = (LLSculptParams *)getParameterEntry(LLNetworkData::PARAMS_SCULPT);
 		LLUUID id =  sculpt_params->getSculptTexture(); 
-		mSculptTexture = LLViewerTextureManager::getFetchedTexture(id, TRUE, LLViewerTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE);
+		
+		updateSculptTexture();
+		
 		if (mSculptTexture.notNull())
 		{
 			mSculptTexture->setBoostLevel(llmax((S32)mSculptTexture->getBoostLevel(),
@@ -929,35 +937,53 @@ BOOL LLVOVolume::setVolume(const LLVolumeParams &volume_params, const S32 detail
 		{
 			mVolumeImpl->onSetVolume(volume_params, detail);
 		}
-		
+	
+		updateSculptTexture();
+
 		if (isSculpted())
 		{
-			mSculptTexture = LLViewerTextureManager::getFetchedTexture(volume_params.getSculptID(), TRUE, LLViewerTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE);
+			updateSculptTexture();
+
 			if (mSculptTexture.notNull())
 			{
-				//ignore sculpt GL usage since bao fixed this in a separate branch
-				if (!gGLActive)
-				{
-					gGLActive = TRUE;
-					sculpt();
-					gGLActive = FALSE;
-				}
-				else
-				{
-					sculpt();
-				}
+				sculpt();
 			}
 		}
-		else
-		{
-			mSculptTexture = NULL;
-		}
 
 		return TRUE;
 	}
 	return FALSE;
 }
 
+void LLVOVolume::updateSculptTexture()
+{
+	LLPointer<LLViewerFetchedTexture> old_sculpt = mSculptTexture;
+
+	if (isSculpted())
+	{
+		LLSculptParams *sculpt_params = (LLSculptParams *)getParameterEntry(LLNetworkData::PARAMS_SCULPT);
+		LLUUID id =  sculpt_params->getSculptTexture(); 
+		mSculptTexture = LLViewerTextureManager::getFetchedTexture(id, TRUE, LLViewerTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE);
+	}
+	else
+	{
+		mSculptTexture = NULL;
+	}
+
+	if (mSculptTexture != old_sculpt)
+	{
+		if (old_sculpt.notNull())
+		{
+			old_sculpt->removeVolume(this);
+		}
+		if (mSculptTexture.notNull())
+		{
+			mSculptTexture->addVolume(this);
+		}
+	}
+	
+}
+
 // sculpt replaces generate() for sculpted surfaces
 void LLVOVolume::sculpt()
 {	
@@ -1021,6 +1047,17 @@ void LLVOVolume::sculpt()
 			}
 		}
 		getVolume()->sculpt(sculpt_width, sculpt_height, sculpt_components, sculpt_data, discard_level);
+
+		//notify rebuild any other VOVolumes that reference this sculpty volume
+		for (S32 i = 0; i < mSculptTexture->getNumVolumes(); ++i)
+		{
+			LLVOVolume* volume = (*(mSculptTexture->getVolumeList()))[i];
+			if (volume != this && volume->getVolume() == getVolume())
+			{
+				gPipeline.markRebuild(volume->mDrawable, LLDrawable::REBUILD_GEOMETRY, FALSE);
+				volume->mSculptChanged = TRUE;
+			}
+		}
 	}
 }
 
diff --git a/indra/newview/llvovolume.h b/indra/newview/llvovolume.h
index a287d34402..a8bb597f93 100644
--- a/indra/newview/llvovolume.h
+++ b/indra/newview/llvovolume.h
@@ -179,8 +179,10 @@ public:
 	/*virtual*/ BOOL 	setMaterial(const U8 material);
 
 				void	setTexture(const S32 face);
-
+				S32     getIndexInTex() const {return mIndexInTex ;}
 	/*virtual*/ BOOL	setVolume(const LLVolumeParams &volume_params, const S32 detail, bool unique_volume = false);
+				void	updateSculptTexture();
+				void    setIndexInTex(S32 index) { mIndexInTex = index ;}
 				void	sculpt();
 				void	updateRelativeXform();
 	/*virtual*/ BOOL	updateGeometry(LLDrawable *drawable);
@@ -303,7 +305,7 @@ private:
 	LLPointer<LLViewerFetchedTexture> mLightTexture;
 	media_list_t mMediaImplList;
 	S32			mLastFetchedMediaVersion; // as fetched from the server, starts as -1
-	
+	S32 mIndexInTex;
 	// statics
 public:
 	static F32 sLODSlopDistanceFactor;// Changing this to zero, effectively disables the LOD transition slop 
-- 
cgit v1.2.3


From 8332550c6dc2a159c9c5812819e167578eda1269 Mon Sep 17 00:00:00 2001
From: "Brad Payne (Vir Linden)" <vir@lindenlab.com>
Date: Mon, 8 Feb 2010 18:37:35 -0500
Subject: Temporary diagnostics

---
 indra/newview/llappearancemgr.cpp | 27 +++++++++++++++++++++++++++
 indra/newview/llstartup.cpp       |  2 ++
 2 files changed, 29 insertions(+)

(limited to 'indra')

diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp
index 0cceba6cb0..aad39854e4 100644
--- a/indra/newview/llappearancemgr.cpp
+++ b/indra/newview/llappearancemgr.cpp
@@ -113,6 +113,8 @@ public:
 protected:
 	~LLWearInventoryCategoryCallback()
 	{
+		llinfos << "BAP done all inventory callbacks" << llendl;
+		
 		// Is the destructor called by ordinary dereference, or because the app's shutting down?
 		// If the inventory callback manager goes away, we're shutting down, no longer want the callback.
 		if( LLInventoryCallbackManager::is_instantiated() )
@@ -150,12 +152,15 @@ protected:
 
 void LLOutfitObserver::done()
 {
+	llinfos << "BAP done 2nd stage fetch" << llendl;
 	gInventory.removeObserver(this);
 	doOnIdle(boost::bind(&LLOutfitObserver::doWearCategory,this));
 }
 
 void LLOutfitObserver::doWearCategory()
 {
+	llinfos << "BAP start" << llendl;
+	
 	// We now have an outfit ready to be copied to agent inventory. Do
 	// it, and wear that outfit normally.
 	if(mCopyItems)
@@ -244,6 +249,8 @@ void LLOutfitFetch::done()
 	// What we do here is get the complete information on the items in
 	// the library, and set up an observer that will wait for that to
 	// happen.
+	llinfos << "BAP done first stage fetch" << llendl;
+	
 	LLInventoryModel::cat_array_t cat_array;
 	LLInventoryModel::item_array_t item_array;
 	gInventory.collectDescendents(mCompleteFolders.front(),
@@ -304,6 +311,8 @@ public:
 
 	virtual ~LLUpdateAppearanceOnDestroy()
 	{
+		llinfos << "BAP done update appearance on destroy" << llendl;
+
 		if (!LLApp::isExiting())
 		{
 			LLAppearanceManager::instance().updateAppearanceFromCOF();
@@ -312,6 +321,7 @@ public:
 
 	/* virtual */ void fire(const LLUUID& inv_item)
 	{
+		llinfos << "BAP fire" << llendl;
 		mFireCount++;
 	}
 private:
@@ -703,6 +713,8 @@ void LLAppearanceManager::linkAll(const LLUUID& category,
 
 void LLAppearanceManager::updateCOF(const LLUUID& category, bool append)
 {
+	llinfos << "BAP updating cof" << llendl;
+
 	const LLUUID cof = getCOF();
 
 	// Deactivate currently active gestures in the COF, if replacing outfit
@@ -760,18 +772,26 @@ void LLAppearanceManager::updateCOF(const LLUUID& category, bool append)
 	gInventory.notifyObservers();
 
 	// Create links to new COF contents.
+	llinfos << "BAP creating LLUpdateAppearanceOnDestroy" << llendl;
 	LLPointer<LLInventoryCallback> link_waiter = new LLUpdateAppearanceOnDestroy;
 
 	linkAll(cof, body_items, link_waiter);
+	llinfos << "BAP submitted all body_items link requests" << llendl;
 	linkAll(cof, wear_items, link_waiter);
+	llinfos << "BAP submitted all wear_items link requests" << llendl;
 	linkAll(cof, obj_items, link_waiter);
+	llinfos << "BAP submitted all obj link requests" << llendl;
 	linkAll(cof, gest_items, link_waiter);
 
+	llinfos << "BAP submitted all gest link requests" << llendl;
+
 	// Add link to outfit if category is an outfit. 
 	if (!append)
 	{
 		createBaseOutfitLink(category, link_waiter);
 	}
+	llinfos << "BAP submitted all link requests" << llendl;
+	llinfos << "BAP waiting for LLUpdateAppearanceOnDestroy" << llendl;
 }
 
 void LLAppearanceManager::updatePanelOutfitName(const std::string& name)
@@ -843,6 +863,8 @@ void LLAppearanceManager::updateAppearanceFromCOF()
 {
 	// update dirty flag to see if the state of the COF matches
 	// the saved outfit stored as a folder link
+	llinfos << "BAP update appearance starts" << llendl;
+
 	updateIsDirty();
 
 	dumpCat(getCOF(),"COF, start");
@@ -973,8 +995,11 @@ void LLAppearanceManager::wearInventoryCategory(LLInventoryCategory* category, b
 {
 	if(!category) return;
 
+	llinfos << "BAP wearInventoryCategory" << llendl;
+	
 	lldebugs << "wearInventoryCategory( " << category->getName()
 			 << " )" << llendl;
+
 	// What we do here is get the complete information on the items in
 	// the inventory, and set up an observer that will wait for that to
 	// happen.
@@ -1003,6 +1028,8 @@ void LLAppearanceManager::wearInventoryCategoryOnAvatar( LLInventoryCategory* ca
 	// this up front to avoid having to deal with the case of multiple
 	// wearables being dirty.
 	if(!category) return;
+	llinfos << "BAP wearInventoryCategoryOnAvatar( " << category->getName()
+			 << " )" << llendl;
 	lldebugs << "wearInventoryCategoryOnAvatar( " << category->getName()
 			 << " )" << llendl;
 			 	
diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp
index d1b91df6e9..171b441b2b 100644
--- a/indra/newview/llstartup.cpp
+++ b/indra/newview/llstartup.cpp
@@ -2544,6 +2544,8 @@ bool callback_choose_gender(const LLSD& notification, const LLSD& response)
 void LLStartUp::loadInitialOutfit( const std::string& outfit_folder_name,
 								   const std::string& gender_name )
 {
+	llinfos << "BAP load initial outfit start" << llendl;
+
 	// Not going through the processAgentInitialWearables path, so need to set this here.
 	LLAppearanceManager::instance().setAttachmentInvLinkEnable(true);
 	// Initiate creation of COF, since we're also bypassing that.
-- 
cgit v1.2.3


From 662ce9b1fd6fcdf817e8fd825ce2c35e4fa52ca3 Mon Sep 17 00:00:00 2001
From: "Brad Payne (Vir Linden)" <vir@lindenlab.com>
Date: Wed, 10 Feb 2010 16:08:15 -0500
Subject: More temporary log messages

---
 indra/newview/llvoavatar.cpp | 4 ++++
 1 file changed, 4 insertions(+)

(limited to 'indra')

diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp
index 4235f97eab..5252e11a51 100644
--- a/indra/newview/llvoavatar.cpp
+++ b/indra/newview/llvoavatar.cpp
@@ -2532,6 +2532,10 @@ void LLVOAvatar::idleUpdateLoadingEffect()
 	// update visibility when avatar is partially loaded
 	if (updateIsFullyLoaded()) // changed?
 	{
+		if (isFullyLoaded() && isSelf())
+		{
+			llwarns << "BAP self isFullyLoaded" << llendl;
+		}
 		if (isFullyLoaded())
 		{
 			deleteParticleSource();
-- 
cgit v1.2.3


From de1cf42eb631b1254193e1f9e6e1236da3c4cfda Mon Sep 17 00:00:00 2001
From: Leyla Farazha <leyla@lindenlab.com>
Date: Thu, 11 Feb 2010 12:41:10 -0800
Subject: EXT-5044 substasks: turning the event panel into an event floater.
 reviewed by Richard.

---
 indra/newview/CMakeLists.txt                       |   4 +-
 indra/newview/llfloaterevent.cpp                   | 331 +++++++++++++++++++++
 indra/newview/llfloaterevent.h                     |  94 ++++++
 indra/newview/llstartup.cpp                        |   4 +-
 indra/newview/llviewerfloaterreg.cpp               |   3 +
 .../newview/skins/default/xui/en/floater_event.xml | 230 ++++++++++++++
 6 files changed, 662 insertions(+), 4 deletions(-)
 create mode 100644 indra/newview/llfloaterevent.cpp
 create mode 100644 indra/newview/llfloaterevent.h
 create mode 100644 indra/newview/skins/default/xui/en/floater_event.xml

(limited to 'indra')

diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt
index cd7c002096..b74530e49a 100644
--- a/indra/newview/CMakeLists.txt
+++ b/indra/newview/CMakeLists.txt
@@ -161,6 +161,7 @@ set(viewer_SOURCE_FILES
     llfloatercustomize.cpp
     llfloaterdaycycle.cpp
     llfloaterenvsettings.cpp
+    llfloaterevent.cpp
     llfloaterfonttest.cpp
     llfloatergesture.cpp
     llfloatergodtools.cpp
@@ -300,7 +301,6 @@ set(viewer_SOURCE_FILES
     llpanelclassified.cpp
     llpanelcontents.cpp
     llpaneleditwearable.cpp
-    llpanelevent.cpp
     llpanelface.cpp
     llpanelgroup.cpp
     llpanelgroupgeneral.cpp
@@ -661,6 +661,7 @@ set(viewer_HEADER_FILES
     llfloatercustomize.h
     llfloaterdaycycle.h
     llfloaterenvsettings.h
+    llfloaterevent.h
     llfloaterfonttest.h
     llfloatergesture.h
     llfloatergodtools.h
@@ -795,7 +796,6 @@ set(viewer_HEADER_FILES
     llpanelclassified.h
     llpanelcontents.h
     llpaneleditwearable.h
-    llpanelevent.h
     llpanelface.h
     llpanelgroup.h
     llpanelgroupgeneral.h
diff --git a/indra/newview/llfloaterevent.cpp b/indra/newview/llfloaterevent.cpp
new file mode 100644
index 0000000000..91c2810026
--- /dev/null
+++ b/indra/newview/llfloaterevent.cpp
@@ -0,0 +1,331 @@
+/** 
+ * @file llfloaterevent.cpp
+ * @brief Display for events in the finder
+ *
+ * $LicenseInfo:firstyear=2004&license=viewergpl$
+ * 
+ * Copyright (c) 2004-2009, Linden Research, Inc.
+ * 
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
+ * 
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
+ * 
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
+ * 
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
+ * $/LicenseInfo$
+ */
+
+#include "llviewerprecompiledheaders.h"
+
+#include "llfloaterevent.h"
+
+#include "message.h"
+#include "llnotificationsutil.h"
+#include "llui.h"
+
+#include "llagent.h"
+#include "llviewerwindow.h"
+#include "llbutton.h"
+#include "llcachename.h"
+#include "llcommandhandler.h"	// secondlife:///app/chat/ support
+#include "lleventflags.h"
+#include "lleventnotifier.h"
+#include "llfloater.h"
+#include "llfloaterreg.h"
+#include "llfloaterworldmap.h"
+#include "llinventorymodel.h"
+#include "llsecondlifeurls.h"
+#include "lltextbox.h"
+#include "lltexteditor.h"
+#include "lluiconstants.h"
+#include "llviewercontrol.h"
+#include "llweb.h"
+#include "llworldmap.h"
+#include "lluictrlfactory.h"
+#include "lltrans.h"
+
+
+class LLEventHandler : public LLCommandHandler
+{
+public:
+	// requires trusted browser to trigger
+	LLEventHandler() : LLCommandHandler("event", UNTRUSTED_THROTTLE) { }
+	bool handle(const LLSD& params, const LLSD& query_map,
+				LLMediaCtrl* web)
+	{
+		if (params.size() < 1)
+		{
+			return false;
+		}
+		
+		LLFloaterEvent* floater = LLFloaterReg::getTypedInstance<LLFloaterEvent>("event");
+		if (floater)
+		{
+			floater->setEventID(params[0].asInteger());
+			LLFloaterReg::showTypedInstance<LLFloaterEvent>("event");
+			return true;
+		}
+
+		return false;
+	}
+};
+LLEventHandler gEventHandler;
+
+LLFloaterEvent::LLFloaterEvent(const LLSD& key)
+	: LLFloater(key),
+
+	  mEventID(0)
+{
+}
+
+
+LLFloaterEvent::~LLFloaterEvent()
+{
+}
+
+
+BOOL LLFloaterEvent::postBuild()
+{
+	mTBName = getChild<LLTextBox>("event_name");
+
+	mTBCategory = getChild<LLTextBox>("event_category");
+	
+	mTBDate = getChild<LLTextBox>("event_date");
+
+	mTBDuration = getChild<LLTextBox>("event_duration");
+
+	mTBDesc = getChild<LLTextEditor>("event_desc");
+	mTBDesc->setEnabled(FALSE);
+
+	mTBRunBy = getChild<LLTextBox>("event_runby");
+	mTBLocation = getChild<LLTextBox>("event_location");
+	mTBCover = getChild<LLTextBox>("event_cover");
+
+	mTeleportBtn = getChild<LLButton>( "teleport_btn");
+	mTeleportBtn->setClickedCallback(onClickTeleport, this);
+
+	mMapBtn = getChild<LLButton>( "map_btn");
+	mMapBtn->setClickedCallback(onClickMap, this);
+
+	mNotifyBtn = getChild<LLButton>( "notify_btn");
+	mNotifyBtn->setClickedCallback(onClickNotify, this);
+
+	mCreateEventBtn = getChild<LLButton>( "create_event_btn");
+	mCreateEventBtn->setClickedCallback(onClickCreateEvent, this);
+
+	return TRUE;
+}
+
+void LLFloaterEvent::setEventID(const U32 event_id)
+{
+	mEventID = event_id;
+	// Should reset all of the panel state here
+	resetInfo();
+
+	if (event_id != 0)
+	{
+		sendEventInfoRequest();
+	}
+}
+
+
+void LLFloaterEvent::sendEventInfoRequest()
+{
+	LLMessageSystem *msg = gMessageSystem;
+
+	msg->newMessageFast(_PREHASH_EventInfoRequest);
+	msg->nextBlockFast(_PREHASH_AgentData);
+	msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID() );
+	msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID() );
+	msg->nextBlockFast(_PREHASH_EventData);
+	msg->addU32Fast(_PREHASH_EventID, mEventID);
+	gAgent.sendReliableMessage();
+}
+
+
+//static 
+void LLFloaterEvent::processEventInfoReply(LLMessageSystem *msg, void **)
+{
+	// extract the agent id
+	LLUUID agent_id;
+	msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_AgentID, agent_id );
+
+	LLFloaterEvent* floater = LLFloaterReg::getTypedInstance<LLFloaterEvent>("event");
+	
+	if(floater)
+	{
+		floater->mEventInfo.unpack(msg);
+		floater->mTBName->setText(floater->mEventInfo.mName);
+		floater->mTBCategory->setText(floater->mEventInfo.mCategoryStr);
+		floater->mTBDate->setText(floater->mEventInfo.mTimeStr);
+		floater->mTBDesc->setText(floater->mEventInfo.mDesc);
+
+		floater->mTBDuration->setText(llformat("%d:%.2d", floater->mEventInfo.mDuration / 60, floater->mEventInfo.mDuration % 60));
+
+		if (!floater->mEventInfo.mHasCover)
+		{
+			floater->mTBCover->setText(floater->getString("none"));
+		}
+		else
+		{
+			floater->mTBCover->setText(llformat("%d", floater->mEventInfo.mCover));
+		}
+
+		F32 global_x = (F32)floater->mEventInfo.mPosGlobal.mdV[VX];
+		F32 global_y = (F32)floater->mEventInfo.mPosGlobal.mdV[VY];
+
+		S32 region_x = llround(global_x) % REGION_WIDTH_UNITS;
+		S32 region_y = llround(global_y) % REGION_WIDTH_UNITS;
+		S32 region_z = llround((F32)floater->mEventInfo.mPosGlobal.mdV[VZ]);
+
+		std::string desc = floater->mEventInfo.mSimName + llformat(" (%d, %d, %d)", region_x, region_y, region_z);
+		floater->mTBLocation->setText(desc);
+
+		if (floater->mEventInfo.mEventFlags & EVENT_FLAG_MATURE)
+		{
+			floater->childSetVisible("event_mature_yes", TRUE);
+			floater->childSetVisible("event_mature_no", FALSE);
+		}
+		else
+		{
+			floater->childSetVisible("event_mature_yes", FALSE);
+			floater->childSetVisible("event_mature_no", TRUE);
+		}
+
+		if (floater->mEventInfo.mUnixTime < time_corrected())
+		{
+			floater->mNotifyBtn->setEnabled(FALSE);
+		}
+		else
+		{
+			floater->mNotifyBtn->setEnabled(TRUE);
+		}
+
+		if (gEventNotifier.hasNotification(floater->mEventInfo.mID))
+		{
+			floater->mNotifyBtn->setLabel(floater->getString("dont_notify"));
+		}
+		else
+		{
+			floater->mNotifyBtn->setLabel(floater->getString("notify"));
+		}
+	}
+}
+
+
+void LLFloaterEvent::draw()
+{
+	std::string name;
+	gCacheName->getFullName(mEventInfo.mRunByID, name);
+
+	mTBRunBy->setText(name);
+
+	LLPanel::draw();
+}
+
+void LLFloaterEvent::resetInfo()
+{
+	// Clear all of the text fields.
+}
+
+// static
+void LLFloaterEvent::onClickTeleport(void* data)
+{
+	LLFloaterEvent* self = (LLFloaterEvent*)data;
+	LLFloaterWorldMap* worldmap_instance = LLFloaterWorldMap::getInstance();
+	if (!self->mEventInfo.mPosGlobal.isExactlyZero()&&worldmap_instance)
+	{
+		gAgent.teleportViaLocation(self->mEventInfo.mPosGlobal);
+		worldmap_instance->trackLocation(self->mEventInfo.mPosGlobal);
+	}
+}
+
+
+// static
+void LLFloaterEvent::onClickMap(void* data)
+{
+	LLFloaterEvent* self = (LLFloaterEvent*)data;
+	LLFloaterWorldMap* worldmap_instance = LLFloaterWorldMap::getInstance();
+
+	if (!self->mEventInfo.mPosGlobal.isExactlyZero()&&worldmap_instance)
+	{
+		worldmap_instance->trackLocation(self->mEventInfo.mPosGlobal);
+		LLFloaterReg::showInstance("world_map", "center");
+	}
+}
+
+
+// static
+/*
+void LLPanelEvent::onClickLandmark(void* data)
+{
+	LLPanelEvent* self = (LLPanelEvent*)data;
+	//create_landmark(self->mTBName->getText(), "", self->mEventInfo.mPosGlobal);
+	LLMessageSystem* msg = gMessageSystem;
+	msg->newMessage("CreateLandmarkForEvent");
+	msg->nextBlockFast(_PREHASH_AgentData);
+	msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
+	msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
+	msg->nextBlockFast(_PREHASH_EventData);
+	msg->addU32Fast(_PREHASH_EventID, self->mEventID);
+	msg->nextBlockFast(_PREHASH_InventoryBlock);
+	LLUUID folder_id;
+	folder_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_LANDMARK);
+	msg->addUUIDFast(_PREHASH_FolderID, folder_id);
+	msg->addStringFast(_PREHASH_Name, self->mTBName->getText());
+	gAgent.sendReliableMessage();
+}
+*/
+
+// static
+void LLFloaterEvent::onClickCreateEvent(void* data)
+{
+	LLNotificationsUtil::add("PromptGoToEventsPage");//, LLSD(), LLSD(), callbackCreateEventWebPage); 
+}
+
+// static
+void LLFloaterEvent::onClickNotify(void *data)
+{
+	LLFloaterEvent* self = (LLFloaterEvent*)data;
+
+	if (!gEventNotifier.hasNotification(self->mEventID))
+	{
+		gEventNotifier.add(self->mEventInfo);
+		self->mNotifyBtn->setLabel(self->getString("dont_notify"));
+	}
+	else
+	{
+		gEventNotifier.remove(self->mEventInfo.mID);
+		self->mNotifyBtn->setLabel(self->getString("notify"));
+	}
+}
+/*
+// static
+bool LLPanelEvent::callbackCreateEventWebPage(const LLSD& notification, const LLSD& response)
+{
+	S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
+	if (0 == option)
+	{
+		llinfos << "Loading events page " <<  LLNotifications::instance().getGlobalString("EVENTS_URL") << llendl;
+
+		LLWeb::loadURL( LLNotifications::instance().getGlobalString("EVENTS_URL"));
+	}
+	return false;
+}
+*/
+
diff --git a/indra/newview/llfloaterevent.h b/indra/newview/llfloaterevent.h
new file mode 100644
index 0000000000..c93e3f73ca
--- /dev/null
+++ b/indra/newview/llfloaterevent.h
@@ -0,0 +1,94 @@
+/** 
+ * @file llfloaterevent.h
+ * @brief Display for events in the finder
+ *
+ * $LicenseInfo:firstyear=2004&license=viewergpl$
+ * 
+ * Copyright (c) 2004-2009, Linden Research, Inc.
+ * 
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
+ * 
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
+ * 
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
+ * 
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
+ * $/LicenseInfo$
+ */
+
+#ifndef LL_LLFLOATEREVENT_H
+#define LL_LLFLOATEREVENT_H
+
+#include "llfloater.h"
+
+#include "lleventinfo.h"
+#include "lluuid.h"
+#include "v3dmath.h"
+
+class LLTextBox;
+class LLTextEditor;
+class LLButton;
+class LLMessageSystem;
+
+class LLFloaterEvent : public LLFloater
+{
+public:
+	LLFloaterEvent(const LLSD& key);
+	/*virtual*/ ~LLFloaterEvent();
+
+	/*virtual*/ BOOL postBuild();
+	/*virtual*/ void draw();
+
+	void setEventID(const U32 event_id);
+	void sendEventInfoRequest();
+
+	static void processEventInfoReply(LLMessageSystem *msg, void **);
+
+	U32 getEventID() { return mEventID; }
+
+protected:
+	void resetInfo();
+
+	static void onClickTeleport(void*);
+	static void onClickMap(void*);
+	//static void onClickLandmark(void*);
+	static void onClickCreateEvent(void*);
+	static void onClickNotify(void*);
+
+//	static bool callbackCreateEventWebPage(const LLSD& notification, const LLSD& response);
+
+protected:
+	U32				mEventID;
+	LLEventInfo		mEventInfo;
+
+	LLTextBox*		mTBName;
+	LLTextBox*		mTBCategory;
+	LLTextBox*		mTBDate;
+	LLTextBox*		mTBDuration;
+	LLTextEditor*	mTBDesc;
+
+	LLTextBox*		mTBRunBy;
+	LLTextBox*		mTBLocation;
+	LLTextBox*		mTBCover;
+
+	LLButton*		mTeleportBtn;
+	LLButton*		mMapBtn;
+	LLButton*		mCreateEventBtn;
+	LLButton*		mNotifyBtn;
+};
+
+#endif // LL_LLFLOATEREVENT_H
diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp
index d1b91df6e9..63f5883a70 100644
--- a/indra/newview/llstartup.cpp
+++ b/indra/newview/llstartup.cpp
@@ -123,7 +123,7 @@
 #include "llmutelist.h"
 #include "llpanelavatar.h"
 #include "llavatarpropertiesprocessor.h"
-#include "llpanelevent.h"
+#include "llfloaterevent.h"
 #include "llpanelclassified.h"
 #include "llpanelpick.h"
 #include "llpanelplace.h"
@@ -2484,7 +2484,7 @@ void register_viewer_callbacks(LLMessageSystem* msg)
 	msg->setHandlerFunc("MapBlockReply", LLWorldMapMessage::processMapBlockReply);
 	msg->setHandlerFunc("MapItemReply", LLWorldMapMessage::processMapItemReply);
 
-	msg->setHandlerFunc("EventInfoReply", LLPanelEvent::processEventInfoReply);
+	msg->setHandlerFunc("EventInfoReply", LLFloaterEvent::processEventInfoReply);
 	msg->setHandlerFunc("PickInfoReply", &LLAvatarPropertiesProcessor::processPickInfoReply);
 //	msg->setHandlerFunc("ClassifiedInfoReply", LLPanelClassified::processClassifiedInfoReply);
 	msg->setHandlerFunc("ClassifiedInfoReply", LLAvatarPropertiesProcessor::processClassifiedInfoReply);
diff --git a/indra/newview/llviewerfloaterreg.cpp b/indra/newview/llviewerfloaterreg.cpp
index 29114c33c5..eb070fb3ef 100644
--- a/indra/newview/llviewerfloaterreg.cpp
+++ b/indra/newview/llviewerfloaterreg.cpp
@@ -55,6 +55,7 @@
 #include "llfloaterbump.h"
 #include "llfloatercamera.h"
 #include "llfloaterdaycycle.h"
+#include "llfloaterevent.h"
 #include "llfloatersearch.h"
 #include "llfloaterenvsettings.h"
 #include "llfloaterfonttest.h"
@@ -160,6 +161,8 @@ void LLViewerFloaterReg::registerFloaters()
 	LLFloaterReg::add("env_settings", "floater_env_settings.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterEnvSettings>);
 	LLFloaterReg::add("env_water", "floater_water.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterWater>);
 	LLFloaterReg::add("env_windlight", "floater_windlight_options.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterWindLight>);
+
+	LLFloaterReg::add("event", "floater_event.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterEvent>);
 	
 	LLFloaterReg::add("font_test", "floater_font_test.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterFontTest>);
 
diff --git a/indra/newview/skins/default/xui/en/floater_event.xml b/indra/newview/skins/default/xui/en/floater_event.xml
new file mode 100644
index 0000000000..3d579f56be
--- /dev/null
+++ b/indra/newview/skins/default/xui/en/floater_event.xml
@@ -0,0 +1,230 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
+<floater
+ follows="all"
+ height="350"
+ label="Event"
+ layout="topleft"
+ name="Event"
+ width="330">
+  <floater.string
+   name="none">
+    none
+  </floater.string>
+  <floater.string
+   name="notify">
+    Notify
+  </floater.string>
+  <floater.string
+   name="dont_notify">
+    Don&apos;t Notify
+  </floater.string>
+  <layout_stack
+    name="layout"
+    orientation="vertical"
+    follows="all"
+    layout="topleft"
+    left="0"
+    top="0"
+    height="350"
+    width="330"
+    border_size="0">
+    <layout_panel
+       name="profile_stack"
+       follows="all"
+       layout="topleft"
+       top="0"
+       left="0"
+       height="305"
+       width="330">
+      <text
+       follows="top|left|right"
+       font="SansSerifLarge"
+       text_color="white"
+       height="17"
+       layout="topleft"
+       left="10"
+       name="event_name"
+       top="5"
+       use_ellipses="true"
+       width="310">
+        Nameless Event...of Doom! De doom! Doom doom.
+      </text>
+      <text
+        type="string"
+        length="1"
+        follows="top|left"
+        height="13"
+        text_color="LtGray_50"
+        layout="topleft"
+        left="25"
+        name="event_category"
+        width="300">
+        (no category)
+      </text>
+
+      <text
+       type="string"
+       length="1"
+       follows="top|left"
+       layout="topleft"
+       left="10"
+       top_pad="7"
+       name="event_runby_label"
+       width="310">
+        Run by:
+      </text>
+      <name_box
+        follows="left|top"
+        height="20"
+        initial_value="(retrieving)"
+        layout="topleft"
+        left="10"
+        link="true"
+        name="event_runby"
+        top_pad="2"
+        use_ellipses="true"
+        width="310" />
+      <text
+     type="string"
+     length="1"
+     left="10"
+     height="17"
+     font="SansSerifMedium"
+    text_color="EmphasisColor"
+     top_pad="5"
+     follows="top|left"
+     layout="topleft"
+     name="event_date"
+     width="310">
+        10/10/2010
+      </text>
+      <text
+       type="string"
+       height="14"
+       length="1"
+       left="10"
+       follows="top|left"
+       layout="topleft"
+       name="event_duration"
+       width="310">
+        1 hour
+      </text>
+      <text
+       font="SansSerifMedium"
+       text_color="EmphasisColor"
+        type="string"
+        follows="left|top"
+        height="16"
+        layout="topleft"
+       left="10"
+       name="event_cover"
+        visible="true"
+        width="310">
+        Free
+      </text>
+      <text
+       type="string"
+       length="1"
+       follows="top|left"
+       layout="topleft"
+       left="10"
+       top_pad="5"
+       name="event_location_label">
+        Location:
+      </text>
+      <text
+       type="string"
+       length="1"
+       height="20"
+       left="10"
+       follows="top|left"
+       layout="topleft"
+       name="event_location"
+       use_ellipses="true"
+       value="SampleParcel, Name Long (145, 228, 26)"
+        width="310" />
+      <icon
+   follows="top|left"
+   height="16"
+   image_name="Parcel_PG_Dark"
+   layout="topleft"
+   left="10"
+   name="rating_icon"
+   width="18" />
+      <text
+       follows="left|top"
+       height="16"
+       layout="topleft"
+       left_pad="12"
+       name="rating_label"
+       top_delta="3"
+       value="Rating:"
+       width="60" />
+      <text
+       follows="left|right|top"
+       height="16"
+       layout="topleft"
+       left_pad="0"
+       name="rating_value"
+       top_delta="0"
+       value="unknown"
+       width="200" />
+      <expandable_text
+               follows="left|top|right"
+               height="106"
+               layout="topleft"
+               left="6"
+       name="event_desc"
+               value="Du waltz die spritz"
+               width="313" />
+    </layout_panel>
+    <layout_panel
+               follows="left|right"
+               height="24"
+               layout="topleft"
+               mouse_opaque="false"
+               name="button_panel"
+               top="0"
+               left="0"
+               user_resize="false">
+      <button
+       follows="left|top"
+           height="18"
+           image_selected="AddItem_Press"
+           image_unselected="AddItem_Off"
+           image_disabled="AddItem_Disabled"
+           layout="topleft"
+           left="6"
+       name="create_event_btn"
+           picture_style="true"
+           tool_tip="Create Event"
+           width="18" />
+      <button
+   follows="left|top"
+   height="23"
+   label="Notify Me"
+   layout="topleft"
+   left_pad="3"
+   top_delta="-1"
+   name="notify_btn"
+   width="100" />
+      <button
+       follows="left|top"
+       height="23"
+       label="Teleport"
+       layout="topleft"
+       left_pad="5"
+       name="teleport_btn"
+       width="100" />
+      <button
+       follows="left|top"
+       height="23"
+       label="Map"
+       layout="topleft"
+       left_pad="5"
+       name="map_btn"
+       width="85" />
+    </layout_panel>
+  </layout_stack>
+  </floater>
+
-- 
cgit v1.2.3


From df6af052e0e8810b0ba82245a970091be8c1eb6b Mon Sep 17 00:00:00 2001
From: Tofu Linden <tofu.linden@lindenlab.com>
Date: Fri, 12 Feb 2010 17:37:08 +0000
Subject: CID-428

Checker: FORWARD_NULL
Function: LLCallFloater::updateSession()
File: /indra/newview/llcallfloater.cpp
---
 indra/newview/llcallfloater.cpp | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

(limited to 'indra')

diff --git a/indra/newview/llcallfloater.cpp b/indra/newview/llcallfloater.cpp
index 3c4f791d91..76e058a1c3 100644
--- a/indra/newview/llcallfloater.cpp
+++ b/indra/newview/llcallfloater.cpp
@@ -304,7 +304,9 @@ void LLCallFloater::updateSession()
 	updateAgentModeratorState();
 
 	//show floater for voice calls & only in CONNECTED to voice channel state
-	if (!is_local_chat && LLVoiceChannel::STATE_CONNECTED == voice_channel->getState())
+	if (!is_local_chat &&
+	    voice_channel &&
+	    LLVoiceChannel::STATE_CONNECTED == voice_channel->getState())
 	{
 		LLIMFloater* im_floater = LLIMFloater::findInstance(session_id);
 		bool show_me = !(im_floater && im_floater->getVisible());
-- 
cgit v1.2.3


From 4fa10e35965341e5fde3991c0f38f048a5885645 Mon Sep 17 00:00:00 2001
From: Tofu Linden <tofu.linden@lindenlab.com>
Date: Fri, 12 Feb 2010 17:38:19 +0000
Subject: CID-427

Checker: FORWARD_NULL
Function: LLFolderBridge::pasteFromClipboard()
File: /indra/newview/llinventorybridge.cpp
---
 indra/newview/llinventorybridge.cpp | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

(limited to 'indra')

diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp
index da95eaefca..019a4b22c3 100644
--- a/indra/newview/llinventorybridge.cpp
+++ b/indra/newview/llinventorybridge.cpp
@@ -2434,7 +2434,10 @@ void LLFolderBridge::pasteFromClipboard()
 					//we have to update inventory locally too
 					LLViewerInventoryItem* viitem = dynamic_cast<LLViewerInventoryItem*>(item);
 					llassert(viitem);
-					changeItemParent(model, viitem, parent_id, FALSE);
+					if (viitem)
+					{
+						changeItemParent(model, viitem, parent_id, FALSE);
+					}
 				}
 				else
 				{
-- 
cgit v1.2.3


From 947aeb19153edafa82561dc440cf72d4f80583a4 Mon Sep 17 00:00:00 2001
From: Tofu Linden <tofu.linden@lindenlab.com>
Date: Fri, 12 Feb 2010 17:40:39 +0000
Subject: CID-413

Checker: UNUSED_VALUE
Function: LLFloaterWater::deleteAlertCallback(const LLSD &, const LLSD &)
File: /indra/newview/llfloaterwater.cpp

dead code.
---
 indra/newview/llfloaterwater.cpp | 2 --
 1 file changed, 2 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/llfloaterwater.cpp b/indra/newview/llfloaterwater.cpp
index 66a1f6701f..1bbee2625c 100644
--- a/indra/newview/llfloaterwater.cpp
+++ b/indra/newview/llfloaterwater.cpp
@@ -574,12 +574,10 @@ bool LLFloaterWater::deleteAlertCallback(const LLSD& notification, const LLSD& r
 		LLComboBox* combo_box = getChild<LLComboBox>("WaterPresetsCombo");
 		LLFloaterDayCycle* day_cycle = LLFloaterReg::findTypedInstance<LLFloaterDayCycle>("env_day_cycle");
 		LLComboBox* key_combo = NULL;
-		LLMultiSliderCtrl* mult_sldr = NULL;
 
 		if (day_cycle) 
 		{
 			key_combo = day_cycle->getChild<LLComboBox>("WaterKeyPresets");
-			mult_sldr = day_cycle->getChild<LLMultiSliderCtrl>("WaterDayCycleKeys");
 		}
 
 		std::string name = combo_box->getSelectedValue().asString();
-- 
cgit v1.2.3


From 6d80e75e0bdebdd960c7ad2ff3f7ea87812a87ba Mon Sep 17 00:00:00 2001
From: Tofu Linden <tofu.linden@lindenlab.com>
Date: Fri, 12 Feb 2010 17:41:55 +0000
Subject: CID-412

Checker: UNUSED_VALUE
Function: LLFloaterWindLight::deleteAlertCallback(const LLSD &, const LLSD &)
File: /indra/newview/llfloaterwindlight.cpp

dead code.
---
 indra/newview/llfloaterwindlight.cpp | 2 --
 1 file changed, 2 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/llfloaterwindlight.cpp b/indra/newview/llfloaterwindlight.cpp
index ea6fda7303..c1b15c578c 100644
--- a/indra/newview/llfloaterwindlight.cpp
+++ b/indra/newview/llfloaterwindlight.cpp
@@ -749,12 +749,10 @@ bool LLFloaterWindLight::deleteAlertCallback(const LLSD& notification, const LLS
 		LLComboBox* combo_box = getChild<LLComboBox>("WLPresetsCombo");
 		LLFloaterDayCycle* day_cycle = LLFloaterReg::findTypedInstance<LLFloaterDayCycle>("env_day_cycle");
 		LLComboBox* key_combo = NULL;
-		LLMultiSliderCtrl* mult_sldr = NULL;
 
 		if (day_cycle) 
 		{
 			key_combo = day_cycle->getChild<LLComboBox>("WLKeyPresets");
-			mult_sldr = day_cycle->getChild<LLMultiSliderCtrl>("WLDayCycleKeys");
 		}
 
 		std::string name(combo_box->getSelectedValue().asString());
-- 
cgit v1.2.3


From 69aa73656e739f4fc8085bd5347fe081e2df9510 Mon Sep 17 00:00:00 2001
From: Tofu Linden <tofu.linden@lindenlab.com>
Date: Fri, 12 Feb 2010 17:43:47 +0000
Subject: CID-287

Checker: UNINIT_CTOR
Function: LLScriptScript::LLScriptScript(LLScritpGlobalStorage *, LLScriptState *)
File: /indra/lscript/lscript_compile/lscript_tree.cpp
---
 indra/lscript/lscript_compile/lscript_tree.cpp | 2 ++
 1 file changed, 2 insertions(+)

(limited to 'indra')

diff --git a/indra/lscript/lscript_compile/lscript_tree.cpp b/indra/lscript/lscript_compile/lscript_tree.cpp
index 3b8bbbe805..4ba41db2fc 100644
--- a/indra/lscript/lscript_compile/lscript_tree.cpp
+++ b/indra/lscript/lscript_compile/lscript_tree.cpp
@@ -10626,6 +10626,8 @@ LLScriptScript::LLScriptScript(LLScritpGlobalStorage *globals,
 		}
 		temp = temp->mNextp;
 	}
+
+	mClassName[0] = '\0';
 }
 
 void LLScriptScript::setBytecodeDest(const char* dst_filename)
-- 
cgit v1.2.3


From 23b1c3d16f2597b20f9c6d123dd306c6a1fa8eac Mon Sep 17 00:00:00 2001
From: Tofu Linden <tofu.linden@lindenlab.com>
Date: Fri, 12 Feb 2010 17:46:34 +0000
Subject: CID-286

Checker: UNINIT_CTOR
Function: LLScriptStateChange::LLScriptStateChange(int, int, LLScriptIdentifier *)
File: /indra/lscript/lscript_compile/lscript_tree.h
---
 indra/lscript/lscript_compile/lscript_tree.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'indra')

diff --git a/indra/lscript/lscript_compile/lscript_tree.h b/indra/lscript/lscript_compile/lscript_tree.h
index a667e1eb5b..5d7f7e25b2 100644
--- a/indra/lscript/lscript_compile/lscript_tree.h
+++ b/indra/lscript/lscript_compile/lscript_tree.h
@@ -1876,7 +1876,7 @@ class LLScriptStateChange : public LLScriptStatement
 {
 public:
 	LLScriptStateChange(S32 line, S32 col, LLScriptIdentifier *identifier)
-		: LLScriptStatement(line, col, LSSMT_STATE_CHANGE), mIdentifier(identifier)
+		: LLScriptStatement(line, col, LSSMT_STATE_CHANGE), mIdentifier(identifier), mReturnType(LST_NULL)
 	{
 	}
 
-- 
cgit v1.2.3


From 41bd792032f651faa61917b7136edf32c79fc64d Mon Sep 17 00:00:00 2001
From: Tofu Linden <tofu.linden@lindenlab.com>
Date: Fri, 12 Feb 2010 17:47:21 +0000
Subject: CID-285

Checker: UNINIT_CTOR
Function: LLScriptState::LLScriptState(int, int, e_lscript_state_type, LLScriptIdentifier *, LLScriptEventHandler *)
File: /indra/lscript/lscript_compile/lscript_tree.h
---
 indra/lscript/lscript_compile/lscript_tree.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'indra')

diff --git a/indra/lscript/lscript_compile/lscript_tree.h b/indra/lscript/lscript_compile/lscript_tree.h
index 5d7f7e25b2..7de9606dfc 100644
--- a/indra/lscript/lscript_compile/lscript_tree.h
+++ b/indra/lscript/lscript_compile/lscript_tree.h
@@ -2210,7 +2210,7 @@ class LLScriptState : public LLScriptFilePosition
 {
 public:
 	LLScriptState(S32 line, S32 col, LSCRIPTStateType type, LLScriptIdentifier *identifier, LLScriptEventHandler *event)
-		: LLScriptFilePosition(line, col), mType(type), mIdentifier(identifier), mEvent(event), mNextp(NULL)
+		: LLScriptFilePosition(line, col), mType(type), mIdentifier(identifier), mEvent(event), mNextp(NULL), mStateScope(NULL)
 	{
 	}
 
-- 
cgit v1.2.3


From 290a5846fc56046e7d8d65755250c49da25c9a46 Mon Sep 17 00:00:00 2001
From: Tofu Linden <tofu.linden@lindenlab.com>
Date: Fri, 12 Feb 2010 17:49:55 +0000
Subject: CID-218

Checker: REVERSE_INULL
Function: LLAgentWearables::setWearableOutfit(const LLDynamicArray<LLPointer<LLInventoryItem>, (int)32> &, LLDynamicArray<LLWearable *, (int)32>&, int)
File: /indra/newview/llagentwearables.cpp
---
 indra/newview/llagentwearables.cpp | 3 +++
 1 file changed, 3 insertions(+)

(limited to 'indra')

diff --git a/indra/newview/llagentwearables.cpp b/indra/newview/llagentwearables.cpp
index a439720dcf..5d6e88a833 100644
--- a/indra/newview/llagentwearables.cpp
+++ b/indra/newview/llagentwearables.cpp
@@ -1605,6 +1605,9 @@ void LLAgentWearables::setWearableOutfit(const LLInventoryItem::item_array_t& it
 		LLWearable* new_wearable = wearables[i];
 		LLPointer<LLInventoryItem> new_item = items[i];
 
+		llassert(new_wearable);
+		if (!new_wearable) continue;
+
 		const EWearableType type = new_wearable->getType();
 		wearables_to_remove[type] = FALSE;
 
-- 
cgit v1.2.3


From 21e86251c0e328a491ffe78d0f34c39646bbf447 Mon Sep 17 00:00:00 2001
From: Tofu Linden <tofu.linden@lindenlab.com>
Date: Fri, 12 Feb 2010 17:51:23 +0000
Subject: CID-218

Checker: REVERSE_INULL
Function: LLAgentWearables::setWearableOutfit(const LLDynamicArray<LLPointer<LLInventoryItem>, (int)32> &, LLDynamicArray<LLWearable *, (int)32>&, int)
File: /indra/newview/llagentwearables.cpp
---
 indra/newview/llagentwearables.cpp | 42 ++++++++++++++++++--------------------
 1 file changed, 20 insertions(+), 22 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/llagentwearables.cpp b/indra/newview/llagentwearables.cpp
index 5d6e88a833..def6e60abd 100644
--- a/indra/newview/llagentwearables.cpp
+++ b/indra/newview/llagentwearables.cpp
@@ -1606,33 +1606,31 @@ void LLAgentWearables::setWearableOutfit(const LLInventoryItem::item_array_t& it
 		LLPointer<LLInventoryItem> new_item = items[i];
 
 		llassert(new_wearable);
-		if (!new_wearable) continue;
-
-		const EWearableType type = new_wearable->getType();
-		wearables_to_remove[type] = FALSE;
-
-		// MULTI_WEARABLE: using 0th
-		LLWearable* old_wearable = getWearable(type, 0);
-		if (old_wearable)
+		if (new_wearable)
 		{
-			const LLUUID& old_item_id = getWearableItemID(type, 0);
-			if ((old_wearable->getAssetID() == new_wearable->getAssetID()) &&
-				(old_item_id == new_item->getUUID()))
-			{
-				lldebugs << "No change to wearable asset and item: " << LLWearableDictionary::getInstance()->getWearableEntry(type) << llendl;
-				continue;
-			}
+			const EWearableType type = new_wearable->getType();
+			wearables_to_remove[type] = FALSE;
 
-			// Assumes existing wearables are not dirty.
-			if (old_wearable->isDirty())
+			// MULTI_WEARABLE: using 0th
+			LLWearable* old_wearable = getWearable(type, 0);
+			if (old_wearable)
 			{
-				llassert(0);
-				continue;
+				const LLUUID& old_item_id = getWearableItemID(type, 0);
+				if ((old_wearable->getAssetID() == new_wearable->getAssetID()) &&
+				    (old_item_id == new_item->getUUID()))
+				{
+					lldebugs << "No change to wearable asset and item: " << LLWearableDictionary::getInstance()->getWearableEntry(type) << llendl;
+					continue;
+				}
+				
+				// Assumes existing wearables are not dirty.
+				if (old_wearable->isDirty())
+				{
+					llassert(0);
+					continue;
+				}
 			}
-		}
 
-		if (new_wearable)
-		{
 			new_wearable->setItemID(new_item->getUUID());
 			setWearable(type,0,new_wearable);
 		}
-- 
cgit v1.2.3


From a80fdcd8f2163ef98ff9eba9319e17ccafc05f9a Mon Sep 17 00:00:00 2001
From: Tofu Linden <tofu.linden@lindenlab.com>
Date: Fri, 12 Feb 2010 17:53:02 +0000
Subject: CID-217

Checker: REVERSE_INULL
Function: LLFloaterGesture::postBuild()
File: /indra/newview/llfloatergesture.cpp
---
 indra/newview/llfloatergesture.cpp | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/llfloatergesture.cpp b/indra/newview/llfloatergesture.cpp
index 90617a337a..b02247781d 100644
--- a/indra/newview/llfloatergesture.cpp
+++ b/indra/newview/llfloatergesture.cpp
@@ -203,12 +203,12 @@ BOOL LLFloaterGesture::postBuild()
 	gInventory.addObserver(this);
 	fetchDescendents(folders);
 
-	buildGestureList();
-	
-	mGestureList->setFocus(TRUE);
-
 	if (mGestureList)
 	{
+		buildGestureList();
+	
+		mGestureList->setFocus(TRUE);
+
 		const BOOL ascending = TRUE;
 		mGestureList->sortByColumn(std::string("name"), ascending);
 		mGestureList->selectFirstItem();
-- 
cgit v1.2.3


From 6e0ebfe18c431465f6d1bc52e079c7a745419de5 Mon Sep 17 00:00:00 2001
From: Tofu Linden <tofu.linden@lindenlab.com>
Date: Fri, 12 Feb 2010 17:55:39 +0000
Subject: CID-215

Checker: REVERSE_INULL
File: /indra/newview/llfloatergesture.cpp
---
 indra/newview/llfloatergesture.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/llfloatergesture.cpp b/indra/newview/llfloatergesture.cpp
index b02247781d..9c1ac2631d 100644
--- a/indra/newview/llfloatergesture.cpp
+++ b/indra/newview/llfloatergesture.cpp
@@ -223,10 +223,10 @@ BOOL LLFloaterGesture::postBuild()
 
 void LLFloaterGesture::refreshAll()
 {
-	buildGestureList();
-
 	if (!mGestureList) return;
 
+	buildGestureList();
+
 	if (mSelectedID.isNull())
 	{
 		mGestureList->selectFirstItem();
-- 
cgit v1.2.3


From a3d8338cdcf73b17f6cec4f07916560477d933a6 Mon Sep 17 00:00:00 2001
From: "Brad Payne (Vir Linden)" <vir@lindenlab.com>
Date: Fri, 12 Feb 2010 13:12:26 -0500
Subject: For EXT-5259: Major regression in load time for new users from 1.23
 to 2.0.  Moved autopopulate to after avatar appearance resolves

---
 indra/newview/llagentwearables.cpp |  2 ++
 indra/newview/llappearancemgr.cpp  | 14 ++++++++++++++
 indra/newview/llappearancemgr.h    |  3 +++
 indra/newview/llstartup.cpp        | 11 -----------
 indra/newview/llvoavatar.cpp       |  7 +++++++
 5 files changed, 26 insertions(+), 11 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/llagentwearables.cpp b/indra/newview/llagentwearables.cpp
index 6620780b27..e8e347c82a 100644
--- a/indra/newview/llagentwearables.cpp
+++ b/indra/newview/llagentwearables.cpp
@@ -2143,6 +2143,8 @@ void LLAgentWearables::updateServer()
 
 void LLAgentWearables::populateMyOutfitsFolder(void)
 {	
+	llinfos << "BAP starting populate" << llendl;
+
 	LLLibraryOutfitsFetch* outfits = new LLLibraryOutfitsFetch();
 	
 	// Get the complete information on the items in the inventory and 
diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp
index aad39854e4..8a646bd626 100644
--- a/indra/newview/llappearancemgr.cpp
+++ b/indra/newview/llappearancemgr.cpp
@@ -1307,6 +1307,20 @@ void LLAppearanceManager::updateIsDirty()
 	}
 }
 
+void LLAppearanceManager::onFirstFullyVisible()
+{
+	// If this is the very first time the user has logged into viewer2+ (from a legacy viewer, or new account)
+	// then auto-populate outfits from the library into the My Outfits folder.
+	static bool check_populate_my_outfits = true;
+	if (check_populate_my_outfits && 
+		(LLInventoryModel::getIsFirstTimeInViewer2() 
+		 || gSavedSettings.getBOOL("MyOutfitsAutofill")))
+	{
+		gAgentWearables.populateMyOutfitsFolder();
+	}
+	check_populate_my_outfits = false;
+}
+
 //#define DUMP_CAT_VERBOSE
 
 void LLAppearanceManager::dumpCat(const LLUUID& cat_id, const std::string& msg)
diff --git a/indra/newview/llappearancemgr.h b/indra/newview/llappearancemgr.h
index 5fdff45735..28b51ee0f6 100644
--- a/indra/newview/llappearancemgr.h
+++ b/indra/newview/llappearancemgr.h
@@ -113,6 +113,9 @@ public:
 	// should only be necessary to do on initial login.
 	void updateIsDirty();
 
+	// Called when self avatar is first fully visible.
+	void onFirstFullyVisible();
+	
 protected:
 	LLAppearanceManager();
 	~LLAppearanceManager();
diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp
index 171b441b2b..cbcd9640dd 100644
--- a/indra/newview/llstartup.cpp
+++ b/indra/newview/llstartup.cpp
@@ -1891,17 +1891,6 @@ bool idle_startup()
 			}
 		}
 		
-		// If this is the very first time the user has logged into viewer2+ (from a legacy viewer, or new account)
-		// then auto-populate outfits from the library into the My Outfits folder.
-		static bool check_populate_my_outfits = true;
-		if (check_populate_my_outfits && 
-			(LLInventoryModel::getIsFirstTimeInViewer2() 
-			 || gSavedSettings.getBOOL("MyOutfitsAutofill")))
-		{
-			gAgentWearables.populateMyOutfitsFolder();
-		}
-		check_populate_my_outfits = false;
-
 		return TRUE;
 	}
 
diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp
index 9b91d5abfa..bcf5cf3f6c 100644
--- a/indra/newview/llvoavatar.cpp
+++ b/indra/newview/llvoavatar.cpp
@@ -2535,6 +2535,13 @@ void LLVOAvatar::idleUpdateLoadingEffect()
 		if (isFullyLoaded() && isSelf())
 		{
 			llwarns << "BAP self isFullyLoaded" << llendl;
+
+			static bool first_fully_visible = true;
+			if (first_fully_visible)
+			{
+				first_fully_visible = false;
+				LLAppearanceManager::instance().onFirstFullyVisible();
+			}
 		}
 		if (isFullyLoaded())
 		{
-- 
cgit v1.2.3


From 1e76fc2b1f4e735105f2d45d73ea5a92dbad4e05 Mon Sep 17 00:00:00 2001
From: "Brad Payne (Vir Linden)" <vir@lindenlab.com>
Date: Fri, 12 Feb 2010 13:44:32 -0500
Subject: Log spam cleanup

---
 indra/newview/llagentwearables.cpp |  2 +-
 indra/newview/llappearancemgr.cpp  | 38 ++++++++++++++++----------------------
 indra/newview/llstartup.cpp        |  2 +-
 indra/newview/llvoavatar.cpp       |  2 +-
 4 files changed, 19 insertions(+), 25 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/llagentwearables.cpp b/indra/newview/llagentwearables.cpp
index e8e347c82a..9ff5de29c3 100644
--- a/indra/newview/llagentwearables.cpp
+++ b/indra/newview/llagentwearables.cpp
@@ -2143,7 +2143,7 @@ void LLAgentWearables::updateServer()
 
 void LLAgentWearables::populateMyOutfitsFolder(void)
 {	
-	llinfos << "BAP starting populate" << llendl;
+	llinfos << "starting outfit populate" << llendl;
 
 	LLLibraryOutfitsFetch* outfits = new LLLibraryOutfitsFetch();
 	
diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp
index 8a646bd626..062e291161 100644
--- a/indra/newview/llappearancemgr.cpp
+++ b/indra/newview/llappearancemgr.cpp
@@ -113,7 +113,7 @@ public:
 protected:
 	~LLWearInventoryCategoryCallback()
 	{
-		llinfos << "BAP done all inventory callbacks" << llendl;
+		llinfos << "done all inventory callbacks" << llendl;
 		
 		// Is the destructor called by ordinary dereference, or because the app's shutting down?
 		// If the inventory callback manager goes away, we're shutting down, no longer want the callback.
@@ -152,14 +152,14 @@ protected:
 
 void LLOutfitObserver::done()
 {
-	llinfos << "BAP done 2nd stage fetch" << llendl;
+	llinfos << "done 2nd stage fetch" << llendl;
 	gInventory.removeObserver(this);
 	doOnIdle(boost::bind(&LLOutfitObserver::doWearCategory,this));
 }
 
 void LLOutfitObserver::doWearCategory()
 {
-	llinfos << "BAP start" << llendl;
+	llinfos << "starting" << llendl;
 	
 	// We now have an outfit ready to be copied to agent inventory. Do
 	// it, and wear that outfit normally.
@@ -249,7 +249,7 @@ void LLOutfitFetch::done()
 	// What we do here is get the complete information on the items in
 	// the library, and set up an observer that will wait for that to
 	// happen.
-	llinfos << "BAP done first stage fetch" << llendl;
+	llinfos << "done first stage fetch" << llendl;
 	
 	LLInventoryModel::cat_array_t cat_array;
 	LLInventoryModel::item_array_t item_array;
@@ -311,7 +311,7 @@ public:
 
 	virtual ~LLUpdateAppearanceOnDestroy()
 	{
-		llinfos << "BAP done update appearance on destroy" << llendl;
+		llinfos << "done update appearance on destroy" << llendl;
 
 		if (!LLApp::isExiting())
 		{
@@ -321,7 +321,7 @@ public:
 
 	/* virtual */ void fire(const LLUUID& inv_item)
 	{
-		llinfos << "BAP fire" << llendl;
+		llinfos << "callback fired" << llendl;
 		mFireCount++;
 	}
 private:
@@ -713,7 +713,7 @@ void LLAppearanceManager::linkAll(const LLUUID& category,
 
 void LLAppearanceManager::updateCOF(const LLUUID& category, bool append)
 {
-	llinfos << "BAP updating cof" << llendl;
+	llinfos << "starting" << llendl;
 
 	const LLUUID cof = getCOF();
 
@@ -772,26 +772,20 @@ void LLAppearanceManager::updateCOF(const LLUUID& category, bool append)
 	gInventory.notifyObservers();
 
 	// Create links to new COF contents.
-	llinfos << "BAP creating LLUpdateAppearanceOnDestroy" << llendl;
+	llinfos << "creating LLUpdateAppearanceOnDestroy" << llendl;
 	LLPointer<LLInventoryCallback> link_waiter = new LLUpdateAppearanceOnDestroy;
 
 	linkAll(cof, body_items, link_waiter);
-	llinfos << "BAP submitted all body_items link requests" << llendl;
 	linkAll(cof, wear_items, link_waiter);
-	llinfos << "BAP submitted all wear_items link requests" << llendl;
 	linkAll(cof, obj_items, link_waiter);
-	llinfos << "BAP submitted all obj link requests" << llendl;
 	linkAll(cof, gest_items, link_waiter);
 
-	llinfos << "BAP submitted all gest link requests" << llendl;
-
 	// Add link to outfit if category is an outfit. 
 	if (!append)
 	{
 		createBaseOutfitLink(category, link_waiter);
 	}
-	llinfos << "BAP submitted all link requests" << llendl;
-	llinfos << "BAP waiting for LLUpdateAppearanceOnDestroy" << llendl;
+	llinfos << "waiting for LLUpdateAppearanceOnDestroy" << llendl;
 }
 
 void LLAppearanceManager::updatePanelOutfitName(const std::string& name)
@@ -863,7 +857,7 @@ void LLAppearanceManager::updateAppearanceFromCOF()
 {
 	// update dirty flag to see if the state of the COF matches
 	// the saved outfit stored as a folder link
-	llinfos << "BAP update appearance starts" << llendl;
+	llinfos << "starting" << llendl;
 
 	updateIsDirty();
 
@@ -995,9 +989,7 @@ void LLAppearanceManager::wearInventoryCategory(LLInventoryCategory* category, b
 {
 	if(!category) return;
 
-	llinfos << "BAP wearInventoryCategory" << llendl;
-	
-	lldebugs << "wearInventoryCategory( " << category->getName()
+	llinfos << "wearInventoryCategory( " << category->getName()
 			 << " )" << llendl;
 
 	// What we do here is get the complete information on the items in
@@ -1028,9 +1020,8 @@ void LLAppearanceManager::wearInventoryCategoryOnAvatar( LLInventoryCategory* ca
 	// this up front to avoid having to deal with the case of multiple
 	// wearables being dirty.
 	if(!category) return;
-	llinfos << "BAP wearInventoryCategoryOnAvatar( " << category->getName()
-			 << " )" << llendl;
-	lldebugs << "wearInventoryCategoryOnAvatar( " << category->getName()
+
+	llinfos << "wearInventoryCategoryOnAvatar( " << category->getName()
 			 << " )" << llendl;
 			 	
 	if( gFloaterCustomize )
@@ -1311,6 +1302,9 @@ void LLAppearanceManager::onFirstFullyVisible()
 {
 	// If this is the very first time the user has logged into viewer2+ (from a legacy viewer, or new account)
 	// then auto-populate outfits from the library into the My Outfits folder.
+
+	llinfos << "avatar fully visible" << llendl;
+
 	static bool check_populate_my_outfits = true;
 	if (check_populate_my_outfits && 
 		(LLInventoryModel::getIsFirstTimeInViewer2() 
diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp
index cbcd9640dd..af96629547 100644
--- a/indra/newview/llstartup.cpp
+++ b/indra/newview/llstartup.cpp
@@ -2533,7 +2533,7 @@ bool callback_choose_gender(const LLSD& notification, const LLSD& response)
 void LLStartUp::loadInitialOutfit( const std::string& outfit_folder_name,
 								   const std::string& gender_name )
 {
-	llinfos << "BAP load initial outfit start" << llendl;
+	llinfos << "starting" << llendl;
 
 	// Not going through the processAgentInitialWearables path, so need to set this here.
 	LLAppearanceManager::instance().setAttachmentInvLinkEnable(true);
diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp
index bcf5cf3f6c..f2f769980b 100644
--- a/indra/newview/llvoavatar.cpp
+++ b/indra/newview/llvoavatar.cpp
@@ -2534,7 +2534,7 @@ void LLVOAvatar::idleUpdateLoadingEffect()
 	{
 		if (isFullyLoaded() && isSelf())
 		{
-			llwarns << "BAP self isFullyLoaded" << llendl;
+			llinfos << "self isFullyLoaded" << llendl;
 
 			static bool first_fully_visible = true;
 			if (first_fully_visible)
-- 
cgit v1.2.3


From c61cb61ecc6beca1560a93cdad4ed1bc055c57f9 Mon Sep 17 00:00:00 2001
From: Leyla Farazha <leyla@lindenlab.com>
Date: Fri, 12 Feb 2010 11:09:39 -0800
Subject: EXT-5050 Make sure there is a Delete button in God Mode and that it
 works reviewed by Monore CC# 108

---
 indra/newview/llfloaterevent.cpp                   | 81 ++++++++++------------
 indra/newview/llfloaterevent.h                     |  6 +-
 .../newview/skins/default/xui/en/floater_event.xml | 21 ++++--
 3 files changed, 58 insertions(+), 50 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/llfloaterevent.cpp b/indra/newview/llfloaterevent.cpp
index 91c2810026..a51c613c37 100644
--- a/indra/newview/llfloaterevent.cpp
+++ b/indra/newview/llfloaterevent.cpp
@@ -45,11 +45,13 @@
 #include "llcommandhandler.h"	// secondlife:///app/chat/ support
 #include "lleventflags.h"
 #include "lleventnotifier.h"
+#include "llexpandabletextbox.h"
 #include "llfloater.h"
 #include "llfloaterreg.h"
 #include "llfloaterworldmap.h"
 #include "llinventorymodel.h"
 #include "llsecondlifeurls.h"
+#include "llslurl.h"
 #include "lltextbox.h"
 #include "lltexteditor.h"
 #include "lluiconstants.h"
@@ -109,7 +111,7 @@ BOOL LLFloaterEvent::postBuild()
 
 	mTBDuration = getChild<LLTextBox>("event_duration");
 
-	mTBDesc = getChild<LLTextEditor>("event_desc");
+	mTBDesc = getChild<LLExpandableTextBox>("event_desc");
 	mTBDesc->setEnabled(FALSE);
 
 	mTBRunBy = getChild<LLTextBox>("event_runby");
@@ -128,6 +130,9 @@ BOOL LLFloaterEvent::postBuild()
 	mCreateEventBtn = getChild<LLButton>( "create_event_btn");
 	mCreateEventBtn->setClickedCallback(onClickCreateEvent, this);
 
+	mGodDeleteEventBtn = getChild<LLButton>( "god_delete_event_btn");
+	mGodDeleteEventBtn->setClickedCallback(boost::bind(&LLFloaterEvent::onClickDeleteEvent, this));
+
 	return TRUE;
 }
 
@@ -143,6 +148,20 @@ void LLFloaterEvent::setEventID(const U32 event_id)
 	}
 }
 
+void LLFloaterEvent::onClickDeleteEvent()
+{
+	LLMessageSystem* msg = gMessageSystem;
+
+	msg->newMessageFast(_PREHASH_EventGodDelete);
+	msg->nextBlockFast(_PREHASH_AgentData);
+	msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
+	msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
+
+	msg->nextBlockFast(_PREHASH_EventData);
+	msg->addU32Fast(_PREHASH_EventID, mEventID);
+
+	gAgent.sendReliableMessage();
+}
 
 void LLFloaterEvent::sendEventInfoRequest()
 {
@@ -157,7 +176,6 @@ void LLFloaterEvent::sendEventInfoRequest()
 	gAgent.sendReliableMessage();
 }
 
-
 //static 
 void LLFloaterEvent::processEventInfoReply(LLMessageSystem *msg, void **)
 {
@@ -174,6 +192,7 @@ void LLFloaterEvent::processEventInfoReply(LLMessageSystem *msg, void **)
 		floater->mTBCategory->setText(floater->mEventInfo.mCategoryStr);
 		floater->mTBDate->setText(floater->mEventInfo.mTimeStr);
 		floater->mTBDesc->setText(floater->mEventInfo.mDesc);
+		floater->mTBRunBy->setText(LLSLURL::buildCommand("agent", floater->mEventInfo.mRunByID, "inspect"));
 
 		floater->mTBDuration->setText(llformat("%d:%.2d", floater->mEventInfo.mDuration / 60, floater->mEventInfo.mDuration % 60));
 
@@ -224,23 +243,33 @@ void LLFloaterEvent::processEventInfoReply(LLMessageSystem *msg, void **)
 		{
 			floater->mNotifyBtn->setLabel(floater->getString("notify"));
 		}
+	
+		floater->mMapBtn->setEnabled(TRUE);
+		floater->mTeleportBtn->setEnabled(TRUE);
 	}
 }
 
 
 void LLFloaterEvent::draw()
 {
-	std::string name;
-	gCacheName->getFullName(mEventInfo.mRunByID, name);
-
-	mTBRunBy->setText(name);
+	mGodDeleteEventBtn->setVisible(gAgent.isGodlike());
 
 	LLPanel::draw();
 }
 
 void LLFloaterEvent::resetInfo()
 {
-	// Clear all of the text fields.
+	mTBName->setText(LLStringUtil::null);
+	mTBCategory->setText(LLStringUtil::null);
+	mTBDate->setText(LLStringUtil::null);
+	mTBDesc->setText(LLStringUtil::null);
+	mTBDuration->setText(LLStringUtil::null);
+	mTBCover->setText(LLStringUtil::null);
+	mTBLocation->setText(LLStringUtil::null);
+	mTBRunBy->setText(LLStringUtil::null);
+	mNotifyBtn->setEnabled(FALSE);
+	mMapBtn->setEnabled(FALSE);
+	mTeleportBtn->setEnabled(FALSE);
 }
 
 // static
@@ -270,34 +299,13 @@ void LLFloaterEvent::onClickMap(void* data)
 }
 
 
-// static
-/*
-void LLPanelEvent::onClickLandmark(void* data)
-{
-	LLPanelEvent* self = (LLPanelEvent*)data;
-	//create_landmark(self->mTBName->getText(), "", self->mEventInfo.mPosGlobal);
-	LLMessageSystem* msg = gMessageSystem;
-	msg->newMessage("CreateLandmarkForEvent");
-	msg->nextBlockFast(_PREHASH_AgentData);
-	msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
-	msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
-	msg->nextBlockFast(_PREHASH_EventData);
-	msg->addU32Fast(_PREHASH_EventID, self->mEventID);
-	msg->nextBlockFast(_PREHASH_InventoryBlock);
-	LLUUID folder_id;
-	folder_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_LANDMARK);
-	msg->addUUIDFast(_PREHASH_FolderID, folder_id);
-	msg->addStringFast(_PREHASH_Name, self->mTBName->getText());
-	gAgent.sendReliableMessage();
-}
-*/
-
 // static
 void LLFloaterEvent::onClickCreateEvent(void* data)
 {
 	LLNotificationsUtil::add("PromptGoToEventsPage");//, LLSD(), LLSD(), callbackCreateEventWebPage); 
 }
 
+
 // static
 void LLFloaterEvent::onClickNotify(void *data)
 {
@@ -314,18 +322,3 @@ void LLFloaterEvent::onClickNotify(void *data)
 		self->mNotifyBtn->setLabel(self->getString("notify"));
 	}
 }
-/*
-// static
-bool LLPanelEvent::callbackCreateEventWebPage(const LLSD& notification, const LLSD& response)
-{
-	S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
-	if (0 == option)
-	{
-		llinfos << "Loading events page " <<  LLNotifications::instance().getGlobalString("EVENTS_URL") << llendl;
-
-		LLWeb::loadURL( LLNotifications::instance().getGlobalString("EVENTS_URL"));
-	}
-	return false;
-}
-*/
-
diff --git a/indra/newview/llfloaterevent.h b/indra/newview/llfloaterevent.h
index c93e3f73ca..54aaaf6a0f 100644
--- a/indra/newview/llfloaterevent.h
+++ b/indra/newview/llfloaterevent.h
@@ -34,7 +34,6 @@
 #define LL_LLFLOATEREVENT_H
 
 #include "llfloater.h"
-
 #include "lleventinfo.h"
 #include "lluuid.h"
 #include "v3dmath.h"
@@ -42,6 +41,7 @@
 class LLTextBox;
 class LLTextEditor;
 class LLButton;
+class LLExpandableTextBox;
 class LLMessageSystem;
 
 class LLFloaterEvent : public LLFloater
@@ -68,6 +68,7 @@ protected:
 	//static void onClickLandmark(void*);
 	static void onClickCreateEvent(void*);
 	static void onClickNotify(void*);
+	void onClickDeleteEvent();
 
 //	static bool callbackCreateEventWebPage(const LLSD& notification, const LLSD& response);
 
@@ -79,7 +80,7 @@ protected:
 	LLTextBox*		mTBCategory;
 	LLTextBox*		mTBDate;
 	LLTextBox*		mTBDuration;
-	LLTextEditor*	mTBDesc;
+	LLExpandableTextBox*	mTBDesc;
 
 	LLTextBox*		mTBRunBy;
 	LLTextBox*		mTBLocation;
@@ -88,6 +89,7 @@ protected:
 	LLButton*		mTeleportBtn;
 	LLButton*		mMapBtn;
 	LLButton*		mCreateEventBtn;
+	LLButton*		mGodDeleteEventBtn;
 	LLButton*		mNotifyBtn;
 };
 
diff --git a/indra/newview/skins/default/xui/en/floater_event.xml b/indra/newview/skins/default/xui/en/floater_event.xml
index 3d579f56be..9ce0c9c86d 100644
--- a/indra/newview/skins/default/xui/en/floater_event.xml
+++ b/indra/newview/skins/default/xui/en/floater_event.xml
@@ -73,7 +73,7 @@
        width="310">
         Run by:
       </text>
-      <name_box
+      <text
         follows="left|top"
         height="20"
         initial_value="(retrieving)"
@@ -174,8 +174,7 @@
                height="106"
                layout="topleft"
                left="6"
-       name="event_desc"
-               value="Du waltz die spritz"
+               name="event_desc"
                width="313" />
     </layout_panel>
     <layout_panel
@@ -200,12 +199,26 @@
            tool_tip="Create Event"
            width="18" />
       <button
+       follows="left|top"
+           height="18"
+           image_selected="MinusItem_Press"
+           image_unselected="MinusItem_Off"
+           image_disabled="MinusItem_Disabled"
+           layout="topleft"
+           visible="false" 
+           left="6"
+           top_pad="-7" 
+          name="god_delete_event_btn"
+           picture_style="true"
+           tool_tip="Delete Event"
+           width="18" />
+      <button
    follows="left|top"
    height="23"
    label="Notify Me"
    layout="topleft"
    left_pad="3"
-   top_delta="-1"
+   top_delta="-12"
    name="notify_btn"
    width="100" />
       <button
-- 
cgit v1.2.3


From 318a88f57b1d07f69193d1b8b45a18774f39ff38 Mon Sep 17 00:00:00 2001
From: Tofu Linden <tofu.linden@lindenlab.com>
Date: Fri, 12 Feb 2010 19:32:26 +0000
Subject: fix typos in EXT-5248 / d6fd7b96d638

---
 indra/newview/llagent.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp
index 7929946620..3675be16e9 100644
--- a/indra/newview/llagent.cpp
+++ b/indra/newview/llagent.cpp
@@ -5027,9 +5027,9 @@ void LLAgent::buildFullnameAndTitle(std::string& name) const
 	}
 }
 
-BOOL LLAgent::isInGroup(const LLUUID& group_id, BOOL ingnore_God_mod /* FALSE */) const
+BOOL LLAgent::isInGroup(const LLUUID& group_id, BOOL ignore_god_mode /* FALSE */) const
 {
-	if (!ingnore_God_mod && isGodlike())
+	if (!ignore_god_mode && isGodlike())
 		return true;
 
 	S32 count = mGroups.count();
-- 
cgit v1.2.3


From 5d199b220bda4e42f544c8a04eba8000c438abf2 Mon Sep 17 00:00:00 2001
From: Erica <erica@lindenlab.com>
Date: Fri, 12 Feb 2010 11:37:58 -0800
Subject:   EXT-4996 Master volume slider blends into other UI chrome, nearly
 impossible to see

---
 indra/newview/skins/default/textures/textures.xml         |   7 +++++--
 .../skins/default/textures/windows/Volume_Background.png  | Bin 0 -> 589 bytes
 .../skins/default/xui/en/panel_volume_pulldown.xml        |   4 ++--
 3 files changed, 7 insertions(+), 4 deletions(-)
 create mode 100644 indra/newview/skins/default/textures/windows/Volume_Background.png

(limited to 'indra')

diff --git a/indra/newview/skins/default/textures/textures.xml b/indra/newview/skins/default/textures/textures.xml
index 18d1779702..0065d824d2 100644
--- a/indra/newview/skins/default/textures/textures.xml
+++ b/indra/newview/skins/default/textures/textures.xml
@@ -633,8 +633,8 @@ with the same filename but different name
   <texture name="Unread_Msg" file_name="bottomtray/Unread_Msg.png" preload="false" />
   <texture name="Unread_IM" file_name="bottomtray/Unread_IM.png" preload="false" />
 
-  <texture name="WellButton_Lit" file_name="bottomtray/WellButton_Lit.png"  preload="true" scale.left="4" scale.top="19" scale.right="28" scale.bottom="4" />
-  <texture name="WellButton_Lit_Selected" file_name="bottomtray/WellButton_Lit_Selected.png" preload="true" scale.left="4" scale.top="19" scale.right="28" scale.bottom="4" />
+    <texture name="Volume_Background" file_name="windows/Volume_Background.png" preload="false"
+           scale.left="6" scale.top="33" scale.right="63" scale.bottom="10" />
 
   <texture name="VoicePTT_Lvl1" file_name="bottomtray/VoicePTT_Lvl1.png" preload="false" />
   <texture name="VoicePTT_Lvl2" file_name="bottomtray/VoicePTT_Lvl2.png" preload="false" />
@@ -642,6 +642,9 @@ with the same filename but different name
   <texture name="VoicePTT_Off" file_name="bottomtray/VoicePTT_Off.png" preload="false" />
   <texture name="VoicePTT_On" file_name="bottomtray/VoicePTT_On.png" preload="false" />
 
+  <texture name="WellButton_Lit" file_name="bottomtray/WellButton_Lit.png"  preload="true" scale.left="4" scale.top="19" scale.right="28" scale.bottom="4" />
+  <texture name="WellButton_Lit_Selected" file_name="bottomtray/WellButton_Lit_Selected.png" preload="true" scale.left="4" scale.top="19" scale.right="28" scale.bottom="4" />
+
   <texture name="WebBasedMediaBackground" file_name="windows/WebBasedMediaBackground.png" preload="false" />
 
   <texture name="Widget_DownArrow" file_name="icons/Widget_DownArrow.png" preload="true" />
diff --git a/indra/newview/skins/default/textures/windows/Volume_Background.png b/indra/newview/skins/default/textures/windows/Volume_Background.png
new file mode 100644
index 0000000000..43aaa441f5
Binary files /dev/null and b/indra/newview/skins/default/textures/windows/Volume_Background.png differ
diff --git a/indra/newview/skins/default/xui/en/panel_volume_pulldown.xml b/indra/newview/skins/default/xui/en/panel_volume_pulldown.xml
index 60d4a7e00b..55ab95bfe9 100644
--- a/indra/newview/skins/default/xui/en/panel_volume_pulldown.xml
+++ b/indra/newview/skins/default/xui/en/panel_volume_pulldown.xml
@@ -4,7 +4,7 @@
  background_visible="false"
  border_visible="false"
  border="false"
- chrome="true" 
+ chrome="true"
  follows="bottom"
  height="150"
  layout="topleft"
@@ -13,7 +13,7 @@
   <!-- floater background image -->
   <icon
    height="150"
-   image_name="Inspector_Background"
+   image_name="Volume_Background"
    layout="topleft"
    left="0"
    name="normal_background"
-- 
cgit v1.2.3


From 21be0916a4b707654e99a8c6c734d24e4bb5da7c Mon Sep 17 00:00:00 2001
From: Leyla Farazha <leyla@lindenlab.com>
Date: Fri, 12 Feb 2010 12:07:16 -0800
Subject: fixing windows eol

---
 indra/newview/llfloaterevent.cpp | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/llfloaterevent.cpp b/indra/newview/llfloaterevent.cpp
index a51c613c37..64efa10ef9 100644
--- a/indra/newview/llfloaterevent.cpp
+++ b/indra/newview/llfloaterevent.cpp
@@ -150,16 +150,16 @@ void LLFloaterEvent::setEventID(const U32 event_id)
 
 void LLFloaterEvent::onClickDeleteEvent()
 {
-	LLMessageSystem* msg = gMessageSystem;
-
-	msg->newMessageFast(_PREHASH_EventGodDelete);
-	msg->nextBlockFast(_PREHASH_AgentData);
-	msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
-	msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
-
-	msg->nextBlockFast(_PREHASH_EventData);
-	msg->addU32Fast(_PREHASH_EventID, mEventID);
-
+	LLMessageSystem* msg = gMessageSystem;
+
+	msg->newMessageFast(_PREHASH_EventGodDelete);
+	msg->nextBlockFast(_PREHASH_AgentData);
+	msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
+	msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
+
+	msg->nextBlockFast(_PREHASH_EventData);
+	msg->addU32Fast(_PREHASH_EventID, mEventID);
+
 	gAgent.sendReliableMessage();
 }
 
-- 
cgit v1.2.3


From dce57c6b80b1286889da1a6cadda05c864a31851 Mon Sep 17 00:00:00 2001
From: Loren Shih <seraph@lindenlab.com>
Date: Fri, 12 Feb 2010 17:13:05 -0500
Subject: EXT-5297 : System folders no longer sort properly in Snowglobe (and
 Emerald) inventory windows EXT-5399 : Ensemble folder typing code has been
 reenabled and is mangling inventory folders

This fixes two issues:
1. A very serious issue where ensemble auto-typing code was somehow uncommented/reintroduced into viewer2.  This randomly changes folder types (sometimes into what older viewers will treat as system folders; i.e. you can't delete or move them).
2. A minor issue where sorting was not correctly identifying what was a system folder or not.
---
 indra/newview/llfolderviewitem.cpp  | 3 +--
 indra/newview/llviewerinventory.cpp | 4 ++++
 2 files changed, 5 insertions(+), 2 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/llfolderviewitem.cpp b/indra/newview/llfolderviewitem.cpp
index 3946224c0c..76607e4874 100644
--- a/indra/newview/llfolderviewitem.cpp
+++ b/indra/newview/llfolderviewitem.cpp
@@ -1855,10 +1855,9 @@ EInventorySortGroup LLFolderViewFolder::getSortGroup() const
 		return SG_TRASH_FOLDER;
 	}
 
-	// Folders that can't be moved are 'system' folders. 
 	if( mListener )
 	{
-		if( !(mListener->isItemMovable()) )
+		if(LLFolderType::lookupIsProtectedType(mListener->getPreferredType()))
 		{
 			return SG_SYSTEM_FOLDER;
 		}
diff --git a/indra/newview/llviewerinventory.cpp b/indra/newview/llviewerinventory.cpp
index 3001992630..b69eaa4853 100644
--- a/indra/newview/llviewerinventory.cpp
+++ b/indra/newview/llviewerinventory.cpp
@@ -649,6 +649,8 @@ bool LLViewerInventoryCategory::exportFileLocal(LLFILE* fp) const
 
 void LLViewerInventoryCategory::determineFolderType()
 {
+	/* Do NOT uncomment this code.  This is for future 2.1 support of ensembles.
+	llassert(FALSE);
 	LLFolderType::EType original_type = getPreferredType();
 	if (LLFolderType::lookupIsProtectedType(original_type))
 		return;
@@ -692,6 +694,8 @@ void LLViewerInventoryCategory::determineFolderType()
 	{
 		changeType(LLFolderType::FT_NONE);
 	}
+	llassert(FALSE);
+	*/
 }
 
 void LLViewerInventoryCategory::changeType(LLFolderType::EType new_folder_type)
-- 
cgit v1.2.3


From 03d79f1bf7e620c25245a06f442f809f0958ffbf Mon Sep 17 00:00:00 2001
From: Xiaohong Bao <bao@lindenlab.com>
Date: Fri, 12 Feb 2010 14:21:36 -0800
Subject: some code dents change (nothing else).

---
 indra/newview/lltexturefetch.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/lltexturefetch.cpp b/indra/newview/lltexturefetch.cpp
index 6dcf4bc798..6c35464a51 100644
--- a/indra/newview/lltexturefetch.cpp
+++ b/indra/newview/lltexturefetch.cpp
@@ -1515,8 +1515,8 @@ bool LLTextureFetch::createRequest(const std::string& url, const LLUUID& id, con
 		unlockQueue() ;
 
 		worker->lockWorkMutex();
-	worker->mActiveCount++;
-	worker->mNeedsAux = needs_aux;
+		worker->mActiveCount++;
+		worker->mNeedsAux = needs_aux;
 		worker->unlockWorkMutex();
 	}
 	
-- 
cgit v1.2.3


From c1b0625f384801cadcd9b8f210fd0c48d036a8a0 Mon Sep 17 00:00:00 2001
From: Xiaohong Bao <bao@lindenlab.com>
Date: Fri, 12 Feb 2010 14:23:22 -0800
Subject: fix for EXT-4653: Textures saved with "Save As" appear to be very low
 rez. and beyond: remove saved raw image automatically.

---
 indra/newview/llviewertexture.cpp | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp
index b66f58d853..51d99a1d36 100644
--- a/indra/newview/llviewertexture.cpp
+++ b/indra/newview/llviewertexture.cpp
@@ -2250,13 +2250,13 @@ void LLViewerFetchedTexture::destroyRawImage()
 
 	if (mRawImage.notNull()) 
 	{
-		sRawCount--;
-		setCachedRawImage() ;
+		sRawCount--;		
 
 		if(mForceToSaveRawImage)
 		{
 			saveRawImage() ;
 		}		
+		setCachedRawImage() ;
 	}
 
 	mRawImage = NULL;
@@ -2346,7 +2346,8 @@ void LLViewerFetchedTexture::setCachedRawImage()
 			mRawImage->scale(w >> i, h >> i) ;
 		}
 		mCachedRawImage = mRawImage ;
-		mCachedRawDiscardLevel = mRawDiscardLevel + i ;			
+		mRawDiscardLevel += i ;
+		mCachedRawDiscardLevel = mRawDiscardLevel ;			
 	}
 }
 
@@ -2416,7 +2417,7 @@ BOOL LLViewerFetchedTexture::hasSavedRawImage() const
 	
 F32 LLViewerFetchedTexture::getElapsedLastReferencedSavedRawImageTime() const
 { 
-	return mLastReferencedSavedRawImageTime - sCurrentTime ;
+	return sCurrentTime - mLastReferencedSavedRawImageTime ;
 }
 //----------------------------------------------------------------------------------------------
 //atlasing
-- 
cgit v1.2.3


From c0f2f151b226417152adecb507e6b1b7f2a1f8ce Mon Sep 17 00:00:00 2001
From: Callum Prentice <callum@lindenlab.com>
Date: Fri, 12 Feb 2010 15:24:53 -0800
Subject: "Fix for EXT-4968 - Media DnD cannot navigate prims owned by other
 people" Reviewed by Rick via CodeCollab
 (http://10.1.19.90:8080/go?page=ReviewDisplay&reviewid=110)

---
 indra/newview/llviewerwindow.cpp | 81 ++++++++++++++++++++++++----------------
 1 file changed, 48 insertions(+), 33 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp
index b76a2e150f..1dcc7389cb 100644
--- a/indra/newview/llviewerwindow.cpp
+++ b/indra/newview/llviewerwindow.cpp
@@ -852,56 +852,71 @@ LLWindowCallbacks::DragNDropResult LLViewerWindow::handleDragNDrop( LLWindow *wi
 
 					LLVOVolume *obj = dynamic_cast<LLVOVolume*>(static_cast<LLViewerObject*>(pick_info.getObject()));
 				
-					if (obj && obj->permModify() && !obj->getRegion()->getCapability("ObjectMedia").empty())
+					if (obj && !obj->getRegion()->getCapability("ObjectMedia").empty())
 					{
 						LLTextureEntry *te = obj->getTE(object_face);
 						if (te)
 						{
 							if (drop)
 							{
-								if (! te->hasMedia())
+								// object does NOT have media already
+								if ( ! te->hasMedia() )
 								{
-									// Create new media entry
-									LLSD media_data;
-									// XXX Should we really do Home URL too?
-									media_data[LLMediaEntry::HOME_URL_KEY] = url;
-									media_data[LLMediaEntry::CURRENT_URL_KEY] = url;
-									media_data[LLMediaEntry::AUTO_PLAY_KEY] = true;
-									obj->syncMediaData(object_face, media_data, true, true);
-									// XXX This shouldn't be necessary, should it ?!?
-									if (obj->getMediaImpl(object_face))
-										obj->getMediaImpl(object_face)->navigateReload();
-									obj->sendMediaDataUpdate();
-								
-									result = LLWindowCallbacks::DND_COPY;
-								}
-								else {
-									// Check the whitelist
-									if (te->getMediaData()->checkCandidateUrl(url))
+									// we are allowed to modify the object
+									if ( obj->permModify() )
 									{
-										// just navigate to the URL
+										// Create new media entry
+										LLSD media_data;
+										// XXX Should we really do Home URL too?
+										media_data[LLMediaEntry::HOME_URL_KEY] = url;
+										media_data[LLMediaEntry::CURRENT_URL_KEY] = url;
+										media_data[LLMediaEntry::AUTO_PLAY_KEY] = true;
+										obj->syncMediaData(object_face, media_data, true, true);
+										// XXX This shouldn't be necessary, should it ?!?
 										if (obj->getMediaImpl(object_face))
+											obj->getMediaImpl(object_face)->navigateReload();
+										obj->sendMediaDataUpdate();
+
+										result = LLWindowCallbacks::DND_COPY;
+									}
+								}
+								else 
+								// object HAS media already
+								{
+									// URL passes the whitelist
+									if (te->getMediaData()->checkCandidateUrl( url ) )
+									{
+										// we are allowed to modify the object or we have navigate permissions
+										// NOTE: Design states you you can change the URL if you have media 
+										//       navigate permissions even if you do not have prim modify rights
+										if ( obj->permModify() || obj->hasMediaPermission( te->getMediaData(), LLVOVolume::MEDIA_PERM_INTERACT ) )
 										{
-											obj->getMediaImpl(object_face)->navigateTo(url);
+											// just navigate to the URL
+											if (obj->getMediaImpl(object_face))
+											{
+												obj->getMediaImpl(object_face)->navigateTo(url);
+											}
+											else 
+											{
+												// This is very strange.  Navigation should
+												// happen via the Impl, but we don't have one.
+												// This sends it to the server, which /should/
+												// trigger us getting it.  Hopefully.
+												LLSD media_data;
+												media_data[LLMediaEntry::CURRENT_URL_KEY] = url;
+												obj->syncMediaData(object_face, media_data, true, true);
+												obj->sendMediaDataUpdate();
+											}
+											result = LLWindowCallbacks::DND_LINK;
 										}
-										else {
-											// This is very strange.  Navigation should
-											// happen via the Impl, but we don't have one.
-											// This sends it to the server, which /should/
-											// trigger us getting it.  Hopefully.
-											LLSD media_data;
-											media_data[LLMediaEntry::CURRENT_URL_KEY] = url;
-											obj->syncMediaData(object_face, media_data, true, true);
-											obj->sendMediaDataUpdate();
-										}
-										result = LLWindowCallbacks::DND_LINK;
 									}
 								}
 								LLSelectMgr::getInstance()->unhighlightObjectOnly(mDragHoveredObject);
 								mDragHoveredObject = NULL;
 							
 							}
-							else {
+							else 
+							{
 								// Check the whitelist, if there's media (otherwise just show it)
 								if (te->getMediaData() == NULL || te->getMediaData()->checkCandidateUrl(url))
 								{
-- 
cgit v1.2.3


From 0b450b600339580b9ca3906046d5679f9349ebf3 Mon Sep 17 00:00:00 2001
From: "Mark Palange (Mani)" <palange@lindenlab.com>
Date: Fri, 12 Feb 2010 16:32:28 -0800
Subject: Changing viewer unit test licenses to viewergpl

---
 indra/llmessage/tests/llareslistener_test.cpp | 2 +-
 indra/newview/tests/lllogininstance_test.cpp  | 2 +-
 indra/newview/tests/llxmlrpclistener_test.cpp | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

(limited to 'indra')

diff --git a/indra/llmessage/tests/llareslistener_test.cpp b/indra/llmessage/tests/llareslistener_test.cpp
index ac4886ccf4..6ee74c8e7a 100644
--- a/indra/llmessage/tests/llareslistener_test.cpp
+++ b/indra/llmessage/tests/llareslistener_test.cpp
@@ -4,7 +4,7 @@
  * @date   2009-02-26
  * @brief  Tests of llareslistener.h.
  * 
- * $LicenseInfo:firstyear=2009&license=internal$
+ * $LicenseInfo:firstyear=2009&license=viewergpl$
  * Copyright (c) 2009, Linden Research, Inc.
  * $/LicenseInfo$
  */
diff --git a/indra/newview/tests/lllogininstance_test.cpp b/indra/newview/tests/lllogininstance_test.cpp
index f7ac5361c5..ef93586c6e 100644
--- a/indra/newview/tests/lllogininstance_test.cpp
+++ b/indra/newview/tests/lllogininstance_test.cpp
@@ -2,7 +2,7 @@
  * @file   lllogininstance_test.cpp
  * @brief  Test for lllogininstance.cpp.
  * 
- * $LicenseInfo:firstyear=2008&license=internal$
+ * $LicenseInfo:firstyear=2008&license=viewergpl$
  * Copyright (c) 2008, Linden Research, Inc.
  * $/LicenseInfo$
  */
diff --git a/indra/newview/tests/llxmlrpclistener_test.cpp b/indra/newview/tests/llxmlrpclistener_test.cpp
index c94ba0a3e8..c2c7e963b9 100644
--- a/indra/newview/tests/llxmlrpclistener_test.cpp
+++ b/indra/newview/tests/llxmlrpclistener_test.cpp
@@ -4,7 +4,7 @@
  * @date   2009-03-20
  * @brief  Test for llxmlrpclistener.
  * 
- * $LicenseInfo:firstyear=2009&license=internal$
+ * $LicenseInfo:firstyear=2009&license=viewergpl$
  * Copyright (c) 2009, Linden Research, Inc.
  * $/LicenseInfo$
  */
-- 
cgit v1.2.3


From af229a7bb0c891ec5d3e256e2509313c636973a3 Mon Sep 17 00:00:00 2001
From: Xiaohong Bao <bao@lindenlab.com>
Date: Fri, 12 Feb 2010 17:11:36 -0800
Subject: cast type F32 to GLint to eliminate some compiling warnings.

---
 indra/llui/llui.cpp | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

(limited to 'indra')

diff --git a/indra/llui/llui.cpp b/indra/llui/llui.cpp
index 852a19660a..44a57a0989 100644
--- a/indra/llui/llui.cpp
+++ b/indra/llui/llui.cpp
@@ -710,19 +710,19 @@ void gl_draw_scaled_rotated_image(S32 x, S32 y, S32 width, S32 height, F32 degre
 
 			v = LLVector3(offset_x, offset_y, 0.f) * quat;
 			gGL.texCoord2f(uv_rect.mRight, uv_rect.mTop);
-			gGL.vertex2i(v.mV[0], v.mV[1] );
+			gGL.vertex2i((GLint)v.mV[0], (GLint)v.mV[1] );
 
 			v = LLVector3(-offset_x, offset_y, 0.f) * quat;
 			gGL.texCoord2f(uv_rect.mLeft, uv_rect.mTop);
-			gGL.vertex2i(v.mV[0], v.mV[1] );
+			gGL.vertex2i((GLint)v.mV[0], (GLint)v.mV[1] );
 
 			v = LLVector3(-offset_x, -offset_y, 0.f) * quat;
 			gGL.texCoord2f(uv_rect.mLeft, uv_rect.mBottom);
-			gGL.vertex2i(v.mV[0], v.mV[1] );
+			gGL.vertex2i((GLint)v.mV[0], (GLint)v.mV[1] );
 
 			v = LLVector3(offset_x, -offset_y, 0.f) * quat;
 			gGL.texCoord2f(uv_rect.mRight, uv_rect.mBottom);
-			gGL.vertex2i(v.mV[0], v.mV[1] );
+			gGL.vertex2i((GLint)v.mV[0], (GLint)v.mV[1] );
 		}
 		gGL.end();
 		gGL.popUIMatrix();
-- 
cgit v1.2.3


From fecd9b2babda77449cdb5c0f8493ac5f002f5480 Mon Sep 17 00:00:00 2001
From: Erica <erica@lindenlab.com>
Date: Fri, 12 Feb 2010 17:15:15 -0800
Subject: EXT-5365change shoe icon in Viewer 2.0 inventory list

---
 .../newview/skins/default/textures/icons/Inv_Shoe.png | Bin 276 -> 54133 bytes
 1 file changed, 0 insertions(+), 0 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/skins/default/textures/icons/Inv_Shoe.png b/indra/newview/skins/default/textures/icons/Inv_Shoe.png
index 51e1c7bbb7..1f52b0a6b6 100644
Binary files a/indra/newview/skins/default/textures/icons/Inv_Shoe.png and b/indra/newview/skins/default/textures/icons/Inv_Shoe.png differ
-- 
cgit v1.2.3


From 25be5a201fefed5653fca9ae348b10045b090c92 Mon Sep 17 00:00:00 2001
From: Palmer Truelson <palmer@lindenlab.com>
Date: Fri, 12 Feb 2010 21:02:25 -0800
Subject: Backed out bao's fix to FSAA that will also be backed out. changeset
 ae9bbbf181d9

---
 indra/llui/llui.cpp | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

(limited to 'indra')

diff --git a/indra/llui/llui.cpp b/indra/llui/llui.cpp
index 44a57a0989..852a19660a 100644
--- a/indra/llui/llui.cpp
+++ b/indra/llui/llui.cpp
@@ -710,19 +710,19 @@ void gl_draw_scaled_rotated_image(S32 x, S32 y, S32 width, S32 height, F32 degre
 
 			v = LLVector3(offset_x, offset_y, 0.f) * quat;
 			gGL.texCoord2f(uv_rect.mRight, uv_rect.mTop);
-			gGL.vertex2i((GLint)v.mV[0], (GLint)v.mV[1] );
+			gGL.vertex2i(v.mV[0], v.mV[1] );
 
 			v = LLVector3(-offset_x, offset_y, 0.f) * quat;
 			gGL.texCoord2f(uv_rect.mLeft, uv_rect.mTop);
-			gGL.vertex2i((GLint)v.mV[0], (GLint)v.mV[1] );
+			gGL.vertex2i(v.mV[0], v.mV[1] );
 
 			v = LLVector3(-offset_x, -offset_y, 0.f) * quat;
 			gGL.texCoord2f(uv_rect.mLeft, uv_rect.mBottom);
-			gGL.vertex2i((GLint)v.mV[0], (GLint)v.mV[1] );
+			gGL.vertex2i(v.mV[0], v.mV[1] );
 
 			v = LLVector3(offset_x, -offset_y, 0.f) * quat;
 			gGL.texCoord2f(uv_rect.mRight, uv_rect.mBottom);
-			gGL.vertex2i((GLint)v.mV[0], (GLint)v.mV[1] );
+			gGL.vertex2i(v.mV[0], v.mV[1] );
 		}
 		gGL.end();
 		gGL.popUIMatrix();
-- 
cgit v1.2.3


From b392e1c3bd2c20ac661e86c741482548eae39e27 Mon Sep 17 00:00:00 2001
From: Palmer Truelson <palmer@lindenlab.com>
Date: Fri, 12 Feb 2010 21:03:43 -0800
Subject: Backed out dave's FSAA/FBO change changeset 89f62bede16f

---
 indra/newview/app_settings/settings.xml |  2 +-
 indra/newview/llviewercontrol.cpp       |  1 -
 indra/newview/llviewerwindow.cpp        | 13 ++++++-------
 3 files changed, 7 insertions(+), 9 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml
index 8a447502b0..c7300fcee2 100644
--- a/indra/newview/app_settings/settings.xml
+++ b/indra/newview/app_settings/settings.xml
@@ -7384,7 +7384,7 @@
       <key>Type</key>
       <string>Boolean</string>
       <key>Value</key>
-      <integer>1</integer>
+      <integer>0</integer>
     </map>
     <key>RenderUseFarClip</key>
     <map>
diff --git a/indra/newview/llviewercontrol.cpp b/indra/newview/llviewercontrol.cpp
index 827d34138f..64eabe65cf 100644
--- a/indra/newview/llviewercontrol.cpp
+++ b/indra/newview/llviewercontrol.cpp
@@ -514,7 +514,6 @@ void settings_setup_listeners()
 	gSavedSettings.getControl("RenderAvatarVP")->getSignal()->connect(boost::bind(&handleSetShaderChanged, _2));
 	gSavedSettings.getControl("VertexShaderEnable")->getSignal()->connect(boost::bind(&handleSetShaderChanged, _2));
 	gSavedSettings.getControl("RenderUIBuffer")->getSignal()->connect(boost::bind(&handleReleaseGLBufferChanged, _2));
-	gSavedSettings.getControl("RenderFSAASamples")->getSignal()->connect(boost::bind(&handleReleaseGLBufferChanged, _2));
 	gSavedSettings.getControl("RenderShadowResolutionScale")->getSignal()->connect(boost::bind(&handleReleaseGLBufferChanged, _2));
 	gSavedSettings.getControl("RenderGlow")->getSignal()->connect(boost::bind(&handleReleaseGLBufferChanged, _2));
 	gSavedSettings.getControl("RenderGlow")->getSignal()->connect(boost::bind(&handleSetShaderChanged, _2));
diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp
index 3e1306ae3c..77e4663433 100644
--- a/indra/newview/llviewerwindow.cpp
+++ b/indra/newview/llviewerwindow.cpp
@@ -1362,7 +1362,7 @@ LLViewerWindow::LLViewerWindow(
 		gSavedSettings.getBOOL("DisableVerticalSync"),
 		!gNoRender,
 		ignore_pixel_depth,
-		0); //gSavedSettings.getU32("RenderFSAASamples"));
+		gSavedSettings.getU32("RenderFSAASamples"));
 
 	if (!LLAppViewer::instance()->restoreErrorTrap())
 	{
@@ -4713,9 +4713,8 @@ BOOL LLViewerWindow::changeDisplaySettings(BOOL fullscreen, LLCoordScreen size,
 		return TRUE;
 	}
 
-	//U32 fsaa = gSavedSettings.getU32("RenderFSAASamples");
-	//U32 old_fsaa = mWindow->getFSAASamples();
-
+	U32 fsaa = gSavedSettings.getU32("RenderFSAASamples");
+	U32 old_fsaa = mWindow->getFSAASamples();
 	// going from windowed to windowed
 	if (!old_fullscreen && !fullscreen)
 	{
@@ -4725,7 +4724,7 @@ BOOL LLViewerWindow::changeDisplaySettings(BOOL fullscreen, LLCoordScreen size,
 			mWindow->setSize(size);
 		}
 
-		//if (fsaa == old_fsaa)
+		if (fsaa == old_fsaa)
 		{
 			return TRUE;
 		}
@@ -4754,13 +4753,13 @@ BOOL LLViewerWindow::changeDisplaySettings(BOOL fullscreen, LLCoordScreen size,
 		gSavedSettings.setS32("WindowY", old_pos.mY);
 	}
 	
-	//mWindow->setFSAASamples(fsaa);
+	mWindow->setFSAASamples(fsaa);
 
 	result_first_try = mWindow->switchContext(fullscreen, size, disable_vsync);
 	if (!result_first_try)
 	{
 		// try to switch back
-		//mWindow->setFSAASamples(old_fsaa);
+		mWindow->setFSAASamples(old_fsaa);
 		result_second_try = mWindow->switchContext(old_fullscreen, old_size, disable_vsync);
 
 		if (!result_second_try)
-- 
cgit v1.2.3


From 651b14fcae01b089522f3672bbf35bfbe7268aac Mon Sep 17 00:00:00 2001
From: Palmer Truelson <palmer@lindenlab.com>
Date: Fri, 12 Feb 2010 21:04:51 -0800
Subject: Backed out davep's UI optimization. changeset 3134cb7bb181

---
 indra/llrender/llfontgl.cpp      |  30 +++++++----
 indra/llrender/llrender.cpp      | 106 ++----------------------------------
 indra/llrender/llrender.h        |  18 +------
 indra/llui/lltabcontainer.cpp    |  12 ++---
 indra/llui/llui.cpp              | 112 ++++++++++++++-------------------------
 indra/llui/llviewborder.cpp      |  58 ++++++++++++++++++++
 indra/llui/llviewborder.h        |   3 +-
 indra/newview/llhudrender.cpp    |  12 ++---
 indra/newview/llhudtext.cpp      |   2 +-
 indra/newview/llmediactrl.cpp    |   8 +--
 indra/newview/llnetmap.cpp       |  15 ------
 indra/newview/llviewerwindow.cpp |  14 +----
 12 files changed, 141 insertions(+), 249 deletions(-)

(limited to 'indra')

diff --git a/indra/llrender/llfontgl.cpp b/indra/llrender/llfontgl.cpp
index 129f3e7999..1de1d6ded4 100644
--- a/indra/llrender/llfontgl.cpp
+++ b/indra/llrender/llfontgl.cpp
@@ -151,16 +151,14 @@ S32 LLFontGL::render(const LLWString &wstr, S32 begin_offset, F32 x, F32 y, cons
 		}
 	}
 
-	gGL.pushUIMatrix();
-
-	gGL.loadUIIdentity();
-	
-	gGL.translateUI(floorf(sCurOrigin.mX*sScaleX), floorf(sCurOrigin.mY*sScaleY), sCurOrigin.mZ);
+	gGL.pushMatrix();
+	glLoadIdentity();
+	gGL.translatef(floorf(sCurOrigin.mX*sScaleX), floorf(sCurOrigin.mY*sScaleY), sCurOrigin.mZ);
 
 	// this code snaps the text origin to a pixel grid to start with
 	F32 pixel_offset_x = llround((F32)sCurOrigin.mX) - (sCurOrigin.mX);
 	F32 pixel_offset_y = llround((F32)sCurOrigin.mY) - (sCurOrigin.mY);
-	gGL.translateUI(-pixel_offset_x, -pixel_offset_y, 0.f);
+	gGL.translatef(-pixel_offset_x, -pixel_offset_y, 0.f);
 
 	LLFastTimer t(FTM_RENDER_FONTS);
 
@@ -248,6 +246,9 @@ S32 LLFontGL::render(const LLWString &wstr, S32 begin_offset, F32 x, F32 y, cons
 	}
 
 
+	// Remember last-used texture to avoid unnecesssary bind calls.
+	LLImageGL *last_bound_texture = NULL;
+
 	for (i = begin_offset; i < begin_offset + length; i++)
 	{
 		llwchar wch = wstr[i];
@@ -260,8 +261,12 @@ S32 LLFontGL::render(const LLWString &wstr, S32 begin_offset, F32 x, F32 y, cons
 		}
 		// Per-glyph bitmap texture.
 		LLImageGL *image_gl = mFontFreetype->getFontBitmapCache()->getImageGL(fgi->mBitmapNum);
-		gGL.getTexUnit(0)->bind(image_gl);
-	
+		if (last_bound_texture != image_gl)
+		{
+			gGL.getTexUnit(0)->bind(image_gl);
+			last_bound_texture = image_gl;
+		}
+
 		if ((start_x + scaled_max_pixels) < (cur_x + fgi->mXBearing + fgi->mWidth))
 		{
 			// Not enough room for this character.
@@ -325,7 +330,10 @@ S32 LLFontGL::render(const LLWString &wstr, S32 begin_offset, F32 x, F32 y, cons
 		
 		// recursively render ellipses at end of string
 		// we've already reserved enough room
-		gGL.pushUIMatrix();
+		gGL.pushMatrix();
+		//glLoadIdentity();
+		//gGL.translatef(sCurOrigin.mX, sCurOrigin.mY, 0.0f);
+		//glScalef(sScaleX, sScaleY, 1.f);
 		renderUTF8(std::string("..."), 
 				0,
 				cur_x / sScaleX, (F32)y,
@@ -336,10 +344,10 @@ S32 LLFontGL::render(const LLWString &wstr, S32 begin_offset, F32 x, F32 y, cons
 				S32_MAX, max_pixels,
 				right_x,
 				FALSE); 
-		gGL.popUIMatrix();
+		gGL.popMatrix();
 	}
 
-	gGL.popUIMatrix();
+	gGL.popMatrix();
 
 	return chars_drawn;
 }
diff --git a/indra/llrender/llrender.cpp b/indra/llrender/llrender.cpp
index cde60b7e25..f97d81126e 100644
--- a/indra/llrender/llrender.cpp
+++ b/indra/llrender/llrender.cpp
@@ -49,9 +49,6 @@ F64 gGLLastProjection[16];
 F64 gGLProjection[16];
 S32	gGLViewport[4];
 
-U32 LLRender::sUICalls = 0;
-U32 LLRender::sUIVerts = 0;
-
 static const U32 LL_NUM_TEXTURE_LAYERS = 16; 
 
 static GLenum sGLTextureType[] =
@@ -258,9 +255,10 @@ bool LLTexUnit::bind(LLImageGL* texture, bool for_rendering, bool forceBind)
 		return false ;
 	}
 
+	gGL.flush();
+
 	if ((mCurrTexture != texture->getTexName()) || forceBind)
 	{
-		gGL.flush();
 		activate();
 		enable(texture->getTarget());
 		mCurrTexture = texture->getTexName();
@@ -447,8 +445,6 @@ void LLTexUnit::setTextureBlendType(eTextureBlendType type)
 		return;
 	}
 
-	gGL.flush();
-
 	activate();
 	mCurrBlendType = type;
 	S32 scale_amount = 1;
@@ -760,7 +756,6 @@ LLRender::LLRender()
 
 	mCurrAlphaFunc = CF_DEFAULT;
 	mCurrAlphaFuncVal = 0.01f;
-	mCurrSceneBlendType = BT_ALPHA;
 }
 
 LLRender::~LLRender()
@@ -823,80 +818,6 @@ void LLRender::popMatrix()
 	glPopMatrix();
 }
 
-void LLRender::translateUI(F32 x, F32 y, F32 z)
-{
-	if (mUIOffset.empty())
-	{
-		llerrs << "Need to push a UI translation frame before offsetting" << llendl;
-	}
-
-	mUIOffset.front().mV[0] += x;
-	mUIOffset.front().mV[1] += y;
-	mUIOffset.front().mV[2] += z;
-}
-
-void LLRender::scaleUI(F32 x, F32 y, F32 z)
-{
-	if (mUIScale.empty())
-	{
-		llerrs << "Need to push a UI transformation frame before scaling." << llendl;
-	}
-
-	mUIScale.front().scaleVec(LLVector3(x,y,z));
-}
-
-void LLRender::pushUIMatrix()
-{
-	mUIOffset.push_front(mUIOffset.front());
-	if (mUIScale.empty())
-	{
-		mUIScale.push_front(LLVector3(1,1,1));
-	}
-	else
-	{
-		mUIScale.push_front(mUIScale.front());
-	}
-}
-
-void LLRender::popUIMatrix()
-{
-	if (mUIOffset.empty())
-	{
-		llerrs << "UI offset stack blown." << llendl;
-	}
-	mUIOffset.pop_front();
-	mUIScale.pop_front();
-}
-
-LLVector3 LLRender::getUITranslation()
-{
-	if (mUIOffset.empty())
-	{
-		llerrs << "UI offset stack empty." << llendl;
-	}
-	return mUIOffset.front();
-}
-
-LLVector3 LLRender::getUIScale()
-{
-	if (mUIScale.empty())
-	{
-		llerrs << "UI scale stack empty." << llendl;
-	}
-	return mUIScale.front();
-}
-
-
-void LLRender::loadUIIdentity()
-{
-	if (mUIOffset.empty())
-	{
-		llerrs << "Need to push UI translation frame before clearing offset." << llendl;
-	}
-	mUIOffset.front().setVec(0,0,0);
-	mUIScale.front().setVec(1,1,1);
-}
-
 void LLRender::setColorMask(bool writeColor, bool writeAlpha)
 {
 	setColorMask(writeColor, writeColor, writeColor, writeAlpha);
@@ -919,11 +840,6 @@ void LLRender::setColorMask(bool writeColorR, bool writeColorG, bool writeColorB
 
 void LLRender::setSceneBlendType(eBlendType type)
 {
-	if (mCurrSceneBlendType == type)
-	{
-		return;
-	}
-
 	flush();
 	switch (type) 
 	{
@@ -952,7 +868,6 @@ void LLRender::setSceneBlendType(eBlendType type)
 			llerrs << "Unknown Scene Blend Type: " << type << llendl;
 			break;
 	}
-	mCurrSceneBlendType = type;
 }
 
 void LLRender::setAlphaRejectSettings(eCompareFunc func, F32 value)
@@ -1094,12 +1009,6 @@ void LLRender::flush()
 		}
 #endif
 				
-		if (!mUIOffset.empty())
-		{
-			sUICalls++;
-			sUIVerts += mCount;
-		}
-
 		mBuffer->setBuffer(immediate_mask);
 		mBuffer->drawArrays(mMode, 0, mCount);
 		
@@ -1119,16 +1028,7 @@ void LLRender::vertex3f(const GLfloat& x, const GLfloat& y, const GLfloat& z)
 		return;
 	}
 
-	if (mUIOffset.empty())
-	{
-		mVerticesp[mCount] = LLVector3(x,y,z);
-	}
-	else
-	{
-		LLVector3 vert = (LLVector3(x,y,z)+mUIOffset.front()).scaledVec(mUIScale.front());
-		mVerticesp[mCount] = vert;
-	}
-
+	mVerticesp[mCount] = LLVector3(x,y,z);
 	mCount++;
 	if (mCount < 4096)
 	{
diff --git a/indra/llrender/llrender.h b/indra/llrender/llrender.h
index 6e38fac67b..0121a190ee 100644
--- a/indra/llrender/llrender.h
+++ b/indra/llrender/llrender.h
@@ -286,14 +286,6 @@ public:
 	void pushMatrix();
 	void popMatrix();
 
-	void translateUI(F32 x, F32 y, F32 z);
-	void scaleUI(F32 x, F32 y, F32 z);
-	void pushUIMatrix();
-	void popUIMatrix();
-	void loadUIIdentity();
-	LLVector3 getUITranslation();
-	LLVector3 getUIScale();
-
 	void flush();
 
 	void begin(const GLuint& mode);
@@ -341,9 +333,7 @@ public:
 	};
 
 public:
-	static U32 sUICalls;
-	static U32 sUIVerts;
-	
+
 private:
 	bool				mDirty;
 	U32				mCount;
@@ -360,13 +350,7 @@ private:
 	std::vector<LLTexUnit*>		mTexUnits;
 	LLTexUnit*			mDummyTexUnit;
 
-	U32				mCurrSceneBlendType;
-
 	F32				mMaxAnisotropy;
-
-	std::list<LLVector3> mUIOffset;
-	std::list<LLVector3> mUIScale;
-
 };
 
 extern F64 gGLModelView[16];
diff --git a/indra/llui/lltabcontainer.cpp b/indra/llui/lltabcontainer.cpp
index f11bc2173c..6be76605fd 100644
--- a/indra/llui/lltabcontainer.cpp
+++ b/indra/llui/lltabcontainer.cpp
@@ -402,15 +402,15 @@ void LLTabContainer::draw()
 		if( mIsVertical && has_scroll_arrows )
 		{
 			// Redraw the arrows so that they appears on top.
-			gGL.pushUIMatrix();
-			gGL.translateUI((F32)mPrevArrowBtn->getRect().mLeft, (F32)mPrevArrowBtn->getRect().mBottom, 0.f);
+			gGL.pushMatrix();
+			gGL.translatef((F32)mPrevArrowBtn->getRect().mLeft, (F32)mPrevArrowBtn->getRect().mBottom, 0.f);
 			mPrevArrowBtn->draw();
-			gGL.popUIMatrix();
+			gGL.popMatrix();
 
-			gGL.pushUIMatrix();
-			gGL.translateUI((F32)mNextArrowBtn->getRect().mLeft, (F32)mNextArrowBtn->getRect().mBottom, 0.f);
+			gGL.pushMatrix();
+			gGL.translatef((F32)mNextArrowBtn->getRect().mLeft, (F32)mNextArrowBtn->getRect().mBottom, 0.f);
 			mNextArrowBtn->draw();
-			gGL.popUIMatrix();
+			gGL.popMatrix();
 		}
 	}
 
diff --git a/indra/llui/llui.cpp b/indra/llui/llui.cpp
index 0e2e8bf8ed..d0ed3b6fca 100644
--- a/indra/llui/llui.cpp
+++ b/indra/llui/llui.cpp
@@ -39,7 +39,6 @@
 
 // Linden library includes
 #include "v2math.h"
-#include "m3math.h"
 #include "v4color.h"
 #include "llrender.h"
 #include "llrect.h"
@@ -181,19 +180,19 @@ void gl_rect_2d_offset_local( S32 left, S32 top, S32 right, S32 bottom, const LL
 
 void gl_rect_2d_offset_local( S32 left, S32 top, S32 right, S32 bottom, S32 pixel_offset, BOOL filled)
 {
-	gGL.pushUIMatrix();
+	gGL.pushMatrix();
 	left += LLFontGL::sCurOrigin.mX;
 	right += LLFontGL::sCurOrigin.mX;
 	bottom += LLFontGL::sCurOrigin.mY;
 	top += LLFontGL::sCurOrigin.mY;
 
-	gGL.loadUIIdentity();
+	glLoadIdentity();
 	gl_rect_2d(llfloor((F32)left * LLUI::sGLScaleFactor.mV[VX]) - pixel_offset,
 				llfloor((F32)top * LLUI::sGLScaleFactor.mV[VY]) + pixel_offset,
 				llfloor((F32)right * LLUI::sGLScaleFactor.mV[VX]) + pixel_offset,
 				llfloor((F32)bottom * LLUI::sGLScaleFactor.mV[VY]) - pixel_offset,
 				filled);
-	gGL.popUIMatrix();
+	gGL.popMatrix();
 }
 
 
@@ -509,9 +508,9 @@ void gl_draw_scaled_image_with_border(S32 x, S32 y, S32 width, S32 height, LLTex
 		gGL.getTexUnit(0)->setTextureAlphaBlend(LLTexUnit::TBO_MULT, LLTexUnit::TBS_TEX_ALPHA, LLTexUnit::TBS_VERT_ALPHA);
 	}
 
-	gGL.pushUIMatrix();
+	gGL.pushMatrix();
 	{
-		gGL.translateUI((F32)x, (F32)y, 0.f);
+		gGL.translatef((F32)x, (F32)y, 0.f);
 
 		gGL.getTexUnit(0)->bind(image);
 
@@ -638,7 +637,7 @@ void gl_draw_scaled_image_with_border(S32 x, S32 y, S32 width, S32 height, LLTex
 		}
 		gGL.end();
 	}
-	gGL.popUIMatrix();
+	gGL.popMatrix();
 
 	if (solid_color)
 	{
@@ -661,72 +660,39 @@ void gl_draw_scaled_rotated_image(S32 x, S32 y, S32 width, S32 height, F32 degre
 
 	LLGLSUIDefault gls_ui;
 
-
-	gGL.getTexUnit(0)->bind(image);
-
-	gGL.color4fv(color.mV);
-
-	if (degrees == 0.f)
+	gGL.pushMatrix();
 	{
-		gGL.pushUIMatrix();
-		gGL.translateUI((F32)x, (F32)y, 0.f);
-			
-		gGL.begin(LLRender::QUADS);
+		gGL.translatef((F32)x, (F32)y, 0.f);
+		if( degrees )
 		{
-			gGL.texCoord2f(uv_rect.mRight, uv_rect.mTop);
-			gGL.vertex2i(width, height );
-
-			gGL.texCoord2f(uv_rect.mLeft, uv_rect.mTop);
-			gGL.vertex2i(0, height );
-
-			gGL.texCoord2f(uv_rect.mLeft, uv_rect.mBottom);
-			gGL.vertex2i(0, 0);
-
-			gGL.texCoord2f(uv_rect.mRight, uv_rect.mBottom);
-			gGL.vertex2i(width, 0);
+			F32 offset_x = F32(width/2);
+			F32 offset_y = F32(height/2);
+			gGL.translatef( offset_x, offset_y, 0.f);
+			glRotatef( degrees, 0.f, 0.f, 1.f );
+			gGL.translatef( -offset_x, -offset_y, 0.f );
 		}
-		gGL.end();
-		gGL.popUIMatrix();
-	}
-	else
-	{
-		gGL.pushUIMatrix();
-		gGL.translateUI((F32)x, (F32)y, 0.f);
-	
-		F32 offset_x = F32(width/2);
-		F32 offset_y = F32(height/2);
-
-		gGL.translateUI(offset_x, offset_y, 0.f);
 
-		LLMatrix3 quat(0.f, 0.f, degrees*DEG_TO_RAD);
-		
 		gGL.getTexUnit(0)->bind(image);
 
 		gGL.color4fv(color.mV);
 		
 		gGL.begin(LLRender::QUADS);
 		{
-			LLVector3 v;
-
-			v = LLVector3(offset_x, offset_y, 0.f) * quat;
 			gGL.texCoord2f(uv_rect.mRight, uv_rect.mTop);
-			gGL.vertex2i(v.mV[0], v.mV[1] );
+			gGL.vertex2i(width, height );
 
-			v = LLVector3(-offset_x, offset_y, 0.f) * quat;
 			gGL.texCoord2f(uv_rect.mLeft, uv_rect.mTop);
-			gGL.vertex2i(v.mV[0], v.mV[1] );
+			gGL.vertex2i(0, height );
 
-			v = LLVector3(-offset_x, -offset_y, 0.f) * quat;
 			gGL.texCoord2f(uv_rect.mLeft, uv_rect.mBottom);
-			gGL.vertex2i(v.mV[0], v.mV[1] );
+			gGL.vertex2i(0, 0);
 
-			v = LLVector3(offset_x, -offset_y, 0.f) * quat;
 			gGL.texCoord2f(uv_rect.mRight, uv_rect.mBottom);
-			gGL.vertex2i(v.mV[0], v.mV[1] );
+			gGL.vertex2i(width, 0);
 		}
 		gGL.end();
-		gGL.popUIMatrix();
 	}
+	gGL.popMatrix();
 }
 
 
@@ -781,9 +747,9 @@ void gl_arc_2d(F32 center_x, F32 center_y, F32 radius, S32 steps, BOOL filled, F
 		end_angle += F_TWO_PI;
 	}
 
-	gGL.pushUIMatrix();
+	gGL.pushMatrix();
 	{
-		gGL.translateUI(center_x, center_y, 0.f);
+		gGL.translatef(center_x, center_y, 0.f);
 
 		// Inexact, but reasonably fast.
 		F32 delta = (end_angle - start_angle) / steps;
@@ -814,15 +780,15 @@ void gl_arc_2d(F32 center_x, F32 center_y, F32 radius, S32 steps, BOOL filled, F
 		}
 		gGL.end();
 	}
-	gGL.popUIMatrix();
+	gGL.popMatrix();
 }
 
 void gl_circle_2d(F32 center_x, F32 center_y, F32 radius, S32 steps, BOOL filled)
 {
-	gGL.pushUIMatrix();
+	gGL.pushMatrix();
 	{
 		gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
-		gGL.translateUI(center_x, center_y, 0.f);
+		gGL.translatef(center_x, center_y, 0.f);
 
 		// Inexact, but reasonably fast.
 		F32 delta = F_TWO_PI / steps;
@@ -853,7 +819,7 @@ void gl_circle_2d(F32 center_x, F32 center_y, F32 radius, S32 steps, BOOL filled
 		}
 		gGL.end();
 	}
-	gGL.popUIMatrix();
+	gGL.popMatrix();
 }
 
 // Renders a ring with sides (tube shape)
@@ -880,9 +846,9 @@ void gl_deep_circle( F32 radius, F32 depth, S32 steps )
 
 void gl_ring( F32 radius, F32 width, const LLColor4& center_color, const LLColor4& side_color, S32 steps, BOOL render_center )
 {
-	gGL.pushUIMatrix();
+	gGL.pushMatrix();
 	{
-		gGL.translateUI(0.f, 0.f, -width / 2);
+		gGL.translatef(0.f, 0.f, -width / 2);
 		if( render_center )
 		{
 			gGL.color4fv(center_color.mV);
@@ -891,11 +857,11 @@ void gl_ring( F32 radius, F32 width, const LLColor4& center_color, const LLColor
 		else
 		{
 			gl_washer_2d(radius, radius - width, steps, side_color, side_color);
-			gGL.translateUI(0.f, 0.f, width);
+			gGL.translatef(0.f, 0.f, width);
 			gl_washer_2d(radius - width, radius, steps, side_color, side_color);
 		}
 	}
-	gGL.popUIMatrix();
+	gGL.popMatrix();
 }
 
 // Draw gray and white checkerboard with black border
@@ -1084,9 +1050,9 @@ void gl_segmented_rect_2d_tex(const S32 left,
 	S32 width = llabs(right - left);
 	S32 height = llabs(top - bottom);
 
-	gGL.pushUIMatrix();
+	gGL.pushMatrix();
 
-	gGL.translateUI((F32)left, (F32)bottom, 0.f);
+	gGL.translatef((F32)left, (F32)bottom, 0.f);
 	LLVector2 border_uv_scale((F32)border_size / (F32)texture_width, (F32)border_size / (F32)texture_height);
 
 	if (border_uv_scale.mV[VX] > 0.5f)
@@ -1227,7 +1193,7 @@ void gl_segmented_rect_2d_tex(const S32 left,
 	}
 	gGL.end();
 
-	gGL.popUIMatrix();
+	gGL.popMatrix();
 }
 
 void gl_segmented_rect_2d_fragment_tex(const S32 left, 
@@ -1244,9 +1210,9 @@ void gl_segmented_rect_2d_fragment_tex(const S32 left,
 	S32 width = llabs(right - left);
 	S32 height = llabs(top - bottom);
 
-	gGL.pushUIMatrix();
+	gGL.pushMatrix();
 
-	gGL.translateUI((F32)left, (F32)bottom, 0.f);
+	gGL.translatef((F32)left, (F32)bottom, 0.f);
 	LLVector2 border_uv_scale((F32)border_size / (F32)texture_width, (F32)border_size / (F32)texture_height);
 
 	if (border_uv_scale.mV[VX] > 0.5f)
@@ -1417,7 +1383,7 @@ void gl_segmented_rect_2d_fragment_tex(const S32 left,
 	}
 	gGL.end();
 
-	gGL.popUIMatrix();
+	gGL.popMatrix();
 }
 
 void gl_segmented_rect_3d_tex(const LLVector2& border_scale, const LLVector3& border_width, 
@@ -1625,7 +1591,7 @@ void LLUI::dirtyRect(LLRect rect)
 //static
 void LLUI::translate(F32 x, F32 y, F32 z)
 {
-	gGL.translateUI(x,y,z);
+	gGL.translatef(x,y,z);
 	LLFontGL::sCurOrigin.mX += (S32) x;
 	LLFontGL::sCurOrigin.mY += (S32) y;
 	LLFontGL::sCurOrigin.mZ += z;
@@ -1634,14 +1600,14 @@ void LLUI::translate(F32 x, F32 y, F32 z)
 //static
 void LLUI::pushMatrix()
 {
-	gGL.pushUIMatrix();
+	gGL.pushMatrix();
 	LLFontGL::sOriginStack.push_back(LLFontGL::sCurOrigin);
 }
 
 //static
 void LLUI::popMatrix()
 {
-	gGL.popUIMatrix();
+	gGL.popMatrix();
 	LLFontGL::sCurOrigin = *LLFontGL::sOriginStack.rbegin();
 	LLFontGL::sOriginStack.pop_back();
 }
@@ -1649,7 +1615,7 @@ void LLUI::popMatrix()
 //static 
 void LLUI::loadIdentity()
 {
-	gGL.loadUIIdentity(); 
+	glLoadIdentity();
 	LLFontGL::sCurOrigin.mX = 0;
 	LLFontGL::sCurOrigin.mY = 0;
 	LLFontGL::sCurOrigin.mZ = 0;
diff --git a/indra/llui/llviewborder.cpp b/indra/llui/llviewborder.cpp
index bd9c43c97f..30717f87de 100644
--- a/indra/llui/llviewborder.cpp
+++ b/indra/llui/llviewborder.cpp
@@ -125,6 +125,14 @@ void LLViewBorder::draw()
 			llassert( FALSE );  // not implemented
 		}
 	}
+	else
+	if( STYLE_TEXTURE == mStyle )
+	{
+		if( mTexture )
+		{
+			drawTextures();
+		}
+	}
 
 	LLView::draw();
 }
@@ -247,6 +255,56 @@ void LLViewBorder::drawTwoPixelLines()
 	gl_line_2d(left+1, bottom+1, right-1, bottom+1);
 }
 
+void LLViewBorder::drawTextures()
+{
+	//LLGLSUIDefault gls_ui;
+
+	//llassert( FALSE );  // TODO: finish implementing
+
+	//gGL.color4fv(UI_VERTEX_COLOR.mV);
+
+	//gGL.getTexUnit(0)->bind(mTexture);
+	//gGL.getTexUnit(0)->setTextureAddressMode(LLTexUnit::TAM_WRAP);
+
+	//drawTextureTrapezoid(   0.f, mBorderWidth, getRect().getWidth(),  0,					0 );
+	//drawTextureTrapezoid(  90.f, mBorderWidth, getRect().getHeight(), (F32)getRect().getWidth(),0 );
+	//drawTextureTrapezoid( 180.f, mBorderWidth, getRect().getWidth(),  (F32)getRect().getWidth(),(F32)getRect().getHeight() );
+	//drawTextureTrapezoid( 270.f, mBorderWidth, getRect().getHeight(), 0,					(F32)getRect().getHeight() );
+}
+
+
+void LLViewBorder::drawTextureTrapezoid( F32 degrees, S32 width, S32 length, F32 start_x, F32 start_y )
+{
+	gGL.pushMatrix();
+	{
+		gGL.translatef(start_x, start_y, 0.f);
+		glRotatef( degrees, 0, 0, 1 );
+
+		gGL.begin(LLRender::QUADS);
+		{
+			//      width, width   /---------\ length-width, width		//
+			//	   			      /           \							//
+			//				     /			   \						//
+			//				    /---------------\						//
+			//    			0,0					  length, 0				//
+
+			gGL.texCoord2f( 0, 0 );
+			gGL.vertex2i( 0, 0 );
+
+			gGL.texCoord2f( (GLfloat)length, 0 );
+			gGL.vertex2i( length, 0 );
+
+			gGL.texCoord2f( (GLfloat)(length - width), (GLfloat)width );
+			gGL.vertex2i( length - width, width );
+
+			gGL.texCoord2f( (GLfloat)width, (GLfloat)width );
+			gGL.vertex2i( width, width );
+		}
+		gGL.end();
+	}
+	gGL.popMatrix();
+}
+
 BOOL LLViewBorder::getBevelFromAttribute(LLXMLNodePtr node, LLViewBorder::EBevel& bevel_style)
 {
 	if (node->hasAttribute("bevel_style"))
diff --git a/indra/llui/llviewborder.h b/indra/llui/llviewborder.h
index 342e84fd93..92fd569325 100644
--- a/indra/llui/llviewborder.h
+++ b/indra/llui/llviewborder.h
@@ -99,7 +99,8 @@ private:
 	void		drawOnePixelLines();
 	void		drawTwoPixelLines();
 	void		drawTextures();
-	
+	void		drawTextureTrapezoid( F32 degrees, S32 width, S32 length, F32 start_x, F32 start_y );
+
 	EBevel		mBevel;
 	EStyle		mStyle;
 	LLUIColor	mHighlightLight;
diff --git a/indra/newview/llhudrender.cpp b/indra/newview/llhudrender.cpp
index 325c9c260c..a02dc3355b 100644
--- a/indra/newview/llhudrender.cpp
+++ b/indra/newview/llhudrender.cpp
@@ -121,24 +121,24 @@ void hud_render_text(const LLWString &wstr, const LLVector3 &pos_agent,
 	glMatrixMode(GL_PROJECTION);
 	glPushMatrix();
 	glMatrixMode(GL_MODELVIEW);
-	gGL.pushMatrix();
+	
 	LLUI::pushMatrix();
 		
 	gl_state_for_2d(world_view_rect.getWidth(), world_view_rect.getHeight());
 	gViewerWindow->setup3DViewport();
-	
+	//gViewerWindow->setup2DRender();
+
 	winX -= world_view_rect.mLeft;
 	winY -= world_view_rect.mBottom;
 	LLUI::loadIdentity();
-	glLoadIdentity();
 	LLUI::translate((F32) winX*1.0f/LLFontGL::sScaleX, (F32) winY*1.0f/(LLFontGL::sScaleY), -(((F32) winZ*2.f)-1.f));
+	//glRotatef(angle * RAD_TO_DEG, axis.mV[VX], axis.mV[VY], axis.mV[VZ]);
+	//glScalef(right_scale, up_scale, 1.f);
 	F32 right_x;
 	
 	font.render(wstr, 0, 0, 0, color, LLFontGL::LEFT, LLFontGL::BASELINE, style, shadow, wstr.length(), 1000, &right_x);
-
 	LLUI::popMatrix();
-	gGL.popMatrix();
-
+	
 	glMatrixMode(GL_PROJECTION);
 	glPopMatrix();
 	glMatrixMode(GL_MODELVIEW);
diff --git a/indra/newview/llhudtext.cpp b/indra/newview/llhudtext.cpp
index 8d1d27444b..8ad94b957d 100644
--- a/indra/newview/llhudtext.cpp
+++ b/indra/newview/llhudtext.cpp
@@ -555,7 +555,7 @@ void LLHUDText::renderText(BOOL for_select)
 		}
 	}
 	/// Reset the default color to white.  The renderer expects this to be the default. 
-	gGL.color4f(1.0f, 1.0f, 1.0f, 1.0f);
+	glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
 	if (for_select)
 	{
 		gGL.getTexUnit(0)->enable(LLTexUnit::TT_TEXTURE);
diff --git a/indra/newview/llmediactrl.cpp b/indra/newview/llmediactrl.cpp
index 6fd6958d2e..d464862eed 100644
--- a/indra/newview/llmediactrl.cpp
+++ b/indra/newview/llmediactrl.cpp
@@ -724,14 +724,14 @@ void LLMediaCtrl::draw()
 		LLGLSUIDefault gls_ui;
 		LLGLDisable gls_alphaTest( GL_ALPHA_TEST );
 
-		gGL.pushUIMatrix();
+		gGL.pushMatrix();
 		{
 			if (mIgnoreUIScale)
 			{
-				gGL.loadUIIdentity();
+				glLoadIdentity();
 				// font system stores true screen origin, need to scale this by UI scale factor
 				// to get render origin for this view (with unit scale)
-				gGL.translateUI(floorf(LLFontGL::sCurOrigin.mX * LLUI::sGLScaleFactor.mV[VX]), 
+				gGL.translatef(floorf(LLFontGL::sCurOrigin.mX * LLUI::sGLScaleFactor.mV[VX]), 
 							floorf(LLFontGL::sCurOrigin.mY * LLUI::sGLScaleFactor.mV[VY]), 
 							LLFontGL::sCurOrigin.mZ);
 			}
@@ -825,7 +825,7 @@ void LLMediaCtrl::draw()
 			gGL.end();
 			gGL.setSceneBlendType(LLRender::BT_ALPHA);
 		}
-		gGL.popUIMatrix();
+		gGL.popMatrix();
 	
 	}
 	else
diff --git a/indra/newview/llnetmap.cpp b/indra/newview/llnetmap.cpp
index 05623198ab..234fe13217 100644
--- a/indra/newview/llnetmap.cpp
+++ b/indra/newview/llnetmap.cpp
@@ -153,18 +153,6 @@ void LLNetMap::draw()
 	// Prepare a scissor region
 	F32 rotation = 0;
 
-	gGL.pushMatrix();
-	gGL.pushUIMatrix();
-	
-	LLVector3 offset = gGL.getUITranslation();
-	LLVector3 scale = gGL.getUIScale();
-
-	glLoadIdentity();
-	gGL.loadUIIdentity();
-
-	glScalef(scale.mV[0], scale.mV[1], scale.mV[2]);
-	gGL.translatef(offset.mV[0], offset.mV[1], offset.mV[2]);
-	
 	{
 		LLLocalClipRect clip(getLocalRect());
 		{
@@ -447,9 +435,6 @@ void LLNetMap::draw()
 		}
 	}
 	
-	gGL.popMatrix();
-	gGL.popUIMatrix();
-
 	LLUICtrl::draw();
 }
 
diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp
index f6227c2dd6..de4317b2de 100644
--- a/indra/newview/llviewerwindow.cpp
+++ b/indra/newview/llviewerwindow.cpp
@@ -476,10 +476,6 @@ public:
 			}
             ypos += y_inc;
 
-			addText(xpos, ypos, llformat("UI Verts/Calls: %d/%d", LLRender::sUIVerts, LLRender::sUICalls));
-			LLRender::sUICalls = LLRender::sUIVerts = 0;
-			ypos += y_inc;
-
 			addText(xpos,ypos, llformat("%d/%d Nodes visible", gPipeline.mNumVisibleNodes, LLSpatialGroup::sNodeCount));
 			
 			ypos += y_inc;
@@ -1847,15 +1843,12 @@ void LLViewerWindow::drawDebugText()
 {
 	gGL.color4f(1,1,1,1);
 	gGL.pushMatrix();
-	gGL.pushUIMatrix();
 	{
 		// scale view by UI global scale factor and aspect ratio correction factor
-		gGL.scaleUI(mDisplayScale.mV[VX], mDisplayScale.mV[VY], 1.f);
+		glScalef(mDisplayScale.mV[VX], mDisplayScale.mV[VY], 1.f);
 		mDebugText->draw();
 	}
-	gGL.popUIMatrix();
 	gGL.popMatrix();
-
 	gGL.flush();
 }
 
@@ -1903,11 +1896,9 @@ void LLViewerWindow::draw()
 	// No translation needed, this view is glued to 0,0
 
 	gGL.pushMatrix();
-	LLUI::pushMatrix();
 	{
-		
 		// scale view by UI global scale factor and aspect ratio correction factor
-		gGL.scaleUI(mDisplayScale.mV[VX], mDisplayScale.mV[VY], 1.f);
+		glScalef(mDisplayScale.mV[VX], mDisplayScale.mV[VY], 1.f);
 
 		LLVector2 old_scale_factor = LLUI::sGLScaleFactor;
 		// apply camera zoom transform (for high res screenshots)
@@ -1973,7 +1964,6 @@ void LLViewerWindow::draw()
 
 		LLUI::sGLScaleFactor = old_scale_factor;
 	}
-	LLUI::popMatrix();
 	gGL.popMatrix();
 
 #if LL_DEBUG
-- 
cgit v1.2.3


From 1f672990e796ec55f7b684dbf46f939d1ab15607 Mon Sep 17 00:00:00 2001
From: Palmer Truelson <palmer@lindenlab.com>
Date: Fri, 12 Feb 2010 21:06:02 -0800
Subject: Backed out davep's optimization pass.  changeset 3c3685de430a

---
 indra/newview/llagent.cpp            |   3 -
 indra/newview/llappviewer.cpp        |   8 +-
 indra/newview/lldrawable.cpp         |   3 +
 indra/newview/llflexibleobject.cpp   |  15 +--
 indra/newview/llglsandbox.cpp        |  24 ++---
 indra/newview/llviewerobject.cpp     |   3 -
 indra/newview/llviewerobjectlist.cpp | 171 +++++++++++++++++------------------
 indra/newview/llviewerobjectlist.h   |  31 +++----
 indra/newview/llviewerwindow.cpp     |   4 +-
 indra/newview/llvoclouds.cpp         |   4 +-
 indra/newview/llvotextbubble.cpp     |   3 -
 indra/newview/llvovolume.cpp         |  17 +---
 indra/newview/llworld.cpp            |   3 -
 indra/newview/pipeline.cpp           |  64 ++++++++++---
 indra/newview/pipeline.h             |   5 +-
 15 files changed, 173 insertions(+), 185 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp
index 9f2186f7f7..2354323a66 100644
--- a/indra/newview/llagent.cpp
+++ b/indra/newview/llagent.cpp
@@ -3017,9 +3017,6 @@ void LLAgent::endAnimationUpdateUI()
 //-----------------------------------------------------------------------------
 void LLAgent::updateCamera()
 {
-	static LLFastTimer::DeclareTimer ftm("Camera");
-	LLFastTimer t(ftm);
-
 	//Ventrella - changed camera_skyward to the new global "mCameraUpVector"
 	mCameraUpVector = LLVector3::z_axis;
 	//LLVector3	camera_skyward(0.f, 0.f, 1.f);
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp
index 9eb793783b..2d694eefd3 100644
--- a/indra/newview/llappviewer.cpp
+++ b/indra/newview/llappviewer.cpp
@@ -3599,15 +3599,13 @@ void LLAppViewer::idle()
 
 	{
 		// Handle pending gesture processing
-		static LLFastTimer::DeclareTimer ftm("Agent Position");
-		LLFastTimer t(ftm);
 		LLGestureManager::instance().update();
 
 		gAgent.updateAgentPosition(gFrameDTClamped, yaw, current_mouse.mX, current_mouse.mY);
 	}
 
 	{
-		LLFastTimer t(FTM_OBJECTLIST_UPDATE); 
+		LLFastTimer t(FTM_OBJECTLIST_UPDATE); // Actually "object update"
 		
         if (!(logoutRequestSent() && hasSavedFinalSnapshot()))
 		{
@@ -3641,8 +3639,6 @@ void LLAppViewer::idle()
 	//
 
 	{
-		static LLFastTimer::DeclareTimer ftm("HUD Effects");
-		LLFastTimer t(ftm);
 		LLSelectMgr::getInstance()->updateEffects();
 		LLHUDManager::getInstance()->cleanupEffects();
 		LLHUDManager::getInstance()->sendEffects();
@@ -3899,7 +3895,7 @@ void LLAppViewer::sendLogoutRequest()
 static F32 CheckMessagesMaxTime = CHECK_MESSAGES_DEFAULT_MAX_TIME;
 #endif
 
-static LLFastTimer::DeclareTimer FTM_IDLE_NETWORK("Idle Network");
+static LLFastTimer::DeclareTimer FTM_IDLE_NETWORK("Network");
 
 void LLAppViewer::idleNetwork()
 {
diff --git a/indra/newview/lldrawable.cpp b/indra/newview/lldrawable.cpp
index 244fed791f..d60330024a 100644
--- a/indra/newview/lldrawable.cpp
+++ b/indra/newview/lldrawable.cpp
@@ -386,6 +386,8 @@ void LLDrawable::makeActive()
 			mParent->makeActive();
 		}
 
+		gPipeline.setActive(this, TRUE);
+
 		//all child objects must also be active
 		llassert_always(mVObjp);
 		
@@ -432,6 +434,7 @@ void LLDrawable::makeStatic(BOOL warning_enabled)
 	if (isState(ACTIVE))
 	{
 		clearState(ACTIVE);
+		gPipeline.setActive(this, FALSE);
 
 		if (mParent.notNull() && mParent->isActive() && warning_enabled)
 		{
diff --git a/indra/newview/llflexibleobject.cpp b/indra/newview/llflexibleobject.cpp
index 561965d021..aea2de8e92 100644
--- a/indra/newview/llflexibleobject.cpp
+++ b/indra/newview/llflexibleobject.cpp
@@ -51,9 +51,6 @@
 
 /*static*/ F32 LLVolumeImplFlexible::sUpdateFactor = 1.0f;
 
-static LLFastTimer::DeclareTimer FTM_FLEXIBLE_REBUILD("Rebuild");
-static LLFastTimer::DeclareTimer FTM_DO_FLEXIBLE_UPDATE("Update");
-
 // LLFlexibleObjectData::pack/unpack now in llprimitive.cpp
 
 //-----------------------------------------------
@@ -197,6 +194,7 @@ void LLVolumeImplFlexible::remapSections(LLFlexibleObjectSection *source, S32 so
 	}
 }
 
+
 //-----------------------------------------------------------------------------
 void LLVolumeImplFlexible::setAttributesOfAllSections(LLVector3* inScale)
 {
@@ -365,7 +363,6 @@ inline S32 log2(S32 x)
 
 void LLVolumeImplFlexible::doFlexibleUpdate()
 {
-	LLFastTimer ftm(FTM_DO_FLEXIBLE_UPDATE);
 	LLVolume* volume = mVO->getVolume();
 	LLPath *path = &volume->getPath();
 	if (mSimulateRes == 0)
@@ -696,10 +693,7 @@ BOOL LLVolumeImplFlexible::doUpdateGeometry(LLDrawable *drawable)
 	}
 
 	volume->updateRelativeXform();
-	{
-		LLFastTimer t(FTM_DO_FLEXIBLE_UPDATE);
-		doFlexibleUpdate();
-	}
+	doFlexibleUpdate();
 	
 	// Object may have been rotated, which means it needs a rebuild.  See SL-47220
 	BOOL	rotated = FALSE;
@@ -716,10 +710,7 @@ BOOL LLVolumeImplFlexible::doUpdateGeometry(LLDrawable *drawable)
 		volume->regenFaces();
 		volume->mDrawable->setState(LLDrawable::REBUILD_VOLUME);
 		volume->dirtySpatialGroup();
-		{
-			LLFastTimer t(FTM_FLEXIBLE_REBUILD);
-			doFlexibleRebuild();
-		}
+		doFlexibleRebuild();
 		volume->genBBoxes(isVolumeGlobal());
 	}
 	else if (!mUpdated || rotated)
diff --git a/indra/newview/llglsandbox.cpp b/indra/newview/llglsandbox.cpp
index 8569e208eb..750a9d478f 100644
--- a/indra/newview/llglsandbox.cpp
+++ b/indra/newview/llglsandbox.cpp
@@ -897,21 +897,19 @@ void LLViewerObjectList::renderObjectBeacons()
 		S32 last_line_width = -1;
 		// gGL.begin(LLRender::LINES); // Always happens in (line_width != last_line_width)
 		
-		BOOL flush = FALSE;
-		for (std::vector<LLDebugBeacon>::iterator iter = mDebugBeacons.begin(); iter != mDebugBeacons.end(); ++iter)
+		for (S32 i = 0; i < mDebugBeacons.count(); i++)
 		{
-			const LLDebugBeacon &debug_beacon = *iter;
+			const LLDebugBeacon &debug_beacon = mDebugBeacons[i];
 			LLColor4 color = debug_beacon.mColor;
 			color.mV[3] *= 0.25f;
 			S32 line_width = debug_beacon.mLineWidth;
 			if (line_width != last_line_width)
 			{
-				if (flush)
+				if (i > 0)
 				{
 					gGL.end();
+					gGL.flush();
 				}
-				flush = TRUE;
-				gGL.flush();
 				glLineWidth( (F32)line_width );
 				last_line_width = line_width;
 				gGL.begin(LLRender::LINES);
@@ -938,20 +936,18 @@ void LLViewerObjectList::renderObjectBeacons()
 		S32 last_line_width = -1;
 		// gGL.begin(LLRender::LINES); // Always happens in (line_width != last_line_width)
 		
-		BOOL flush = FALSE;
-		for (std::vector<LLDebugBeacon>::iterator iter = mDebugBeacons.begin(); iter != mDebugBeacons.end(); ++iter)
+		for (S32 i = 0; i < mDebugBeacons.count(); i++)
 		{
-			const LLDebugBeacon &debug_beacon = *iter;
+			const LLDebugBeacon &debug_beacon = mDebugBeacons[i];
 
 			S32 line_width = debug_beacon.mLineWidth;
 			if (line_width != last_line_width)
 			{
-				if (flush)
+				if (i > 0)
 				{
 					gGL.end();
+					gGL.flush();
 				}
-				flush = TRUE;
-				gGL.flush();
 				glLineWidth( (F32)line_width );
 				last_line_width = line_width;
 				gGL.begin(LLRender::LINES);
@@ -973,9 +969,9 @@ void LLViewerObjectList::renderObjectBeacons()
 		gGL.flush();
 		glLineWidth(1.f);
 
-		for (std::vector<LLDebugBeacon>::iterator iter = mDebugBeacons.begin(); iter != mDebugBeacons.end(); ++iter)
+		for (S32 i = 0; i < mDebugBeacons.count(); i++)
 		{
-			LLDebugBeacon &debug_beacon = *iter;
+			LLDebugBeacon &debug_beacon = mDebugBeacons[i];
 			if (debug_beacon.mString == "")
 			{
 				continue;
diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp
index 4fdfc37d6c..886f1d9ef5 100644
--- a/indra/newview/llviewerobject.cpp
+++ b/indra/newview/llviewerobject.cpp
@@ -2001,9 +2001,6 @@ BOOL LLViewerObject::isActive() const
 
 BOOL LLViewerObject::idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time)
 {
-	static LLFastTimer::DeclareTimer ftm("Viewer Object");
-	LLFastTimer t(ftm);
-
 	if (mDead)
 	{
 		// It's dead.  Don't update it.
diff --git a/indra/newview/llviewerobjectlist.cpp b/indra/newview/llviewerobjectlist.cpp
index 6347090f71..96828ee1b6 100644
--- a/indra/newview/llviewerobjectlist.cpp
+++ b/indra/newview/llviewerobjectlist.cpp
@@ -93,7 +93,7 @@ extern LLPipeline	gPipeline;
 
 // Statics for object lookup tables.
 U32						LLViewerObjectList::sSimulatorMachineIndex = 1; // Not zero deliberately, to speed up index check.
-std::map<U64, U32>			LLViewerObjectList::sIPAndPortToIndex;
+LLMap<U64, U32>			LLViewerObjectList::sIPAndPortToIndex;
 std::map<U64, LLUUID>	LLViewerObjectList::sIndexAndLocalIDToUUID;
 
 LLViewerObjectList::LLViewerObjectList()
@@ -571,9 +571,10 @@ void LLViewerObjectList::processCachedObjectUpdate(LLMessageSystem *mesgsys,
 
 void LLViewerObjectList::dirtyAllObjectInventory()
 {
-	for (vobj_list_t::iterator iter = mObjects.begin(); iter != mObjects.end(); ++iter)
+	S32 count = mObjects.count();
+	for(S32 i = 0; i < count; ++i)
 	{
-		(*iter)->dirtyInventory();
+		mObjects[i]->dirtyInventory();
 	}
 }
 
@@ -586,14 +587,14 @@ void LLViewerObjectList::updateApparentAngles(LLAgent &agent)
 	S32 num_updates, max_value;
 	if (NUM_BINS - 1 == mCurBin)
 	{
-		num_updates = (S32) mObjects.size() - mCurLazyUpdateIndex;
-		max_value = (S32) mObjects.size();
+		num_updates = mObjects.count() - mCurLazyUpdateIndex;
+		max_value = mObjects.count();
 		gTextureList.setUpdateStats(TRUE);
 	}
 	else
 	{
-		num_updates = ((S32) mObjects.size() / NUM_BINS) + 1;
-		max_value = llmin((S32) mObjects.size(), mCurLazyUpdateIndex + num_updates);
+		num_updates = (mObjects.count() / NUM_BINS) + 1;
+		max_value = llmin(mObjects.count(), mCurLazyUpdateIndex + num_updates);
 	}
 
 
@@ -646,7 +647,7 @@ void LLViewerObjectList::updateApparentAngles(LLAgent &agent)
 	}
 
 	mCurLazyUpdateIndex = max_value;
-	if (mCurLazyUpdateIndex == mObjects.size())
+	if (mCurLazyUpdateIndex == mObjects.count())
 	{
 		mCurLazyUpdateIndex = 0;
 	}
@@ -693,26 +694,20 @@ void LLViewerObjectList::update(LLAgent &agent, LLWorld &world)
 	
 	// Make a copy of the list in case something in idleUpdate() messes with it
 	std::vector<LLViewerObject*> idle_list;
-	
-	static LLFastTimer::DeclareTimer idle_copy("Idle Copy");
+	idle_list.reserve( mActiveObjects.size() );
 
+ 	for (std::set<LLPointer<LLViewerObject> >::iterator active_iter = mActiveObjects.begin();
+		active_iter != mActiveObjects.end(); active_iter++)
 	{
-		LLFastTimer t(idle_copy);
-		idle_list.reserve( mActiveObjects.size() );
-
- 		for (std::set<LLPointer<LLViewerObject> >::iterator active_iter = mActiveObjects.begin();
-			active_iter != mActiveObjects.end(); active_iter++)
+		objectp = *active_iter;
+		if (objectp)
 		{
-			objectp = *active_iter;
-			if (objectp)
-			{
-				idle_list.push_back( objectp );
-			}
-			else
-			{	// There shouldn't be any NULL pointers in the list, but they have caused
-				// crashes before.  This may be idleUpdate() messing with the list.
-				llwarns << "LLViewerObjectList::update has a NULL objectp" << llendl;
-			}
+			idle_list.push_back( objectp );
+		}
+		else
+		{	// There shouldn't be any NULL pointers in the list, but they have caused
+			// crashes before.  This may be idleUpdate() messing with the list.
+			llwarns << "LLViewerObjectList::update has a NULL objectp" << llendl;
 		}
 	}
 
@@ -812,7 +807,7 @@ void LLViewerObjectList::update(LLAgent &agent, LLWorld &world)
 	}
 	*/
 
-	LLViewerStats::getInstance()->mNumObjectsStat.addValue((S32) mObjects.size());
+	LLViewerStats::getInstance()->mNumObjectsStat.addValue(mObjects.count());
 	LLViewerStats::getInstance()->mNumActiveObjectsStat.addValue(num_active_objects);
 	LLViewerStats::getInstance()->mNumSizeCulledStat.addValue(mNumSizeCulled);
 	LLViewerStats::getInstance()->mNumVisCulledStat.addValue(mNumVisCulled);
@@ -820,9 +815,9 @@ void LLViewerObjectList::update(LLAgent &agent, LLWorld &world)
 
 void LLViewerObjectList::clearDebugText()
 {
-	for (vobj_list_t::iterator iter = mObjects.begin(); iter != mObjects.end(); ++iter)
+	for (S32 i = 0; i < mObjects.count(); i++)
 	{
-		(*iter)->setDebugText("");
+		mObjects[i]->setDebugText("");
 	}
 }
 
@@ -861,7 +856,7 @@ void LLViewerObjectList::cleanupReferences(LLViewerObject *objectp)
 
 	if (objectp->isOnMap())
 	{
-		removeFromMap(objectp);
+		mMapObjects.removeObj(objectp);
 	}
 
 	// Don't clean up mObject references, these will be cleaned up more efficiently later!
@@ -918,10 +913,10 @@ void LLViewerObjectList::killObjects(LLViewerRegion *regionp)
 {
 	LLViewerObject *objectp;
 
-	
-	for (vobj_list_t::iterator iter = mObjects.begin(); iter != mObjects.end(); ++iter)
+	S32 i;
+	for (i = 0; i < mObjects.count(); i++)
 	{
-		objectp = *iter;
+		objectp = mObjects[i];
 		
 		if (objectp->mRegionp == regionp)
 		{
@@ -938,9 +933,10 @@ void LLViewerObjectList::killAllObjects()
 	// Used only on global destruction.
 	LLViewerObject *objectp;
 
-	for (vobj_list_t::iterator iter = mObjects.begin(); iter != mObjects.end(); ++iter)
+	for (S32 i = 0; i < mObjects.count(); i++)
 	{
-		objectp = *iter;
+		objectp = mObjects[i];
+		
 		killObject(objectp);
 		llassert(objectp->isDead());
 	}
@@ -949,7 +945,7 @@ void LLViewerObjectList::killAllObjects()
 
 	if(!mObjects.empty())
 	{
-		llwarns << "LLViewerObjectList::killAllObjects still has entries in mObjects: " << mObjects.size() << llendl;
+		llwarns << "LLViewerObjectList::killAllObjects still has entries in mObjects: " << mObjects.count() << llendl;
 		mObjects.clear();
 	}
 
@@ -974,15 +970,16 @@ void LLViewerObjectList::cleanDeadObjects(BOOL use_timer)
 		return;
 	}
 
+	S32 i = 0;
 	S32 num_removed = 0;
 	LLViewerObject *objectp;
-	for (vobj_list_t::iterator iter = mObjects.begin(); iter != mObjects.end(); )
+	while (i < mObjects.count())
 	{
 		// Scan for all of the dead objects and remove any "global" references to them.
-		objectp = *iter;
+		objectp = mObjects[i];
 		if (objectp->isDead())
 		{
-			iter = mObjects.erase(iter);
+			mObjects.remove(i);
 			num_removed++;
 
 			if (num_removed == mNumDeadObjects)
@@ -993,7 +990,8 @@ void LLViewerObjectList::cleanDeadObjects(BOOL use_timer)
 		}
 		else
 		{
-			++iter;
+			// iterate, this isn't a dead object.
+			i++;
 		}
 	}
 
@@ -1043,11 +1041,12 @@ void LLViewerObjectList::shiftObjects(const LLVector3 &offset)
 	}
 
 	LLViewerObject *objectp;
-	for (vobj_list_t::iterator iter = mObjects.begin(); iter != mObjects.end(); ++iter)
+	S32 i;
+	for (i = 0; i < mObjects.count(); i++)
 	{
-		objectp = *iter;
+		objectp = getObject(i);
 		// There could be dead objects on the object list, so don't update stuff if the object is dead.
-		if (!objectp->isDead())
+		if (objectp)
 		{
 			objectp->updatePositionCaches();
 
@@ -1077,9 +1076,9 @@ void LLViewerObjectList::renderObjectsForMap(LLNetMap &netmap)
 
 	F32 max_radius = gSavedSettings.getF32("MiniMapPrimMaxRadius");
 
-	for (vobj_list_t::iterator iter = mMapObjects.begin(); iter != mMapObjects.end(); ++iter)
+	for (S32 i = 0; i < mMapObjects.count(); i++)
 	{
-		LLViewerObject* objectp = *iter;
+		LLViewerObject* objectp = mMapObjects[i];
 		if (!objectp->getRegion() || objectp->isOrphaned() || objectp->isAttachment())
 		{
 			continue;
@@ -1145,14 +1144,21 @@ void LLViewerObjectList::renderObjectBounds(const LLVector3 &center)
 {
 }
 
+void LLViewerObjectList::renderObjectsForSelect(LLCamera &camera, const LLRect& screen_rect, BOOL pick_parcel_wall, BOOL render_transparent)
+{
+	generatePickList(camera);
+	renderPickList(screen_rect, pick_parcel_wall, render_transparent);
+}
+
 void LLViewerObjectList::generatePickList(LLCamera &camera)
 {
 		LLViewerObject *objectp;
 		S32 i;
 		// Reset all of the GL names to zero.
-		for (vobj_list_t::iterator iter = mObjects.begin(); iter != mObjects.end(); ++iter)
+		for (i = 0; i < mObjects.count(); i++)
 		{
-			(*iter)->mGLName = 0;
+			objectp = mObjects[i];
+			objectp->mGLName = 0;
 		}
 
 		mSelectPickList.clear();
@@ -1315,19 +1321,17 @@ void LLViewerObjectList::addDebugBeacon(const LLVector3 &pos_agent,
 										const LLColor4 &text_color,
 										S32 line_width)
 {
-	LLDebugBeacon beacon;
-	beacon.mPositionAgent = pos_agent;
-	beacon.mString = string;
-	beacon.mColor = color;
-	beacon.mTextColor = text_color;
-	beacon.mLineWidth = line_width;
-
-	mDebugBeacons.push_back(beacon);
+	LLDebugBeacon *beaconp = mDebugBeacons.reserve_block(1);
+	beaconp->mPositionAgent = pos_agent;
+	beaconp->mString = string;
+	beaconp->mColor = color;
+	beaconp->mTextColor = text_color;
+	beaconp->mLineWidth = line_width;
 }
 
 void LLViewerObjectList::resetObjectBeacons()
 {
-	mDebugBeacons.clear();
+	mDebugBeacons.reset();
 }
 
 LLViewerObject *LLViewerObjectList::createObjectViewer(const LLPCode pcode, LLViewerRegion *regionp)
@@ -1345,7 +1349,7 @@ LLViewerObject *LLViewerObjectList::createObjectViewer(const LLPCode pcode, LLVi
 
 	mUUIDObjectMap[fullid] = objectp;
 
-	mObjects.push_back(objectp);
+	mObjects.put(objectp);
 
 	updateActive(objectp);
 
@@ -1384,7 +1388,7 @@ LLViewerObject *LLViewerObjectList::createObject(const LLPCode pcode, LLViewerRe
 					gMessageSystem->getSenderIP(),
 					gMessageSystem->getSenderPort());
 
-	mObjects.push_back(objectp);
+	mObjects.put(objectp);
 
 	updateActive(objectp);
 
@@ -1407,11 +1411,11 @@ LLViewerObject *LLViewerObjectList::replaceObject(const LLUUID &id, const LLPCod
 S32 LLViewerObjectList::findReferences(LLDrawable *drawablep) const
 {
 	LLViewerObject *objectp;
+	S32 i;
 	S32 num_refs = 0;
-	
-	for (vobj_list_t::const_iterator iter = mObjects.begin(); iter != mObjects.end(); ++iter)
+	for (i = 0; i < mObjects.count(); i++)
 	{
-		objectp = *iter;
+		objectp = mObjects[i];
 		if (objectp->mDrawable.notNull())
 		{
 			num_refs += objectp->mDrawable->findReferences(drawablep);
@@ -1456,15 +1460,15 @@ void LLViewerObjectList::orphanize(LLViewerObject *childp, U32 parent_id, U32 ip
 	// Unknown parent, add to orpaned child list
 	U64 parent_info = getIndex(parent_id, ip, port);
 
-	if (std::find(mOrphanParents.begin(), mOrphanParents.end(), parent_info) == mOrphanParents.end())
+	if (-1 == mOrphanParents.find(parent_info))
 	{
-		mOrphanParents.push_back(parent_info);
+		mOrphanParents.put(parent_info);
 	}
 
 	LLViewerObjectList::OrphanInfo oi(parent_info, childp->mID);
-	if (std::find(mOrphanChildren.begin(), mOrphanChildren.end(), oi) == mOrphanChildren.end())
+	if (-1 == mOrphanChildren.find(oi))
 	{
-		mOrphanChildren.push_back(oi);
+		mOrphanChildren.put(oi);
 		mNumOrphans++;
 	}
 }
@@ -1487,29 +1491,28 @@ void LLViewerObjectList::findOrphans(LLViewerObject* objectp, U32 ip, U32 port)
 	// See if we are a parent of an orphan.
 	// Note:  This code is fairly inefficient but it should happen very rarely.
 	// It can be sped up if this is somehow a performance issue...
-	if (mOrphanParents.empty())
+	if (0 == mOrphanParents.count())
 	{
 		// no known orphan parents
 		return;
 	}
-	if (std::find(mOrphanParents.begin(), mOrphanParents.end(), getIndex(objectp->mLocalID, ip, port)) == mOrphanParents.end())
+	if (-1 == mOrphanParents.find(getIndex(objectp->mLocalID, ip, port)))
 	{
 		// did not find objectp in OrphanParent list
 		return;
 	}
 
+	S32 i;
 	U64 parent_info = getIndex(objectp->mLocalID, ip, port);
 	BOOL orphans_found = FALSE;
 	// Iterate through the orphan list, and set parents of matching children.
-
-	for (std::vector<OrphanInfo>::iterator iter = mOrphanChildren.begin(); iter != mOrphanChildren.end(); )
-	{	
-		if (iter->mParentInfo != parent_info)
+	for (i = 0; i < mOrphanChildren.count(); i++)
+	{
+		if (mOrphanChildren[i].mParentInfo != parent_info)
 		{
-			++iter;
 			continue;
 		}
-		LLViewerObject *childp = findObject(iter->mChildInfo);
+		LLViewerObject *childp = findObject(mOrphanChildren[i].mChildInfo);
 		if (childp)
 		{
 			if (childp == objectp)
@@ -1543,35 +1546,29 @@ void LLViewerObjectList::findOrphans(LLViewerObject* objectp, U32 ip, U32 port)
 
 			objectp->addChild(childp);
 			orphans_found = TRUE;
-			++iter;
 		}
 		else
 		{
 			llinfos << "Missing orphan child, removing from list" << llendl;
-
-			iter = mOrphanChildren.erase(iter);
+			mOrphanChildren.remove(i);
+			i--;
 		}
 	}
 
 	// Remove orphan parent and children from lists now that they've been found
+	mOrphanParents.remove(mOrphanParents.find(parent_info));
+
+	i = 0;
+	while (i < mOrphanChildren.count())
 	{
-		std::vector<U64>::iterator iter = std::find(mOrphanParents.begin(), mOrphanParents.end(), parent_info);
-		if (iter != mOrphanParents.end())
-		{
-			mOrphanParents.erase(iter);
-		}
-	}
-	
-	for (std::vector<OrphanInfo>::iterator iter = mOrphanChildren.begin(); iter != mOrphanChildren.end(); )
-	{
-		if (iter->mParentInfo == parent_info)
+		if (mOrphanChildren[i].mParentInfo == parent_info)
 		{
-			iter = mOrphanChildren.erase(iter);
+			mOrphanChildren.remove(i);
 			mNumOrphans--;
 		}
 		else
 		{
-			++iter;
+			i++;
 		}
 	}
 
diff --git a/indra/newview/llviewerobjectlist.h b/indra/newview/llviewerobjectlist.h
index 8d3d2c4b44..ace5c5038e 100644
--- a/indra/newview/llviewerobjectlist.h
+++ b/indra/newview/llviewerobjectlist.h
@@ -38,6 +38,8 @@
 
 // common includes
 #include "llstat.h"
+#include "lldarrayptr.h"
+#include "llmap.h"			// *TODO: switch to std::map
 #include "llstring.h"
 
 // project includes
@@ -48,7 +50,7 @@ class LLNetMap;
 class LLDebugBeacon;
 
 const U32 CLOSE_BIN_SIZE = 10;
-const U32 NUM_BINS = 128;
+const U32 NUM_BINS = 16;
 
 // GL name = position in object list + GL_NAME_INDEX_OFFSET so that
 // we can have special numbers like zero.
@@ -109,12 +111,13 @@ public:
 	void updateAvatarVisibility();
 
 	// Selection related stuff
+	void renderObjectsForSelect(LLCamera &camera, const LLRect& screen_rect, BOOL pick_parcel_wall = FALSE, BOOL render_transparent = TRUE);
 	void generatePickList(LLCamera &camera);
 	void renderPickList(const LLRect& screen_rect, BOOL pick_parcel_wall, BOOL render_transparent);
 
 	LLViewerObject *getSelectedObject(const U32 object_id);
 
-	inline S32 getNumObjects() { return (S32) mObjects.size(); }
+	inline S32 getNumObjects() { return mObjects.count(); }
 
 	void addToMap(LLViewerObject *objectp);
 	void removeFromMap(LLViewerObject *objectp);
@@ -128,7 +131,7 @@ public:
 
 	S32 findReferences(LLDrawable *drawablep) const; // Find references to drawable in all objects, and return value.
 
-	S32 getOrphanParentCount() const { return (S32) mOrphanParents.size(); }
+	S32 getOrphanParentCount() const { return mOrphanParents.count(); }
 	S32 getOrphanCount() const { return mNumOrphans; }
 	void orphanize(LLViewerObject *childp, U32 parent_id, U32 ip, U32 port);
 	void findOrphans(LLViewerObject* objectp, U32 ip, U32 port);
@@ -176,28 +179,26 @@ public:
 	S32 mNumUnknownKills;
 	S32 mNumDeadObjects;
 protected:
-	std::vector<U64>	mOrphanParents;	// LocalID/ip,port of orphaned objects
-	std::vector<OrphanInfo> mOrphanChildren;	// UUID's of orphaned objects
+	LLDynamicArray<U64>	mOrphanParents;	// LocalID/ip,port of orphaned objects
+	LLDynamicArray<OrphanInfo> mOrphanChildren;	// UUID's of orphaned objects
 	S32 mNumOrphans;
 
-	typedef std::vector<LLPointer<LLViewerObject> > vobj_list_t;
-
-	vobj_list_t mObjects;
+	LLDynamicArrayPtr<LLPointer<LLViewerObject>, 256> mObjects;
 	std::set<LLPointer<LLViewerObject> > mActiveObjects;
 
-	vobj_list_t mMapObjects;
+	LLDynamicArrayPtr<LLPointer<LLViewerObject> > mMapObjects;
 
 	typedef std::map<LLUUID, LLPointer<LLViewerObject> > vo_map;
 	vo_map mDeadObjects;	// Need to keep multiple entries per UUID
 
 	std::map<LLUUID, LLPointer<LLViewerObject> > mUUIDObjectMap;
 
-	std::vector<LLDebugBeacon> mDebugBeacons;
+	LLDynamicArray<LLDebugBeacon> mDebugBeacons;
 
 	S32 mCurLazyUpdateIndex;
 
 	static U32 sSimulatorMachineIndex;
-	static std::map<U64, U32> sIPAndPortToIndex;
+	static LLMap<U64, U32> sIPAndPortToIndex;
 
 	static std::map<U64, LLUUID> sIndexAndLocalIDToUUID;
 
@@ -259,16 +260,12 @@ inline LLViewerObject *LLViewerObjectList::getObject(const S32 index)
 
 inline void LLViewerObjectList::addToMap(LLViewerObject *objectp)
 {
-	mMapObjects.push_back(objectp);
+	mMapObjects.put(objectp);
 }
 
 inline void LLViewerObjectList::removeFromMap(LLViewerObject *objectp)
 {
-	std::vector<LLPointer<LLViewerObject> >::iterator iter = std::find(mMapObjects.begin(), mMapObjects.end(), objectp);
-	if (iter != mMapObjects.end())
-	{
-		mMapObjects.erase(iter);
-	}
+	mMapObjects.removeObj(objectp);
 }
 
 
diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp
index de4317b2de..cd6b9e2c50 100644
--- a/indra/newview/llviewerwindow.cpp
+++ b/indra/newview/llviewerwindow.cpp
@@ -2316,9 +2316,6 @@ void append_xui_tooltip(LLView* viewp, LLToolTip::Params& params)
 // event processing.
 void LLViewerWindow::updateUI()
 {
-	static LLFastTimer::DeclareTimer ftm("Update UI");
-	LLFastTimer t(ftm);
-
 	static std::string last_handle_msg;
 
 	// animate layout stacks so we have up to date rect for world view
@@ -2898,6 +2895,7 @@ void LLViewerWindow::saveLastMouse(const LLCoordGL &point)
 // Must be called after displayObjects is called, which sets the mGLName parameter
 // NOTE: This function gets called 3 times:
 //  render_ui_3d: 			FALSE, FALSE, TRUE
+//  renderObjectsForSelect:	TRUE, pick_parcel_wall, FALSE
 //  render_hud_elements:	FALSE, FALSE, FALSE
 void LLViewerWindow::renderSelections( BOOL for_gl_pick, BOOL pick_parcel_walls, BOOL for_hud )
 {
diff --git a/indra/newview/llvoclouds.cpp b/indra/newview/llvoclouds.cpp
index 5153cef709..177cb16c50 100644
--- a/indra/newview/llvoclouds.cpp
+++ b/indra/newview/llvoclouds.cpp
@@ -77,11 +77,9 @@ BOOL LLVOClouds::isActive() const
 	return TRUE;
 }
 
+
 BOOL LLVOClouds::idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time)
 {
-	static LLFastTimer::DeclareTimer ftm("Idle Clouds");
-	LLFastTimer t(ftm);
-
 	if (!(gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_CLOUDS)))
 	{
 		return TRUE;
diff --git a/indra/newview/llvotextbubble.cpp b/indra/newview/llvotextbubble.cpp
index 428ef20006..75beab519e 100644
--- a/indra/newview/llvotextbubble.cpp
+++ b/indra/newview/llvotextbubble.cpp
@@ -84,9 +84,6 @@ BOOL LLVOTextBubble::isActive() const
 
 BOOL LLVOTextBubble::idleUpdate(LLAgent &agent, LLWorld	&world, const F64 &time)
 {
-	static LLFastTimer::DeclareTimer ftm("Text Bubble");
-	LLFastTimer t(ftm);
-
 	F32 dt = mUpdateTimer.getElapsedTimeF32();
 	// Die after a few seconds.
 	if (dt > 1.5f)
diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp
index 3cdf485d7d..bfe38c14ba 100644
--- a/indra/newview/llvovolume.cpp
+++ b/indra/newview/llvovolume.cpp
@@ -597,9 +597,6 @@ BOOL LLVOVolume::idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time)
 {
 	LLViewerObject::idleUpdate(agent, world, time);
 
-	static LLFastTimer::DeclareTimer ftm("Volume");
-	LLFastTimer t(ftm);
-
 	if (mDead || mDrawable.isNull())
 	{
 		return TRUE;
@@ -621,18 +618,6 @@ BOOL LLVOVolume::idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time)
 		mVolumeImpl->doIdleUpdate(agent, world, time);
 	}
 
-	const S32 MAX_ACTIVE_OBJECT_QUIET_FRAMES = 40;
-
-	if (mDrawable->isActive())
-	{
-		if (mDrawable->isRoot() && 
-			mDrawable->mQuietCount++ > MAX_ACTIVE_OBJECT_QUIET_FRAMES && 
-			(!mDrawable->getParent() || !mDrawable->getParent()->isActive()))
-		{
-			mDrawable->makeStatic();
-		}
-	}
-
 	return TRUE;
 }
 
@@ -1050,7 +1035,7 @@ BOOL LLVOVolume::calcLOD()
 	S32 cur_detail = 0;
 	
 	F32 radius = getVolume()->mLODScaleBias.scaledVec(getScale()).length();
-	F32 distance = mDrawable->mDistanceWRTCamera; //llmin(mDrawable->mDistanceWRTCamera, MAX_LOD_DISTANCE);
+	F32 distance = llmin(mDrawable->mDistanceWRTCamera, MAX_LOD_DISTANCE);
 	distance *= sDistanceFactor;
 			
 	F32 rampDist = LLVOVolume::sLODFactor * 2;
diff --git a/indra/newview/llworld.cpp b/indra/newview/llworld.cpp
index d7e5b464a6..118d7f8d08 100644
--- a/indra/newview/llworld.cpp
+++ b/indra/newview/llworld.cpp
@@ -657,9 +657,6 @@ void LLWorld::updateParticles()
 
 void LLWorld::updateClouds(const F32 dt)
 {
-	static LLFastTimer::DeclareTimer ftm("World Clouds");
-	LLFastTimer t(ftm);
-
 	if (gSavedSettings.getBOOL("FreezeTime") ||
 		!gSavedSettings.getBOOL("SkyUseClassicClouds"))
 	{
diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp
index d5f87b73fe..4f4fc83819 100644
--- a/indra/newview/pipeline.cpp
+++ b/indra/newview/pipeline.cpp
@@ -116,6 +116,7 @@ const F32 BACKLIGHT_DAY_MAGNITUDE_AVATAR = 0.2f;
 const F32 BACKLIGHT_NIGHT_MAGNITUDE_AVATAR = 0.1f;
 const F32 BACKLIGHT_DAY_MAGNITUDE_OBJECT = 0.1f;
 const F32 BACKLIGHT_NIGHT_MAGNITUDE_OBJECT = 0.08f;
+const S32 MAX_ACTIVE_OBJECT_QUIET_FRAMES = 40;
 const S32 MAX_OFFSCREEN_GEOMETRY_CHANGES_PER_FRAME = 10;
 const U32 REFLECTION_MAP_RES = 128;
 
@@ -1410,26 +1411,38 @@ void LLPipeline::updateMove()
 
 	assertInitialized();
 
+	for (LLDrawable::drawable_set_t::iterator iter = mRetexturedList.begin();
+		 iter != mRetexturedList.end(); ++iter)
 	{
-		static LLFastTimer::DeclareTimer ftm("Retexture");
-		LLFastTimer t(ftm);
-
-		for (LLDrawable::drawable_set_t::iterator iter = mRetexturedList.begin();
-			 iter != mRetexturedList.end(); ++iter)
+		LLDrawable* drawablep = *iter;
+		if (drawablep && !drawablep->isDead())
 		{
-			LLDrawable* drawablep = *iter;
-			if (drawablep && !drawablep->isDead())
-			{
-				drawablep->updateTexture();
-			}
+			drawablep->updateTexture();
 		}
-		mRetexturedList.clear();
 	}
+	mRetexturedList.clear();
 
+	updateMovedList(mMovedList);
+
+	for (LLDrawable::drawable_set_t::iterator iter = mActiveQ.begin();
+		 iter != mActiveQ.end(); )
 	{
-		static LLFastTimer::DeclareTimer ftm("Moved List");
-		LLFastTimer t(ftm);
-		updateMovedList(mMovedList);
+		LLDrawable::drawable_set_t::iterator curiter = iter++;
+		LLDrawable* drawablep = *curiter;
+		if (drawablep && !drawablep->isDead()) 
+		{
+			if (drawablep->isRoot() && 
+				drawablep->mQuietCount++ > MAX_ACTIVE_OBJECT_QUIET_FRAMES && 
+				(!drawablep->getParent() || !drawablep->getParent()->isActive()))
+			{
+				drawablep->makeStatic(); // removes drawable and its children from mActiveQ
+				iter = mActiveQ.upper_bound(drawablep); // next valid entry
+			}
+		}
+		else
+		{
+			mActiveQ.erase(curiter);
+		}
 	}
 
 	//balance octrees
@@ -3045,6 +3058,12 @@ void LLPipeline::renderGeom(LLCamera& camera, BOOL forceVBOUpdate)
 		}
 	}
 
+	if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_PICKING))
+	{
+		LLAppViewer::instance()->pingMainloopTimeout("Pipeline:RenderForSelect");
+		gObjectList.renderObjectsForSelect(camera, gViewerWindow->getWindowRectScaled());
+	}
+	else
 	{
 		LLFastTimer t(FTM_POOLS);
 		
@@ -4778,6 +4797,10 @@ void LLPipeline::findReferences(LLDrawable *drawablep)
 		llinfos << "In mRetexturedList" << llendl;
 	}
 	
+	if (mActiveQ.find(drawablep) != mActiveQ.end())
+	{
+		llinfos << "In mActiveQ" << llendl;
+	}
 	if (std::find(mBuildQ1.begin(), mBuildQ1.end(), drawablep) != mBuildQ1.end())
 	{
 		llinfos << "In mBuildQ1" << llendl;
@@ -4934,6 +4957,19 @@ void LLPipeline::setLight(LLDrawable *drawablep, BOOL is_light)
 	}
 }
 
+void LLPipeline::setActive(LLDrawable *drawablep, BOOL active)
+{
+	assertInitialized();
+	if (active)
+	{
+		mActiveQ.insert(drawablep);
+	}
+	else
+	{
+		mActiveQ.erase(drawablep);
+	}
+}
+
 //static
 void LLPipeline::toggleRenderType(U32 type)
 {
diff --git a/indra/newview/pipeline.h b/indra/newview/pipeline.h
index c5285943e8..67004a5f2d 100644
--- a/indra/newview/pipeline.h
+++ b/indra/newview/pipeline.h
@@ -270,7 +270,8 @@ public:
 	void shiftObjects(const LLVector3 &offset);
 
 	void setLight(LLDrawable *drawablep, BOOL is_light);
-	
+	void setActive(LLDrawable *drawablep, BOOL active);
+
 	BOOL hasRenderBatches(const U32 type) const;
 	LLCullResult::drawinfo_list_t::iterator beginRenderMap(U32 type);
 	LLCullResult::drawinfo_list_t::iterator endRenderMap(U32 type);
@@ -588,6 +589,8 @@ protected:
 
 	LLViewerObject::vobj_list_t		mCreateQ;
 		
+	LLDrawable::drawable_set_t		mActiveQ;
+	
 	LLDrawable::drawable_set_t		mRetexturedList;
 
 	class HighlightItem
-- 
cgit v1.2.3


From af0bfb388a4ecd2a2c67ae18743c9c63ca3fd29e Mon Sep 17 00:00:00 2001
From: Tofu Linden <tofu.linden@lindenlab.com>
Date: Sat, 13 Feb 2010 13:33:26 +0000
Subject: CID-132

Checker: NULL_RETURNS
Function: LLPanelLandmarkInfo::getFullFolderName(const LLViewerInventoryCategory *)
File: /indra/newview/llpanellandmarkinfo.cpp
---
 indra/newview/llpanellandmarkinfo.cpp | 32 +++++++++++++++++++++-----------
 1 file changed, 21 insertions(+), 11 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/llpanellandmarkinfo.cpp b/indra/newview/llpanellandmarkinfo.cpp
index cd6c727b5c..56d52ccc65 100644
--- a/indra/newview/llpanellandmarkinfo.cpp
+++ b/indra/newview/llpanellandmarkinfo.cpp
@@ -376,21 +376,31 @@ void LLPanelLandmarkInfo::createLandmark(const LLUUID& folder_id)
 // static
 std::string LLPanelLandmarkInfo::getFullFolderName(const LLViewerInventoryCategory* cat)
 {
-	std::string name = cat->getName();
+	std::string name;
 	LLUUID parent_id;
 
-	// translate category name, if it's right below the root
-	// FIXME: it can throw notification about non existent string in strings.xml
-	if (cat->getParentUUID().notNull() && cat->getParentUUID() == gInventory.getRootFolderID())
+	llassert(cat);
+	if (cat)
 	{
-		LLTrans::findString(name, "InvFolder " + name);
-	}
+		name = cat->getName();
 
-	// we don't want "My Inventory" to appear in the name
-	while ((parent_id = cat->getParentUUID()).notNull() && parent_id != gInventory.getRootFolderID())
-	{
-		cat = gInventory.getCategory(parent_id);
-		name = cat->getName() + "/" + name;
+		// translate category name, if it's right below the root
+		// FIXME: it can throw notification about non existent string in strings.xml
+		if (cat->getParentUUID().notNull() && cat->getParentUUID() == gInventory.getRootFolderID())
+		{
+			LLTrans::findString(name, "InvFolder " + name);
+		}
+
+		// we don't want "My Inventory" to appear in the name
+		while ((parent_id = cat->getParentUUID()).notNull() && parent_id != gInventory.getRootFolderID())
+		{
+			cat = gInventory.getCategory(parent_id);
+			llassert(cat);
+			if (cat)
+			{
+				name = cat->getName() + "/" + name;
+			}
+		}
 	}
 
 	return name;
-- 
cgit v1.2.3


From 86056788ec8a5af023c6b8d7d0809597bc1012f0 Mon Sep 17 00:00:00 2001
From: Tofu Linden <tofu.linden@lindenlab.com>
Date: Sat, 13 Feb 2010 13:35:53 +0000
Subject: CID-134

Checker: NULL_RETURNS
Function: LLToolsEnableUnlink::handleEvent(const LLSD &)
File: /indra/newview/llviewermenu.cpp
---
 indra/newview/llviewermenu.cpp | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp
index b15a9a9e99..8c61ba7558 100644
--- a/indra/newview/llviewermenu.cpp
+++ b/indra/newview/llviewermenu.cpp
@@ -4842,9 +4842,10 @@ class LLToolsEnableUnlink : public view_listener_t
 {
 	bool handleEvent(const LLSD& userdata)
 	{
+		LLViewerObject* first_editable_object = LLSelectMgr::getInstance()->getSelection()->getFirstEditableObject();
 		bool new_value = LLSelectMgr::getInstance()->selectGetAllRootsValid() &&
-			LLSelectMgr::getInstance()->getSelection()->getFirstEditableObject() &&
-			!LLSelectMgr::getInstance()->getSelection()->getFirstEditableObject()->isAttachment();
+			first_editable_object &&
+			!first_editable_object->isAttachment();
 		return new_value;
 	}
 };
-- 
cgit v1.2.3


From eb140739dbc26a0331b16b12081f1dae3847c9bb Mon Sep 17 00:00:00 2001
From: Tofu Linden <tofu.linden@lindenlab.com>
Date: Sat, 13 Feb 2010 13:37:08 +0000
Subject: CID-138

Checker: NULL_RETURNS
Function: LLPanelFace::sendGlow()
File: /indra/newview/llpanelface.cpp
---
 indra/newview/llpanelface.cpp | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp
index 8c5208678e..4f450ce0a8 100644
--- a/indra/newview/llpanelface.cpp
+++ b/indra/newview/llpanelface.cpp
@@ -265,10 +265,13 @@ void LLPanelFace::sendAlpha()
 
 void LLPanelFace::sendGlow()
 {
-	LLSpinCtrl*	mCtrlGlow = getChild<LLSpinCtrl>("glow");
-	F32 glow = mCtrlGlow->get();
-
-	LLSelectMgr::getInstance()->selectionSetGlow( glow );
+	LLSpinCtrl* mCtrlGlow = getChild<LLSpinCtrl>("glow");
+	llassert(mCtrlGlow);
+	if (mCtrlGlow)
+	{
+		F32 glow = mCtrlGlow->get();
+		LLSelectMgr::getInstance()->selectionSetGlow( glow );
+	}
 }
 
 struct LLPanelFaceSetTEFunctor : public LLSelectedTEFunctor
-- 
cgit v1.2.3


From 10c9f17301e2dbacb0105b29d7214e67d5de8e85 Mon Sep 17 00:00:00 2001
From: Tofu Linden <tofu.linden@lindenlab.com>
Date: Sat, 13 Feb 2010 13:40:45 +0000
Subject: CID-139

Checker: NULL_RETURNS
Function: LLPanelFaceSetTEFunctor::apply(LLViewerObject *, int)
File: /indra/newview/llpanelface.cpp
---
 indra/newview/llpanelface.cpp | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp
index 4f450ce0a8..b50c6442e1 100644
--- a/indra/newview/llpanelface.cpp
+++ b/indra/newview/llpanelface.cpp
@@ -289,6 +289,9 @@ struct LLPanelFaceSetTEFunctor : public LLSelectedTEFunctor
 		LLCheckBoxCtrl*	checkFlipScaleS = mPanel->getChild<LLCheckBoxCtrl>("checkbox flip s");
 		LLCheckBoxCtrl*	checkFlipScaleT = mPanel->getChild<LLCheckBoxCtrl>("checkbox flip t");
 		LLComboBox*		comboTexGen = mPanel->getChild<LLComboBox>("combobox texgen");
+		llassert(comboTexGen);
+		llassert(object);
+
 		if (ctrlTexScaleS)
 		{
 			valid = !ctrlTexScaleS->getTentative() || !checkFlipScaleS->getTentative();
@@ -299,7 +302,8 @@ struct LLPanelFaceSetTEFunctor : public LLSelectedTEFunctor
 				{
 					value = -value;
 				}
-				if (comboTexGen->getCurrentIndex() == 1)
+				if (comboTexGen &&
+				    comboTexGen->getCurrentIndex() == 1)
 				{
 					value *= 0.5f;
 				}
@@ -317,7 +321,8 @@ struct LLPanelFaceSetTEFunctor : public LLSelectedTEFunctor
 				{
 					value = -value;
 				}
-				if (comboTexGen->getCurrentIndex() == 1)
+				if (comboTexGen &&
+				    comboTexGen->getCurrentIndex() == 1)
 				{
 					value *= 0.5f;
 				}
-- 
cgit v1.2.3


From 0cf46fe136d23781e71e092eaed89163647c98a3 Mon Sep 17 00:00:00 2001
From: Tofu Linden <tofu.linden@lindenlab.com>
Date: Sat, 13 Feb 2010 13:43:33 +0000
Subject: CID-144

Checker: NULL_RETURNS
Function: LLInvFVBridgeAction::doAction(const LLUUID &, LLInventoryModel *)
File: /indra/newview/llinventorybridge.cpp
---
 indra/newview/llinventorybridge.cpp | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp
index 019a4b22c3..ec2be0e8e9 100644
--- a/indra/newview/llinventorybridge.cpp
+++ b/indra/newview/llinventorybridge.cpp
@@ -5096,12 +5096,18 @@ void LLInvFVBridgeAction::doAction(LLAssetType::EType asset_type,
 //static
 void LLInvFVBridgeAction::doAction(const LLUUID& uuid, LLInventoryModel* model)
 {
-	LLAssetType::EType asset_type = model->getItem(uuid)->getType();
-	LLInvFVBridgeAction* action = createAction(asset_type,uuid,model);
-	if(action)
+	llassert(model);
+	LLViewerInventoryItem* item = model->getItem(uuid);
+	llassert(item);
+	if (item)
 	{
-		action->doIt();
-		delete action;
+		LLAssetType::EType asset_type = item->getType();
+		LLInvFVBridgeAction* action = createAction(asset_type,uuid,model);
+		if(action)
+		{
+			action->doIt();
+			delete action;
+		}
 	}
 }
 
-- 
cgit v1.2.3


From 51e2ee7b3a9d8a4a10373edd1ee99e7ee25e8a38 Mon Sep 17 00:00:00 2001
From: Tofu Linden <tofu.linden@lindenlab.com>
Date: Sat, 13 Feb 2010 13:45:28 +0000
Subject: CID-145

Checker: NULL_RETURNS
File: /indra/llui/llscrolllistctrl.cpp
---
 indra/newview/llfloatertopobjects.cpp | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/llfloatertopobjects.cpp b/indra/newview/llfloatertopobjects.cpp
index c930e99bad..8ab050beaa 100644
--- a/indra/newview/llfloatertopobjects.cpp
+++ b/indra/newview/llfloatertopobjects.cpp
@@ -283,8 +283,13 @@ void LLFloaterTopObjects::updateSelectionInfo()
 	std::string object_id_string = object_id.asString();
 
 	childSetValue("id_editor", LLSD(object_id_string));
-	childSetValue("object_name_editor", list->getFirstSelected()->getColumn(1)->getValue().asString());
-	childSetValue("owner_name_editor", list->getFirstSelected()->getColumn(2)->getValue().asString());
+	LLScrollListItem* sli = list->getFirstSelected();
+	llassert(sli);
+	if (sli)
+	{
+		childSetValue("object_name_editor", sli->getColumn(1)->getValue().asString());
+		childSetValue("owner_name_editor", sli->getColumn(2)->getValue().asString());
+	}
 }
 
 // static
-- 
cgit v1.2.3


From 710687ce6751dab6afec76b2bc2a4d03568e44ec Mon Sep 17 00:00:00 2001
From: Tofu Linden <tofu.linden@lindenlab.com>
Date: Sat, 13 Feb 2010 13:49:08 +0000
Subject: CID-208

Checker: REVERSE_INULL
Function: LLVolumeGeometryManager::rebuildMesh(LLSpatialGroup *)
File: /indra/newview/llvovolume.cpp
---
 indra/newview/llvovolume.cpp | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp
index 12728a2377..9fbcd1d32a 100644
--- a/indra/newview/llvovolume.cpp
+++ b/indra/newview/llvovolume.cpp
@@ -3494,7 +3494,8 @@ static LLFastTimer::DeclareTimer FTM_VOLUME_GEOM("Volume Geometry");
 void LLVolumeGeometryManager::rebuildMesh(LLSpatialGroup* group)
 {
 	llpushcallstacks ;
-	if (group->isState(LLSpatialGroup::MESH_DIRTY) && !group->isState(LLSpatialGroup::GEOM_DIRTY))
+	llassert(group);
+	if (group && group->isState(LLSpatialGroup::MESH_DIRTY) && !group->isState(LLSpatialGroup::GEOM_DIRTY))
 	{
 		LLFastTimer tm(FTM_VOLUME_GEOM);
 		S32 num_mapped_veretx_buffer = LLVertexBuffer::sMappedCount ;
@@ -3548,9 +3549,9 @@ void LLVolumeGeometryManager::rebuildMesh(LLSpatialGroup* group)
 		}
 		
 		// don't forget alpha
-		if(	group != NULL && 
-			!group->mVertexBuffer.isNull() && 
-			group->mVertexBuffer->isLocked())
+		if(group != NULL && 
+		   !group->mVertexBuffer.isNull() && 
+		   group->mVertexBuffer->isLocked())
 		{
 			group->mVertexBuffer->setBuffer(0);
 		}
@@ -3576,7 +3577,7 @@ void LLVolumeGeometryManager::rebuildMesh(LLSpatialGroup* group)
 		group->clearState(LLSpatialGroup::MESH_DIRTY | LLSpatialGroup::NEW_DRAWINFO);
 	}
 
-	if (group->isState(LLSpatialGroup::NEW_DRAWINFO))
+	if (group && group->isState(LLSpatialGroup::NEW_DRAWINFO))
 	{
 		llerrs << "WTF?" << llendl;
 	}
-- 
cgit v1.2.3


From 3ac37e9b896e19b6c7ba24aa038d49551c5add38 Mon Sep 17 00:00:00 2001
From: Tofu Linden <tofu.linden@lindenlab.com>
Date: Sat, 13 Feb 2010 14:00:30 +0000
Subject: CID-211

Checker: REVERSE_INULL
Function: LLChicletPanel::findChiclet<LLIMChiclet>(const LLUUID &)
File: /indra/newview/llchiclet.h
---
 indra/newview/llchiclet.h | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

(limited to 'indra')

diff --git a/indra/newview/llchiclet.h b/indra/newview/llchiclet.h
index b006ae3420..ba17c5970e 100644
--- a/indra/newview/llchiclet.h
+++ b/indra/newview/llchiclet.h
@@ -1228,12 +1228,15 @@ T* LLChicletPanel::findChiclet(const LLUUID& im_session_id)
 	{
 		LLChiclet* chiclet = *it;
 
+		llassert(chiclet);
+		if (!chiclet) continue;
 		if(chiclet->getSessionId() == im_session_id)
 		{
 			T* result = dynamic_cast<T*>(chiclet);
-			if(!result && chiclet)
+			if(!result)
 			{
 				llwarns << "Found chiclet but of wrong type " << llendl;
+				continue;
 			}
 			return result;
 		}
-- 
cgit v1.2.3


From 74ffa0fa480e57371acd992fce7f291f04456729 Mon Sep 17 00:00:00 2001
From: Tofu Linden <tofu.linden@lindenlab.com>
Date: Sat, 13 Feb 2010 14:04:26 +0000
Subject: CID-207

Checker: REVERSE_INULL
Function: LLInventoryModel::addItem(LLViewerInventoryItem *)
File: /indra/newview/llinventorymodel.cpp
---
 indra/newview/llinventorymodel.cpp | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp
index 7ec976604a..a6e8f07e21 100644
--- a/indra/newview/llinventorymodel.cpp
+++ b/indra/newview/llinventorymodel.cpp
@@ -1937,23 +1937,25 @@ void LLInventoryModel::addItem(LLViewerInventoryItem* item)
 {
 	//llinfos << "LLInventoryModel::addItem()" << llendl;
 
-	// This can happen if assettype enums from llassettype.h ever change.
-	// For example, there is a known backwards compatibility issue in some viewer prototypes prior to when 
-	// the AT_LINK enum changed from 23 to 24.
-	if ((item->getType() == LLAssetType::AT_NONE)
-		|| LLAssetType::lookup(item->getType()) == LLAssetType::badLookup())
-	{
-		llwarns << "Got bad asset type for item [ name: " << item->getName() << " type: " << item->getType() << " inv-type: " << item->getInventoryType() << " ], ignoring." << llendl;
-		return;
-	}
 	if(item)
 	{
+		// This can happen if assettype enums from llassettype.h ever change.
+		// For example, there is a known backwards compatibility issue in some viewer prototypes prior to when 
+		// the AT_LINK enum changed from 23 to 24.
+		if ((item->getType() == LLAssetType::AT_NONE)
+		    || LLAssetType::lookup(item->getType()) == LLAssetType::badLookup())
+		{
+			llwarns << "Got bad asset type for item [ name: " << item->getName() << " type: " << item->getType() << " inv-type: " << item->getInventoryType() << " ], ignoring." << llendl;
+			return;
+		}
+
 		// This condition means that we tried to add a link without the baseobj being in memory.
 		// The item will show up as a broken link.
 		if (item->getIsBrokenLink())
 		{
 			llinfos << "Adding broken link [ name: " << item->getName() << " itemID: " << item->getUUID() << " assetID: " << item->getAssetUUID() << " )  parent: " << item->getParentUUID() << llendl;
 		}
+
 		mItemMap[item->getUUID()] = item;
 	}
 }
-- 
cgit v1.2.3


From a0c57cbb824f5ec976f43a096c320929c7d89120 Mon Sep 17 00:00:00 2001
From: Tofu Linden <tofu.linden@lindenlab.com>
Date: Sat, 13 Feb 2010 14:05:09 +0000
Subject: CID-207 assert.

---
 indra/newview/llinventorymodel.cpp | 1 +
 1 file changed, 1 insertion(+)

(limited to 'indra')

diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp
index a6e8f07e21..326f2a5577 100644
--- a/indra/newview/llinventorymodel.cpp
+++ b/indra/newview/llinventorymodel.cpp
@@ -1937,6 +1937,7 @@ void LLInventoryModel::addItem(LLViewerInventoryItem* item)
 {
 	//llinfos << "LLInventoryModel::addItem()" << llendl;
 
+	llassert(item);
 	if(item)
 	{
 		// This can happen if assettype enums from llassettype.h ever change.
-- 
cgit v1.2.3


From cf69f03af17070152b5ca2772e7addfd0dcc4800 Mon Sep 17 00:00:00 2001
From: Tofu Linden <tofu.linden@lindenlab.com>
Date: Sat, 13 Feb 2010 14:06:31 +0000
Subject: CID-206

Checker: REVERSE_INULL
Function: LLMultiSliderCtrl::onEditorCommit(LLUICtrl *, const LLSD &)
File: /indra/llui/llmultisliderctrl.cpp
---
 indra/llui/llmultisliderctrl.cpp | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

(limited to 'indra')

diff --git a/indra/llui/llmultisliderctrl.cpp b/indra/llui/llmultisliderctrl.cpp
index 50942e55ca..cc26c00a3e 100644
--- a/indra/llui/llmultisliderctrl.cpp
+++ b/indra/llui/llmultisliderctrl.cpp
@@ -330,13 +330,14 @@ void LLMultiSliderCtrl::updateText()
 // static
 void LLMultiSliderCtrl::onEditorCommit( LLUICtrl* ctrl, const LLSD& userdata)
 {
+	llassert(ctrl);
+	if (!ctrl)
+		return;
+
 	LLMultiSliderCtrl* self = dynamic_cast<LLMultiSliderCtrl*>(ctrl->getParent());
 	llassert(self);
 	if (!self) // cast failed - wrong type! :O
 		return;
-
-	if (!ctrl)
-		return;
 	
 	BOOL success = FALSE;
 	F32 val = self->mCurValue;
-- 
cgit v1.2.3


From d7060eb323f7cfebb7576e2999f782e8617e40e8 Mon Sep 17 00:00:00 2001
From: Tofu Linden <tofu.linden@lindenlab.com>
Date: Sat, 13 Feb 2010 14:08:58 +0000
Subject: CID-205

Checker: REVERSE_INULL
Function: LLPanel::fromXML(LLPointer<LLXMLNode>, LLView *, LLPointer<LLXMLNode>)
File: /indra/llui/llpanel.cpp
---
 indra/llui/llpanel.cpp | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

(limited to 'indra')

diff --git a/indra/llui/llpanel.cpp b/indra/llui/llpanel.cpp
index 7b406e090a..d963cf4c98 100644
--- a/indra/llui/llpanel.cpp
+++ b/indra/llui/llpanel.cpp
@@ -397,6 +397,12 @@ LLView* LLPanel::fromXML(LLXMLNodePtr node, LLView* parent, LLXMLNodePtr output_
 		if (!panelp)
 		{
 			panelp = LLUICtrlFactory::getInstance()->createFactoryPanel(name);
+			llassert(panelp);
+			
+			if (!panelp)
+			{
+				return NULL; // :(
+			}
 		}
 
 	}
@@ -414,7 +420,7 @@ LLView* LLPanel::fromXML(LLXMLNodePtr node, LLView* parent, LLXMLNodePtr output_
 	panelp->mCommitCallbackRegistrar.popScope();
 	panelp->mEnableCallbackRegistrar.popScope();
 
-	if (panelp && !panelp->getFactoryMap().empty())
+	if (!panelp->getFactoryMap().empty())
 	{
 		LLUICtrlFactory::instance().popFactoryFunctions();
 	}
-- 
cgit v1.2.3


From 1936b5769eaf7ee66c2ac55080dc45cf25f9a50a Mon Sep 17 00:00:00 2001
From: Tofu Linden <tofu.linden@lindenlab.com>
Date: Sat, 13 Feb 2010 14:11:20 +0000
Subject: CID-204

Checker: REVERSE_INULL
Function: LLXUIXSDWriter::writeXSD(const std::basic_string<char, std::char_traits<char>, std::allocator<char>>&, const std::basic_string<char, std::char_traits<char>, std::allocator<char>>&, const LLInitParam::BaseBlock &)
File: /indra/llxuixml/llxuiparser.cpp
---
 indra/llxuixml/llxuiparser.cpp | 37 +++++++++++++++++++------------------
 1 file changed, 19 insertions(+), 18 deletions(-)

(limited to 'indra')

diff --git a/indra/llxuixml/llxuiparser.cpp b/indra/llxuixml/llxuiparser.cpp
index 17399865e5..705e7137c2 100644
--- a/indra/llxuixml/llxuiparser.cpp
+++ b/indra/llxuixml/llxuiparser.cpp
@@ -324,33 +324,34 @@ void LLXUIXSDWriter::writeXSD(const std::string& type_name, const std::string& p
 	// add includes for all possible children
 	const std::type_info* type = *LLWidgetTypeRegistry::instance().getValue(type_name);
 	const widget_registry_t* widget_registryp = LLChildRegistryRegistry::instance().getValue(type);
-	
-	// add include declarations for all valid children
-	for (widget_registry_t::Registrar::registry_map_t::const_iterator it = widget_registryp->currentRegistrar().beginItems();
-		it != widget_registryp->currentRegistrar().endItems();
-		++it)
-	{
-		std::string widget_name = it->first;
-		if (widget_name == type_name)
-		{
-			continue;
-		}
-		LLXMLNodePtr nodep = new LLXMLNode("xs:include", false);
-		nodep->createChild("schemaLocation", true)->setStringValue(widget_name + ".xsd");
-
-		// add to front of schema
-		mSchemaNode->addChild(nodep, mSchemaNode);
-	}
+	llassert(widget_registryp);
 
 	// add choices for valid children
 	if (widget_registryp)
 	{
+		// add include declarations for all valid children
+		for (widget_registry_t::Registrar::registry_map_t::const_iterator it = widget_registryp->currentRegistrar().beginItems();
+		     it != widget_registryp->currentRegistrar().endItems();
+		     ++it)
+		{
+			std::string widget_name = it->first;
+			if (widget_name == type_name)
+			{
+				continue;
+			}
+			LLXMLNodePtr nodep = new LLXMLNode("xs:include", false);
+			nodep->createChild("schemaLocation", true)->setStringValue(widget_name + ".xsd");
+			
+			// add to front of schema
+			mSchemaNode->addChild(nodep, mSchemaNode);
+		}
+
 		for (widget_registry_t::Registrar::registry_map_t::const_iterator it = widget_registryp->currentRegistrar().beginItems();
 			it != widget_registryp->currentRegistrar().endItems();
 			++it)
 		{
 			std::string widget_name = it->first;
-            //<xs:element name="widget_name" type="widget_name">
+			//<xs:element name="widget_name" type="widget_name">
 			LLXMLNodePtr widget_node = mElementNode->createChild("xs:element", false);
 			widget_node->createChild("name", true)->setStringValue(widget_name);
 			widget_node->createChild("type", true)->setStringValue(widget_name);
-- 
cgit v1.2.3


From eb1d043dafa86480757cc1ed934d96ba51033581 Mon Sep 17 00:00:00 2001
From: Tofu Linden <tofu.linden@lindenlab.com>
Date: Sat, 13 Feb 2010 14:13:06 +0000
Subject: CID-203

Checker: REVERSE_INULL
Function: LLTabContainer::addTabPanel(const LLTabContainer::TabPanelParams &)
File: /indra/llui/lltabcontainer.cpp
---
 indra/llui/lltabcontainer.cpp | 4 ++++
 1 file changed, 4 insertions(+)

(limited to 'indra')

diff --git a/indra/llui/lltabcontainer.cpp b/indra/llui/lltabcontainer.cpp
index 13340e7ded..e810b6fe8f 100644
--- a/indra/llui/lltabcontainer.cpp
+++ b/indra/llui/lltabcontainer.cpp
@@ -891,6 +891,10 @@ void LLTabContainer::update_images(LLTabTuple* tuple, TabParams params, LLTabCon
 void LLTabContainer::addTabPanel(const TabPanelParams& panel)
 {
 	LLPanel* child = panel.panel();
+
+	llassert(child);
+	if (!child) return;
+
 	const std::string& label = panel.label.isProvided() 
 			? panel.label() 
 			: panel.panel()->getLabel();
-- 
cgit v1.2.3


From fa69f09e685bbb4b3b6faac825fd5c9af7100be5 Mon Sep 17 00:00:00 2001
From: Tofu Linden <tofu.linden@lindenlab.com>
Date: Sat, 13 Feb 2010 14:15:31 +0000
Subject: CID-202

Checker: REVERSE_INULL
Function: LLScriptEventHandler::recurse(_iobuf *, int, int, e_lscript_compile_pass, e_lscript_prune_type, int &, LLScriptScope *, e_lscript_types &, e_lscript_types, unsigned long long &, LLScriptByteCodeChunk *, LLScriptByteCodeChunk *, int, LLScriptScopeEntry *, int, LLScriptLibData **)
---
 indra/lscript/lscript_compile/lscript_tree.cpp | 25 +++++++++++++------------
 1 file changed, 13 insertions(+), 12 deletions(-)

(limited to 'indra')

diff --git a/indra/lscript/lscript_compile/lscript_tree.cpp b/indra/lscript/lscript_compile/lscript_tree.cpp
index 4ba41db2fc..2a9a858947 100644
--- a/indra/lscript/lscript_compile/lscript_tree.cpp
+++ b/indra/lscript/lscript_compile/lscript_tree.cpp
@@ -9805,21 +9805,22 @@ void LLScriptEventHandler::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCom
 		break;
 	case LSCP_EMIT_BYTE_CODE:
 		{
-			// order for event handler
-			// set jump table value
-			S32 jumpoffset;
-			jumpoffset = LSCRIPTDataSize[LST_INTEGER]*get_event_handler_jump_position(gCurrentHandler, mEventp->mType)*2;
-
-			integer2bytestream(chunk->mCodeChunk, jumpoffset, chunk->mCurrentOffset);
-
-			// 0 - 3: offset to actual data
-			S32 offsetoffset = chunk->mCurrentOffset;
-			S32 offsetdelta = 0;
-			chunk->addBytes(4);
-
 			// null terminated event name and null terminated parameters
+			llassert(mEventp);
 			if (mEventp)
 			{
+				// order for event handler
+				// set jump table value
+				S32 jumpoffset;
+				jumpoffset = LSCRIPTDataSize[LST_INTEGER]*get_event_handler_jump_position(gCurrentHandler, mEventp->mType)*2;
+				
+				integer2bytestream(chunk->mCodeChunk, jumpoffset, chunk->mCurrentOffset);
+				
+				// 0 - 3: offset to actual data
+				S32 offsetoffset = chunk->mCurrentOffset;
+				S32 offsetdelta = 0;
+				chunk->addBytes(4);
+
 				LLScriptByteCodeChunk	*event = new LLScriptByteCodeChunk(FALSE);
 				mEventp->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, event, heap, stacksize, entry, entrycount, NULL);
 				chunk->addBytes(event->mCodeChunk, event->mCurrentOffset);
-- 
cgit v1.2.3


From 45ea2bbd1e74be1d5158d3e38986f00cc53f0236 Mon Sep 17 00:00:00 2001
From: Tofu Linden <tofu.linden@lindenlab.com>
Date: Sat, 13 Feb 2010 14:18:04 +0000
Subject: simpler fix for CID-202

---
 indra/lscript/lscript_compile/lscript_tree.cpp | 40 +++++++++++++-------------
 1 file changed, 20 insertions(+), 20 deletions(-)

(limited to 'indra')

diff --git a/indra/lscript/lscript_compile/lscript_tree.cpp b/indra/lscript/lscript_compile/lscript_tree.cpp
index 2a9a858947..3d19de193a 100644
--- a/indra/lscript/lscript_compile/lscript_tree.cpp
+++ b/indra/lscript/lscript_compile/lscript_tree.cpp
@@ -9805,27 +9805,27 @@ void LLScriptEventHandler::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCom
 		break;
 	case LSCP_EMIT_BYTE_CODE:
 		{
-			// null terminated event name and null terminated parameters
 			llassert(mEventp);
-			if (mEventp)
-			{
-				// order for event handler
-				// set jump table value
-				S32 jumpoffset;
-				jumpoffset = LSCRIPTDataSize[LST_INTEGER]*get_event_handler_jump_position(gCurrentHandler, mEventp->mType)*2;
-				
-				integer2bytestream(chunk->mCodeChunk, jumpoffset, chunk->mCurrentOffset);
-				
-				// 0 - 3: offset to actual data
-				S32 offsetoffset = chunk->mCurrentOffset;
-				S32 offsetdelta = 0;
-				chunk->addBytes(4);
-
-				LLScriptByteCodeChunk	*event = new LLScriptByteCodeChunk(FALSE);
-				mEventp->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, event, heap, stacksize, entry, entrycount, NULL);
-				chunk->addBytes(event->mCodeChunk, event->mCurrentOffset);
-				delete event;
-			}
+			if (!mEventp) return;
+
+			// order for event handler
+			// set jump table value
+			S32 jumpoffset;
+			jumpoffset = LSCRIPTDataSize[LST_INTEGER]*get_event_handler_jump_position(gCurrentHandler, mEventp->mType)*2;
+
+			integer2bytestream(chunk->mCodeChunk, jumpoffset, chunk->mCurrentOffset);
+
+			// 0 - 3: offset to actual data
+			S32 offsetoffset = chunk->mCurrentOffset;
+			S32 offsetdelta = 0;
+			chunk->addBytes(4);
+
+			// null terminated event name and null terminated parameters
+			LLScriptByteCodeChunk	*event = new LLScriptByteCodeChunk(FALSE);
+			mEventp->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, event, heap, stacksize, entry, entrycount, NULL);
+			chunk->addBytes(event->mCodeChunk, event->mCurrentOffset);
+			delete event;
+		
 			chunk->addBytes(1);
 
 			// now we're at the first opcode
-- 
cgit v1.2.3


From 66298ab6b6ffdf9a3694a0b9fd678ac382519b0a Mon Sep 17 00:00:00 2001
From: Tofu Linden <tofu.linden@lindenlab.com>
Date: Sat, 13 Feb 2010 14:20:15 +0000
Subject: Bah, can't use llassert in llxuiparser.

---
 indra/llxuixml/llxuiparser.cpp | 1 -
 1 file changed, 1 deletion(-)

(limited to 'indra')

diff --git a/indra/llxuixml/llxuiparser.cpp b/indra/llxuixml/llxuiparser.cpp
index 705e7137c2..dbc20a5a1e 100644
--- a/indra/llxuixml/llxuiparser.cpp
+++ b/indra/llxuixml/llxuiparser.cpp
@@ -324,7 +324,6 @@ void LLXUIXSDWriter::writeXSD(const std::string& type_name, const std::string& p
 	// add includes for all possible children
 	const std::type_info* type = *LLWidgetTypeRegistry::instance().getValue(type_name);
 	const widget_registry_t* widget_registryp = LLChildRegistryRegistry::instance().getValue(type);
-	llassert(widget_registryp);
 
 	// add choices for valid children
 	if (widget_registryp)
-- 
cgit v1.2.3


From 9fee359d1baf6e0046655cb8e4afabb8774754b1 Mon Sep 17 00:00:00 2001
From: Tofu Linden <tofu.linden@lindenlab.com>
Date: Sat, 13 Feb 2010 14:37:48 +0000
Subject: CID-3

Checker: CHECKED_RETURN
Function: LLImageDecodeThread::update(unsigned int)
File: /indra/llimage/llimageworker.cpp
---
 indra/llcommon/llsdserialize_xml.cpp | 15 +--------------
 indra/llimage/llimageworker.cpp      | 11 ++++++++---
 2 files changed, 9 insertions(+), 17 deletions(-)

(limited to 'indra')

diff --git a/indra/llcommon/llsdserialize_xml.cpp b/indra/llcommon/llsdserialize_xml.cpp
index 7e1c2e35e0..fca173df47 100644
--- a/indra/llcommon/llsdserialize_xml.cpp
+++ b/indra/llcommon/llsdserialize_xml.cpp
@@ -139,12 +139,8 @@ S32 LLSDXMLFormatter::format_impl(const LLSD& data, std::ostream& ostr, U32 opti
 	case LLSD::TypeBoolean:
 		ostr << pre << "<boolean>";
 		if(mBoolAlpha ||
-#if( LL_WINDOWS || __GNUC__ > 2)
 		   (ostr.flags() & std::ios::boolalpha)
-#else
-		   (ostr.flags() & 0x0100)
-#endif
-			)
+		   )
 		{
 			ostr << (data.asBoolean() ? "true" : "false");
 		}
@@ -511,12 +507,7 @@ void LLSDXMLParser::Impl::reset()
 	
 	mSkipping = false;
 	
-#if( LL_WINDOWS || __GNUC__ > 2)
 	mCurrentKey.clear();
-#else
-	mCurrentKey = std::string();
-#endif
-
 	
 	XML_ParserReset(mParser, "utf-8");
 	XML_SetUserData(mParser, this);
@@ -644,11 +635,7 @@ void LLSDXMLParser::Impl::startElementHandler(const XML_Char* name, const XML_Ch
 		LLSD& newElement = map[mCurrentKey];
 		mStack.push_back(&newElement);		
 
-#if( LL_WINDOWS || __GNUC__ > 2)
 		mCurrentKey.clear();
-#else
-		mCurrentKey = std::string();
-#endif
 	}
 	else if (mStack.back()->isArray())
 	{
diff --git a/indra/llimage/llimageworker.cpp b/indra/llimage/llimageworker.cpp
index 86d41515e7..20a72d0a28 100644
--- a/indra/llimage/llimageworker.cpp
+++ b/indra/llimage/llimageworker.cpp
@@ -54,9 +54,14 @@ S32 LLImageDecodeThread::update(U32 max_time_ms)
 	{
 		creation_info& info = *iter;
 		ImageRequest* req = new ImageRequest(info.handle, info.image,
-											 info.priority, info.discard, info.needs_aux,
-											 info.responder);
-		addRequest(req);
+						     info.priority, info.discard, info.needs_aux,
+						     info.responder);
+
+		bool res = addRequest(req);
+		if (!res)
+		{
+			llerrs << "request added after LLLFSThread::cleanupClass()" << llendl;
+		}
 	}
 	mCreationList.clear();
 	S32 res = LLQueuedThread::update(max_time_ms);
-- 
cgit v1.2.3