diff --git a/indra/newview/llfloater360capture.cpp b/indra/newview/llfloater360capture.cpp
index aa226981aa8ae13a4b21b826a6c2b078934f5387..87f42cd7f583a65c499e93d038a396afc80a80fb 100644
--- a/indra/newview/llfloater360capture.cpp
+++ b/indra/newview/llfloater360capture.cpp
@@ -230,9 +230,9 @@ void LLFloater360Capture::setSourceImageSize()
         S32 window_width = window_rect.getWidth();
         S32 window_height = window_rect.getHeight();
 
-        while (mSourceImageSize > window_width || mSourceImageSize > window_height)
+        if (mSourceImageSize > window_width || mSourceImageSize > window_height)
         {
-            mSourceImageSize /= 2;
+            mSourceImageSize = llmin(window_width, window_height, mSourceImageSize);
             LL_INFOS("360Capture") << "Deferred rendering is forcing a smaller capture size: " << mSourceImageSize << LL_ENDL;
         }