From aad22f9faf045f2412f7c32336cff3886464c157 Mon Sep 17 00:00:00 2001
From: Loren Shih <seraph@lindenlab.com>
Date: Thu, 4 Nov 2010 16:35:24 -0400
Subject: SH-281 Fix for snapshots showing interface all the time

---
 indra/newview/llviewerdisplay.cpp | 19 ++++++++++++++++---
 indra/newview/llviewerwindow.cpp  |  9 ++++++---
 2 files changed, 22 insertions(+), 6 deletions(-)

diff --git a/indra/newview/llviewerdisplay.cpp b/indra/newview/llviewerdisplay.cpp
index 137704e960..40583f05bf 100644
--- a/indra/newview/llviewerdisplay.cpp
+++ b/indra/newview/llviewerdisplay.cpp
@@ -221,11 +221,24 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot)
 	if (gResizeScreenTexture)
 	{ //skip render on frames where screen texture is resizing
 		gGL.flush();
-		glClear(GL_COLOR_BUFFER_BIT);
-		gViewerWindow->mWindow->swapBuffers();
+		if (!for_snapshot)
+		{
+			glClear(GL_COLOR_BUFFER_BIT);
+			gViewerWindow->mWindow->swapBuffers();
+		}
+	
 		gResizeScreenTexture = FALSE;
 		gPipeline.resizeScreenTexture();
-		return;
+
+		if (!for_snapshot)
+		{
+			return;
+		}
+	}
+
+	if (LLPipeline::sRenderDeferred)
+	{ //hack to make sky show up in deferred snapshots
+		for_snapshot = FALSE;
 	}
 
 	if (LLPipeline::sRenderFrameTest)
diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp
index a0a3380441..15f82cf568 100644
--- a/indra/newview/llviewerwindow.cpp
+++ b/indra/newview/llviewerwindow.cpp
@@ -3860,7 +3860,9 @@ BOOL LLViewerWindow::rawSnapshot(LLImageRaw *raw, S32 image_width, S32 image_hei
 	setCursor(UI_CURSOR_WAIT);
 
 	// Hide all the UI widgets first and draw a frame
-	BOOL prev_draw_ui = gPipeline.hasRenderDebugFeatureMask(LLPipeline::RENDER_DEBUG_FEATURE_UI);
+	BOOL prev_draw_ui = gPipeline.hasRenderDebugFeatureMask(LLPipeline::RENDER_DEBUG_FEATURE_UI) ? TRUE : FALSE;
+
+	show_ui = show_ui ? TRUE : FALSE;
 
 	if ( prev_draw_ui != show_ui)
 	{
@@ -3998,12 +4000,13 @@ BOOL LLViewerWindow::rawSnapshot(LLImageRaw *raw, S32 image_width, S32 image_hei
 
 				if (LLPipeline::sRenderDeferred)
 				{
-					display(do_rebuild, scale_factor, subfield, FALSE);
+					display(do_rebuild, scale_factor, subfield, TRUE);
 				}
 				else
 				{
 					display(do_rebuild, scale_factor, subfield, TRUE);
-					// Required for showing the GUI in snapshots?  See DEV-16350 for details. JC
+					// Required for showing the GUI in snapshots and performing bloom composite overlay
+					// Call even if show_ui is FALSE
 					render_ui(scale_factor, subfield);
 				}
 			}
-- 
cgit v1.2.3