diff --git a/indra/llui/llaccordionctrltab.cpp b/indra/llui/llaccordionctrltab.cpp
index 1034a219052f29b45ba4be46885f837573ec7c5d..16ca57811112b6de56c3d190bc2c6ad4a98afa6f 100644
--- a/indra/llui/llaccordionctrltab.cpp
+++ b/indra/llui/llaccordionctrltab.cpp
@@ -977,7 +977,7 @@ void LLAccordionCtrlTab::drawChild(const LLRect& root_rect,LLView* child)
 		LLRect screen_rect;
 		localRectToScreen(child->getRect(),&screen_rect);
 		
-		if ( root_rect.overlaps(screen_rect)  && LLUI::getInstance()->mDirtyRect.overlaps(screen_rect))
+		if ( root_rect.overlaps(screen_rect)  && sDirtyRect.overlaps(screen_rect))
 		{
 			gGL.matrixMode(LLRender::MM_MODELVIEW);
 			LLUI::pushMatrix();
diff --git a/indra/llui/llconsole.cpp b/indra/llui/llconsole.cpp
index de09fdbafd71ab4c75c8d7441bb16af165df67e1..8fc2978bdd10c972c84d64b35954bdd2e3bd62d2 100644
--- a/indra/llui/llconsole.cpp
+++ b/indra/llui/llconsole.cpp
@@ -181,7 +181,7 @@ void LLConsole::draw()
 	LLUIImagePtr imagep = LLUI::getUIImage("transparent");
 
 	static LLCachedControl<F32> console_bg_opacity(*LLUI::getInstance()->mSettingGroups["config"], "ConsoleBackgroundOpacity", 0.7f);
-	F32 console_opacity = llclamp((F32)console_bg_opacity, 0.f, 1.f);
+	F32 console_opacity = llclamp(console_bg_opacity(), 0.f, 1.f);
 
 	LLColor4 color = LLUIColorTable::instance().getColor("ConsoleBackground");
 	color.mV[VALPHA] *= console_opacity;
diff --git a/indra/llui/llfolderview.cpp b/indra/llui/llfolderview.cpp
index 483862298cb2d0205b303526250fc081c4ef39c1..622c9edba765b53e023d82ef9abcd083b13db8d2 100644
--- a/indra/llui/llfolderview.cpp
+++ b/indra/llui/llfolderview.cpp
@@ -344,7 +344,7 @@ void LLFolderView::filter( LLFolderViewFilter& filter )
 	LL_RECORD_BLOCK_TIME(FTM_FILTER);
     static LLCachedControl<S32> time_visible(*LLUI::getInstance()->mSettingGroups["config"], "FilterItemsMaxTimePerFrameVisible", 10);
     static LLCachedControl<S32> time_invisible(*LLUI::getInstance()->mSettingGroups["config"], "FilterItemsMaxTimePerFrameUnvisible", 1);
-    filter.resetTime(llclamp((S32)(mParentPanel.get()->getVisible() ? time_visible : time_invisible), 1, 100));
+    filter.resetTime(llclamp((mParentPanel.get()->getVisible() ? time_visible() : time_invisible()), 1, 100));
 
     // Note: we filter the model, not the view
 	getViewModelItem()->filter(filter);
diff --git a/indra/llui/llfolderviewmodel.cpp b/indra/llui/llfolderviewmodel.cpp
index a91c3e07d47d9eec74d170e5f53dc0c50aa997ec..93122503d1e693ca5b2500e32ab6f35624b64cf4 100644
--- a/indra/llui/llfolderviewmodel.cpp
+++ b/indra/llui/llfolderviewmodel.cpp
@@ -49,7 +49,7 @@ std::string LLFolderViewModelCommon::getStatusText()
 void LLFolderViewModelCommon::filter()
 {
     static LLCachedControl<S32> max_time(*LLUI::getInstance()->mSettingGroups["config"], "FilterItemsMaxTimePerFrameVisible", 10);
-    getFilter().resetTime(llclamp((S32)max_time, 1, 100));
+    getFilter().resetTime(llclamp(max_time(), 1, 100));
     mFolderView->getViewModelItem()->filter(getFilter());
 }
 
diff --git a/indra/llui/lltooltip.cpp b/indra/llui/lltooltip.cpp
index 1262e8a8201f6467e5521b7455e2d3af1bb7c3a8..2f56a8b1d0bfdd38d6d5d0399e6646037d66d05a 100644
--- a/indra/llui/lltooltip.cpp
+++ b/indra/llui/lltooltip.cpp
@@ -359,7 +359,7 @@ void LLToolTip::draw()
 	if (mFadeTimer.getStarted())
 	{
 		static LLCachedControl<F32> tool_tip_fade_time(*LLUI::getInstance()->mSettingGroups["config"], "ToolTipFadeTime", 0.2f);
-		alpha = clamp_rescale(mFadeTimer.getElapsedTimeF32(), 0.f, (F32)tool_tip_fade_time, 1.f, 0.f);
+		alpha = clamp_rescale(mFadeTimer.getElapsedTimeF32(), 0.f, tool_tip_fade_time(), 1.f, 0.f);
 		if (alpha == 0.f)
 		{
 			// finished fading out, so hide ourselves
diff --git a/indra/llui/llui.cpp b/indra/llui/llui.cpp
index 77b59e5bc5edd0d4e0246629ddf1a77b740ec571..6f16745bd343bd9fafbc9c9429de769835928105 100644
--- a/indra/llui/llui.cpp
+++ b/indra/llui/llui.cpp
@@ -154,7 +154,6 @@ mAudioCallback(audio_callback),
 mDeferredAudioCallback(deferred_audio_callback),
 mWindow(NULL), // set later in startup
 mRootView(NULL),
-mDirty(FALSE),
 mHelpImpl(NULL)
 {
 	LLRender2D::initParamSingleton(image_provider);
@@ -203,19 +202,6 @@ void LLUI::setPopupFuncs(const add_popup_t& add_popup, const remove_popup_t& rem
 	mClearPopupsFunc = clear_popups;
 }
 
-void LLUI::dirtyRect(LLRect rect)
-{
-	if (!mDirty)
-	{
-		mDirtyRect = rect;
-		mDirty = TRUE;
-	}
-	else
-	{
-		mDirtyRect.unionWith(rect);
-	}
-}
-
 void LLUI::setMousePositionScreen(S32 x, S32 y)
 {
 #if defined(LL_DARWIN)
diff --git a/indra/llui/llui.h b/indra/llui/llui.h
index 238bef3bf8a60f24bfeb6700a897e2b61d5cc7f3..30dbd7248f40b55114782916916026e8274cbc59 100644
--- a/indra/llui/llui.h
+++ b/indra/llui/llui.h
@@ -245,10 +245,6 @@ class LLUI : public LLParamSingleton<LLUI>
 
 	void setPopupFuncs(const add_popup_t& add_popup, const remove_popup_t&, const clear_popups_t& );
 
-	LLRect	mDirtyRect;
-	BOOL		mDirty;
-	void		dirtyRect(LLRect rect);
-
 	// Return the ISO639 language name ("en", "ko", etc.) for the viewer UI.
 	// http://www.loc.gov/standards/iso639-2/php/code_list.php
 	std::string getUILanguage();
diff --git a/indra/llui/llview.cpp b/indra/llui/llview.cpp
index 8b889376b88d0fa93c2a152c2559b46aba5c3923..f8686018b87096a753c3530fe2bb28722a40d746 100644
--- a/indra/llui/llview.cpp
+++ b/indra/llui/llview.cpp
@@ -60,6 +60,8 @@ static const S32 LINE_HEIGHT = 15;
 
 S32		LLView::sDepth = 0;
 bool	LLView::sDebugRects = false;
+bool	LLView::sIsRectDirty = false;
+LLRect	LLView::sDirtyRect;
 bool	LLView::sDebugRectsShowNames = true;
 bool	LLView::sDebugKeys = false;
 bool	LLView::sDebugMouseHandling = false;
@@ -1181,7 +1183,7 @@ void LLView::drawChildren()
 			if (viewp->getVisible() && viewp->getRect().isValid())
 			{
 				LLRect screen_rect = viewp->calcScreenRect();
-				if ( rootp->getLocalRect().overlaps(screen_rect)  && LLUI::getInstance()->mDirtyRect.overlaps(screen_rect))
+				if ( rootp->getLocalRect().overlaps(screen_rect)  && sDirtyRect.overlaps(screen_rect))
 				{
 					LLUI::pushMatrix();
 					{
@@ -1223,7 +1225,15 @@ void LLView::dirtyRect()
 		parent = parent->getParent();
 	}
 
-	LLUI::getInstance()->dirtyRect(cur->calcScreenRect());
+    if (!sIsRectDirty)
+    {
+        sDirtyRect = cur->calcScreenRect();
+        sIsRectDirty = true;
+    }
+    else
+    {
+        sDirtyRect.unionWith(cur->calcScreenRect());
+    }
 }
 
 //Draw a box for debugging.
diff --git a/indra/llui/llview.h b/indra/llui/llview.h
index db81900aaff267e0d149d76ab712159bd3edc704..7c90794ddb7e92bdf4e7063f85d6dd5193ba4a7f 100644
--- a/indra/llui/llview.h
+++ b/indra/llui/llview.h
@@ -656,6 +656,9 @@ class LLView
 	// Draw debug rectangles around widgets to help with alignment and spacing
 	static bool	sDebugRects;
 
+    static bool sIsRectDirty;
+    static LLRect sDirtyRect;
+
 	// Draw widget names and sizes when drawing debug rectangles, turning this
 	// off is useful to make the rectangles themselves easier to see.
 	static bool sDebugRectsShowNames;
diff --git a/indra/newview/llviewerdisplay.cpp b/indra/newview/llviewerdisplay.cpp
index f025863072df5c4f058f529b9f51c7284beeb96a..b4361b39681f350f96350afc0f3ab087e4f41018 100644
--- a/indra/newview/llviewerdisplay.cpp
+++ b/indra/newview/llviewerdisplay.cpp
@@ -1524,10 +1524,9 @@ void render_ui_2d()
 
 	if (gSavedSettings.getBOOL("RenderUIBuffer"))
 	{
-		LLUI* ui_inst = LLUI::getInstance();
-		if (ui_inst->mDirty)
+		if (LLView::sIsRectDirty)
 		{
-			ui_inst->mDirty = FALSE;
+            LLView::sIsRectDirty = false;
 			LLRect t_rect;
 
 			gPipeline.mUIScreen.bindTarget();
@@ -1535,25 +1534,25 @@ void render_ui_2d()
 			{
 				static const S32 pad = 8;
 
-				ui_inst->mDirtyRect.mLeft -= pad;
-				ui_inst->mDirtyRect.mRight += pad;
-				ui_inst->mDirtyRect.mBottom -= pad;
-				ui_inst->mDirtyRect.mTop += pad;
+                LLView::sDirtyRect.mLeft -= pad;
+                LLView::sDirtyRect.mRight += pad;
+                LLView::sDirtyRect.mBottom -= pad;
+                LLView::sDirtyRect.mTop += pad;
 
 				LLGLEnable scissor(GL_SCISSOR_TEST);
-				static LLRect last_rect = ui_inst->mDirtyRect;
+				static LLRect last_rect = LLView::sDirtyRect;
 
 				//union with last rect to avoid mouse poop
-				last_rect.unionWith(ui_inst->mDirtyRect);
+				last_rect.unionWith(LLView::sDirtyRect);
 								
-				t_rect = ui_inst->mDirtyRect;
-				ui_inst->mDirtyRect = last_rect;
+				t_rect = LLView::sDirtyRect;
+                LLView::sDirtyRect = last_rect;
 				last_rect = t_rect;
-			
-				last_rect.mLeft = LLRect::tCoordType(last_rect.mLeft / ui_inst->getScaleFactor().mV[0]);
-				last_rect.mRight = LLRect::tCoordType(last_rect.mRight / ui_inst->getScaleFactor().mV[0]);
-				last_rect.mTop = LLRect::tCoordType(last_rect.mTop / ui_inst->getScaleFactor().mV[1]);
-				last_rect.mBottom = LLRect::tCoordType(last_rect.mBottom / ui_inst->getScaleFactor().mV[1]);
+
+				last_rect.mLeft = LLRect::tCoordType(last_rect.mLeft / LLUI::getScaleFactor().mV[0]);
+				last_rect.mRight = LLRect::tCoordType(last_rect.mRight / LLUI::getScaleFactor().mV[0]);
+				last_rect.mTop = LLRect::tCoordType(last_rect.mTop / LLUI::getScaleFactor().mV[1]);
+				last_rect.mBottom = LLRect::tCoordType(last_rect.mBottom / LLUI::getScaleFactor().mV[1]);
 
 				LLRect clip_rect(last_rect);
 				
@@ -1565,7 +1564,7 @@ void render_ui_2d()
 			gPipeline.mUIScreen.flush();
 			gGL.setColorMask(true, false);
 
-			ui_inst->mDirtyRect = t_rect;
+            LLView::sDirtyRect = t_rect;
 		}
 
 		LLGLDisable cull(GL_CULL_FACE);
diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp
index 0cc1e0df06aaf1c95aae7d801199ece5397c7d0e..85c8b42da902e072f81e845973a988c91c769a92 100644
--- a/indra/newview/llviewerwindow.cpp
+++ b/indra/newview/llviewerwindow.cpp
@@ -2580,7 +2580,7 @@ void LLViewerWindow::draw()
 
 	if (!gSavedSettings.getBOOL("RenderUIBuffer"))
 	{
-		LLUI::getInstance()->mDirtyRect = getWindowRectScaled();
+		LLView::sDirtyRect = getWindowRectScaled();
 	}
 
 	// HACK for timecode debugging