diff options
author | Dave Parks <davep@lindenlab.com> | 2011-02-01 02:06:36 -0600 |
---|---|---|
committer | Dave Parks <davep@lindenlab.com> | 2011-02-01 02:06:36 -0600 |
commit | d3bfbd8ebbaa2b891114de4dac52ba6cbcadce3b (patch) | |
tree | 864f18e0023220a9bf06e7f4dc27928ef002e16d /indra/newview/llviewerwindow.cpp | |
parent | faac42bca702d9b4126c3ca4b5656074dc7846f4 (diff) |
SH-483 Fix for varioius issues with hi-rez snapshots -- mainly disable the ability to take hi-rez snapshots if UI or HUD attachments are in the snapshot, and go back to old tile compositing method instead of using huge framebuffer objects.
Diffstat (limited to 'indra/newview/llviewerwindow.cpp')
-rw-r--r-- | indra/newview/llviewerwindow.cpp | 40 |
1 files changed, 27 insertions, 13 deletions
diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index 1bb45fd494..6b1fffe64d 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -3993,16 +3993,26 @@ BOOL LLViewerWindow::rawSnapshot(LLImageRaw *raw, S32 image_width, S32 image_hei LLPipeline::sShowHUDAttachments = FALSE; } + // if not showing ui, use full window to render world view + updateWorldViewRect(!show_ui); + // Copy screen to a buffer // crop sides or top and bottom, if taking a snapshot of different aspect ratio // from window - S32 snapshot_width = mWindowRectRaw.getWidth(); - S32 snapshot_height = mWindowRectRaw.getHeight(); + LLRect window_rect = show_ui ? getWindowRectRaw() : getWorldViewRectRaw(); + + S32 snapshot_width = window_rect.getWidth(); + S32 snapshot_height = window_rect.getHeight(); // SNAPSHOT - S32 window_width = mWindowRectRaw.getWidth(); - S32 window_height = mWindowRectRaw.getHeight(); - LLRect window_rect = mWindowRectRaw; + S32 window_width = snapshot_width; + S32 window_height = snapshot_height; + if (show_ui) + { + image_width = llmin(image_width, window_width); + image_height = llmin(image_height, window_height); + } + F32 scale_factor = 1.0f ; if(!keep_window_aspect) //image cropping { @@ -4022,14 +4032,17 @@ BOOL LLViewerWindow::rawSnapshot(LLImageRaw *raw, S32 image_width, S32 image_hei } } - // if not showing ui, use full window to render world view - updateWorldViewRect(!show_ui); + if (show_ui && scale_factor > 1.f) + { + llwarns << "over scaling UI not supported." << llendl; + } S32 buffer_x_offset = llfloor(((window_width - snapshot_width) * scale_factor) / 2.f); S32 buffer_y_offset = llfloor(((window_height - snapshot_height) * scale_factor) / 2.f); S32 image_buffer_x = llfloor(snapshot_width*scale_factor) ; S32 image_buffer_y = llfloor(snapshot_height *scale_factor) ; + if(image_buffer_x > max_size || image_buffer_y > max_size) //boundary check to avoid memory overflow { scale_factor *= llmin((F32)max_size / image_buffer_x, (F32)max_size / image_buffer_y) ; @@ -4038,7 +4051,7 @@ BOOL LLViewerWindow::rawSnapshot(LLImageRaw *raw, S32 image_width, S32 image_hei } if(image_buffer_x > 0 && image_buffer_y > 0) { - raw->resize(image_buffer_x, image_buffer_y, 3); + raw->resize(image_buffer_x, image_buffer_y, 3); } else { @@ -4050,12 +4063,13 @@ BOOL LLViewerWindow::rawSnapshot(LLImageRaw *raw, S32 image_width, S32 image_hei } BOOL high_res = scale_factor >= 2.f; // Font scaling is slow, only do so if rez is much higher - if (high_res) + if (high_res && show_ui) { - send_agent_pause(); + llwarns << "High res UI snapshot not supported. " << llendl; + /*send_agent_pause(); //rescale fonts initFonts(scale_factor); - LLHUDObject::reshapeAll(); + LLHUDObject::reshapeAll();*/ } S32 output_buffer_offset_y = 0; @@ -4165,11 +4179,11 @@ BOOL LLViewerWindow::rawSnapshot(LLImageRaw *raw, S32 image_width, S32 image_hei LLPipeline::sShowHUDAttachments = TRUE; } - if (high_res) + /*if (high_res) { initFonts(1.f); LLHUDObject::reshapeAll(); - } + }*/ // Pre-pad image to number of pixels such that the line length is a multiple of 4 bytes (for BMP encoding) // Note: this formula depends on the number of components being 3. Not obvious, but it's correct. |