diff options
author | James Cook <james@lindenlab.com> | 2009-11-10 14:36:25 -0800 |
---|---|---|
committer | James Cook <james@lindenlab.com> | 2009-11-10 14:36:25 -0800 |
commit | bc4b49735cf5d162a43d0c8fa880e6e9fd828e4a (patch) | |
tree | 0067e7ccc8c9a245245a0369b9c5cf81ad9983c7 /indra | |
parent | 77f982c1a9a8f5b30e8b369da6f7208c171700b1 (diff) | |
parent | 0f6242d9fd948cda1abf18885eef320b22d310c5 (diff) |
merge
Diffstat (limited to 'indra')
51 files changed, 303 insertions, 297 deletions
diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp index 24bdf66c2a..d2c8558f0b 100644 --- a/indra/newview/llagent.cpp +++ b/indra/newview/llagent.cpp @@ -2619,9 +2619,9 @@ void LLAgent::updateLookAt(const S32 mouse_x, const S32 mouse_y) { // range from -.5 to .5 F32 x_from_center = - ((F32) mouse_x / (F32) gViewerWindow->getWindowWidth() ) - 0.5f; + ((F32) mouse_x / (F32) gViewerWindow->getWindowWidthScaled() ) - 0.5f; F32 y_from_center = - ((F32) mouse_y / (F32) gViewerWindow->getWindowHeight() ) - 0.5f; + ((F32) mouse_y / (F32) gViewerWindow->getWindowHeightScaled() ) - 0.5f; frameCamera.yaw( - x_from_center * gSavedSettings.getF32("YawFromMousePosition") * DEG_TO_RAD); frameCamera.pitch( - y_from_center * gSavedSettings.getF32("PitchFromMousePosition") * DEG_TO_RAD); @@ -3436,11 +3436,11 @@ F32 LLAgent::calcCustomizeAvatarUIOffset( const LLVector3d& camera_pos_global ) const LLRect& rect = gFloaterCustomize->getRect(); // Move the camera so that the avatar isn't covered up by this floater. - F32 fraction_of_fov = 0.5f - (0.5f * (1.f - llmin(1.f, ((F32)rect.getWidth() / (F32)gViewerWindow->getWindowWidth())))); + F32 fraction_of_fov = 0.5f - (0.5f * (1.f - llmin(1.f, ((F32)rect.getWidth() / (F32)gViewerWindow->getWindowWidthScaled())))); F32 apparent_angle = fraction_of_fov * LLViewerCamera::getInstance()->getView() * LLViewerCamera::getInstance()->getAspect(); // radians F32 offset = tan(apparent_angle); - if( rect.mLeft < (gViewerWindow->getWindowWidth() - rect.mRight) ) + if( rect.mLeft < (gViewerWindow->getWindowWidthScaled() - rect.mRight) ) { // Move the avatar to the right (camera to the left) ui_offset = offset; diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 8e6d6b885d..ddb6589b49 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -3282,7 +3282,7 @@ void LLAppViewer::saveFinalSnapshot() snap_filename += gDirUtilp->getDirDelimiter(); snap_filename += SCREEN_LAST_FILENAME; // use full pixel dimensions of viewer window (not post-scale dimensions) - gViewerWindow->saveSnapshot(snap_filename, gViewerWindow->getWindowDisplayWidth(), gViewerWindow->getWindowDisplayHeight(), FALSE, TRUE); + gViewerWindow->saveSnapshot(snap_filename, gViewerWindow->getWindowWidthRaw(), gViewerWindow->getWindowHeightRaw(), FALSE, TRUE); mSavedFinalSnapshot = TRUE; } } diff --git a/indra/newview/llchannelmanager.cpp b/indra/newview/llchannelmanager.cpp index 6427422572..914435b640 100644 --- a/indra/newview/llchannelmanager.cpp +++ b/indra/newview/llchannelmanager.cpp @@ -127,7 +127,7 @@ void LLChannelManager::onLoginCompleted() gViewerWindow->getRootView()->addChild(mStartUpChannel); // init channel's position and size - S32 channel_right_bound = gViewerWindow->getWorldViewRect().mRight - gSavedSettings.getS32("NotificationChannelRightMargin"); + S32 channel_right_bound = gViewerWindow->getWorldViewRectRaw().mRight - gSavedSettings.getS32("NotificationChannelRightMargin"); S32 channel_width = gSavedSettings.getS32("NotifyBoxWidth"); mStartUpChannel->init(channel_right_bound - channel_width, channel_right_bound); mStartUpChannel->setMouseDownCallback(boost::bind(&LLSysWellWindow::onStartUpToastClick, LLFloaterReg::getTypedInstance<LLSysWellWindow>("syswell_window"), _2, _3, _4)); diff --git a/indra/newview/lldebugview.cpp b/indra/newview/lldebugview.cpp index f76ec396ac..20dc4440c2 100644 --- a/indra/newview/lldebugview.cpp +++ b/indra/newview/lldebugview.cpp @@ -79,16 +79,16 @@ void LLDebugView::init() r.set(150 - 25, rect.getHeight() - 50, rect.getWidth()/2 - 25, rect.getHeight() - 450); - r.set(25, rect.getHeight() - 50, (S32) (gViewerWindow->getVirtualWindowRect().getWidth() * 0.75f), - (S32) (gViewerWindow->getVirtualWindowRect().getHeight() * 0.75f)); + r.set(25, rect.getHeight() - 50, (S32) (gViewerWindow->getWindowRectScaled().getWidth() * 0.75f), + (S32) (gViewerWindow->getWindowRectScaled().getHeight() * 0.75f)); mFastTimerView = new LLFastTimerView(r); mFastTimerView->setFollowsTop(); mFastTimerView->setFollowsLeft(); mFastTimerView->setVisible(FALSE); // start invisible addChild(mFastTimerView); - r.set(25, rect.getHeight() - 50, (S32) (gViewerWindow->getVirtualWindowRect().getWidth() * 0.75f), - (S32) (gViewerWindow->getVirtualWindowRect().getHeight() * 0.75f)); + r.set(25, rect.getHeight() - 50, (S32) (gViewerWindow->getWindowRectScaled().getWidth() * 0.75f), + (S32) (gViewerWindow->getWindowRectScaled().getHeight() * 0.75f)); LLMemoryView::Params mp; mp.name("memory"); mp.rect(r); diff --git a/indra/newview/lldrawable.cpp b/indra/newview/lldrawable.cpp index 03a3f2b43d..d60330024a 100644 --- a/indra/newview/lldrawable.cpp +++ b/indra/newview/lldrawable.cpp @@ -89,7 +89,7 @@ LLDynamicArrayPtr<LLPointer<LLDrawable> > LLDrawable::sDeadList; void LLDrawable::incrementVisible() { sCurVisible++; - sCurPixelAngle = (F32) gViewerWindow->getWindowDisplayHeight()/LLViewerCamera::getInstance()->getView(); + sCurPixelAngle = (F32) gViewerWindow->getWindowHeightRaw()/LLViewerCamera::getInstance()->getView(); } void LLDrawable::init() { diff --git a/indra/newview/lldynamictexture.cpp b/indra/newview/lldynamictexture.cpp index e41c4104eb..9bc7221dc8 100644 --- a/indra/newview/lldynamictexture.cpp +++ b/indra/newview/lldynamictexture.cpp @@ -126,7 +126,7 @@ void LLViewerDynamicTexture::preRender(BOOL clear_depth) // force rendering to on-screen portion of frame buffer LLCoordScreen window_pos; gViewerWindow->getWindow()->getPosition( &window_pos ); - mOrigin.set(0, gViewerWindow->getWindowDisplayHeight() - mFullHeight); // top left corner + mOrigin.set(0, gViewerWindow->getWindowHeightRaw() - mFullHeight); // top left corner if (window_pos.mX < 0) { diff --git a/indra/newview/llface.cpp b/indra/newview/llface.cpp index c54b83d865..31f1462a12 100644 --- a/indra/newview/llface.cpp +++ b/indra/newview/llface.cpp @@ -1403,7 +1403,7 @@ F32 LLFace::calcPixelArea(F32& cos_angle_to_view_dir, F32& radius) //the projection of the face partially overlaps with the screen F32 LLFace::adjustPartialOverlapPixelArea(F32 cos_angle_to_view_dir, F32 radius ) { - F32 screen_radius = (F32)llmax(gViewerWindow->getWindowDisplayWidth(), gViewerWindow->getWindowDisplayHeight()) ; + F32 screen_radius = (F32)llmax(gViewerWindow->getWindowWidthRaw(), gViewerWindow->getWindowHeightRaw()) ; F32 center_angle = acosf(cos_angle_to_view_dir) ; F32 d = center_angle * LLDrawable::sCurPixelAngle ; diff --git a/indra/newview/llfasttimerview.cpp b/indra/newview/llfasttimerview.cpp index 71265fdd2f..0b27001f10 100644 --- a/indra/newview/llfasttimerview.cpp +++ b/indra/newview/llfasttimerview.cpp @@ -303,8 +303,8 @@ void LLFastTimerView::draw() F64 iclock_freq = 1000.0 / clock_freq; S32 margin = 10; - S32 height = (S32) (gViewerWindow->getVirtualWindowRect().getHeight()*0.75f); - S32 width = (S32) (gViewerWindow->getVirtualWindowRect().getWidth() * 0.75f); + S32 height = (S32) (gViewerWindow->getWindowRectScaled().getHeight()*0.75f); + S32 width = (S32) (gViewerWindow->getWindowRectScaled().getWidth() * 0.75f); // HACK: casting away const. Should use setRect or some helper function instead. const_cast<LLRect&>(getRect()).setLeftTopAndSize(getRect().mLeft, getRect().mTop, width, height); diff --git a/indra/newview/llfloaterauction.cpp b/indra/newview/llfloaterauction.cpp index 262dc1804d..9ba61ba92f 100644 --- a/indra/newview/llfloaterauction.cpp +++ b/indra/newview/llfloaterauction.cpp @@ -188,8 +188,8 @@ void LLFloaterAuction::onClickSnapshot(void* data) gForceRenderLandFence = self->childGetValue("fence_check").asBoolean(); BOOL success = gViewerWindow->rawSnapshot(raw, - gViewerWindow->getWindowWidth(), - gViewerWindow->getWindowHeight(), + gViewerWindow->getWindowWidthScaled(), + gViewerWindow->getWindowHeightScaled(), TRUE, FALSE, FALSE, FALSE); gForceRenderLandFence = FALSE; diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp index 2af1313db4..f07f9412a2 100644 --- a/indra/newview/llfloaterpreference.cpp +++ b/indra/newview/llfloaterpreference.cpp @@ -1332,8 +1332,8 @@ void LLFloaterPreference::initWindowSizeControls(LLPanel* panelp) // Look to see if current window size matches existing window sizes, if so then // just set the selection value... - const U32 height = gViewerWindow->getWindowDisplayHeight(); - const U32 width = gViewerWindow->getWindowDisplayWidth(); + const U32 height = gViewerWindow->getWindowHeightRaw(); + const U32 width = gViewerWindow->getWindowWidthRaw(); for (S32 i=0; i < ctrl_window_size->getItemCount(); i++) { U32 height_test = 0; diff --git a/indra/newview/llfloaterproperties.cpp b/indra/newview/llfloaterproperties.cpp index 4375787ea2..928126bff9 100644 --- a/indra/newview/llfloaterproperties.cpp +++ b/indra/newview/llfloaterproperties.cpp @@ -900,7 +900,7 @@ LLMultiProperties::LLMultiProperties() { // start with a small rect in the top-left corner ; will get resized LLRect rect; - rect.setLeftTopAndSize(0, gViewerWindow->getWindowHeight(), 20, 20); + rect.setLeftTopAndSize(0, gViewerWindow->getWindowHeightScaled(), 20, 20); setRect(rect); } setTitle(LLTrans::getString("MultiPropertiesTitle")); diff --git a/indra/newview/llfloatersnapshot.cpp b/indra/newview/llfloatersnapshot.cpp index e570072803..1cc7042c3a 100644 --- a/indra/newview/llfloatersnapshot.cpp +++ b/indra/newview/llfloatersnapshot.cpp @@ -245,10 +245,10 @@ LLSnapshotLivePreview::LLSnapshotLivePreview (const LLSnapshotLivePreview::Param // gIdleCallbacks.addFunction( &LLSnapshotLivePreview::onIdle, (void*)this ); sList.insert(this); setFollowsAll(); - mWidth[0] = gViewerWindow->getWindowDisplayWidth(); - mWidth[1] = gViewerWindow->getWindowDisplayWidth(); - mHeight[0] = gViewerWindow->getWindowDisplayHeight(); - mHeight[1] = gViewerWindow->getWindowDisplayHeight(); + mWidth[0] = gViewerWindow->getWindowWidthRaw(); + mWidth[1] = gViewerWindow->getWindowWidthRaw(); + mHeight[0] = gViewerWindow->getWindowHeightRaw(); + mHeight[1] = gViewerWindow->getWindowHeightRaw(); mImageScaled[0] = FALSE; mImageScaled[1] = FALSE; @@ -494,27 +494,27 @@ void LLSnapshotLivePreview::draw() LLLocalClipRect clip(getLocalRect()); { // draw diagonal stripe with gradient that passes over screen - S32 x1 = gViewerWindow->getWindowWidth() * llround((clamp_rescale(shine_interp, 0.f, 1.f, -1.f - SHINE_WIDTH, 1.f))); - S32 x2 = x1 + llround(gViewerWindow->getWindowWidth() * SHINE_WIDTH); - S32 x3 = x2 + llround(gViewerWindow->getWindowWidth() * SHINE_WIDTH); + S32 x1 = gViewerWindow->getWindowWidthScaled() * llround((clamp_rescale(shine_interp, 0.f, 1.f, -1.f - SHINE_WIDTH, 1.f))); + S32 x2 = x1 + llround(gViewerWindow->getWindowWidthScaled() * SHINE_WIDTH); + S32 x3 = x2 + llround(gViewerWindow->getWindowWidthScaled() * SHINE_WIDTH); S32 y1 = 0; - S32 y2 = gViewerWindow->getWindowHeight(); + S32 y2 = gViewerWindow->getWindowHeightScaled(); gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); gGL.begin(LLRender::QUADS); { gGL.color4f(1.f, 1.f, 1.f, 0.f); gGL.vertex2i(x1, y1); - gGL.vertex2i(x1 + gViewerWindow->getWindowWidth(), y2); + gGL.vertex2i(x1 + gViewerWindow->getWindowWidthScaled(), y2); gGL.color4f(1.f, 1.f, 1.f, SHINE_OPACITY); - gGL.vertex2i(x2 + gViewerWindow->getWindowWidth(), y2); + gGL.vertex2i(x2 + gViewerWindow->getWindowWidthScaled(), y2); gGL.vertex2i(x2, y1); gGL.color4f(1.f, 1.f, 1.f, SHINE_OPACITY); gGL.vertex2i(x2, y1); - gGL.vertex2i(x2 + gViewerWindow->getWindowWidth(), y2); + gGL.vertex2i(x2 + gViewerWindow->getWindowWidthScaled(), y2); gGL.color4f(1.f, 1.f, 1.f, 0.f); - gGL.vertex2i(x3 + gViewerWindow->getWindowWidth(), y2); + gGL.vertex2i(x3 + gViewerWindow->getWindowWidthScaled(), y2); gGL.vertex2i(x3, y1); } gGL.end(); @@ -617,8 +617,8 @@ BOOL LLSnapshotLivePreview::setThumbnailImageSize() { return FALSE ; } - S32 window_width = gViewerWindow->getWindowDisplayWidth() ; - S32 window_height = gViewerWindow->getWindowDisplayHeight() ; + S32 window_width = gViewerWindow->getWindowWidthRaw() ; + S32 window_height = gViewerWindow->getWindowHeightRaw() ; F32 window_aspect_ratio = ((F32)window_width) / ((F32)window_height); @@ -1168,7 +1168,7 @@ void LLFloaterSnapshot::Impl::updateLayout(LLFloaterSnapshot* floaterp) gSavedSettings.setS32("SnapshotLocalLastResolution", 0); LLSnapshotLivePreview* previewp = getPreviewView(floaterp); - previewp->setSize(gViewerWindow->getWindowDisplayWidth(), gViewerWindow->getWindowDisplayHeight()); + previewp->setSize(gViewerWindow->getWindowWidthRaw(), gViewerWindow->getWindowHeightRaw()); } bool use_freeze_frame = floaterp->childGetValue("freeze_frame_check").asBoolean(); @@ -1693,7 +1693,7 @@ void LLFloaterSnapshot::Impl::updateResolution(LLUICtrl* ctrl, void* data, BOOL if (width == 0 || height == 0) { // take resolution from current window size - previewp->setSize(gViewerWindow->getWindowDisplayWidth(), gViewerWindow->getWindowDisplayHeight()); + previewp->setSize(gViewerWindow->getWindowWidthRaw(), gViewerWindow->getWindowHeightRaw()); } else if (width == -1 || height == -1) { @@ -1846,13 +1846,13 @@ BOOL LLFloaterSnapshot::Impl::checkImageSize(LLSnapshotLivePreview* previewp, S3 #endif if(previewp && previewp->mKeepAspectRatio) { - if(gViewerWindow->getWindowDisplayWidth() < 1 || gViewerWindow->getWindowDisplayHeight() < 1) + if(gViewerWindow->getWindowWidthRaw() < 1 || gViewerWindow->getWindowHeightRaw() < 1) { return FALSE ; } //aspect ratio of the current window - F32 aspect_ratio = (F32)gViewerWindow->getWindowDisplayWidth() / gViewerWindow->getWindowDisplayHeight() ; + F32 aspect_ratio = (F32)gViewerWindow->getWindowWidthRaw() / gViewerWindow->getWindowHeightRaw() ; //change another value proportionally if(isWidthChanged) diff --git a/indra/newview/llfolderview.cpp b/indra/newview/llfolderview.cpp index 7863c373c6..21458f83cd 100644 --- a/indra/newview/llfolderview.cpp +++ b/indra/newview/llfolderview.cpp @@ -2174,7 +2174,7 @@ void LLFolderView::updateRenamerPosition() screenPointToLocal( x, y, &x, &y ); mRenamer->setOrigin( x, y ); - LLRect scroller_rect(0, 0, gViewerWindow->getWindowWidth(), 0); + LLRect scroller_rect(0, 0, gViewerWindow->getWindowWidthScaled(), 0); if (mScrollContainer) { scroller_rect = mScrollContainer->getContentWindowRect(); diff --git a/indra/newview/llhudicon.cpp b/indra/newview/llhudicon.cpp index eda1d3fc55..040027c70d 100644 --- a/indra/newview/llhudicon.cpp +++ b/indra/newview/llhudicon.cpp @@ -145,8 +145,8 @@ void LLHUDIcon::renderIcon(BOOL for_select) } F32 image_aspect = (F32)mImagep->getFullWidth() / (F32)mImagep->getFullHeight() ; - LLVector3 x_scale = image_aspect * (F32)gViewerWindow->getWindowHeight() * mScale * scale_factor * x_pixel_vec; - LLVector3 y_scale = (F32)gViewerWindow->getWindowHeight() * mScale * scale_factor * y_pixel_vec; + LLVector3 x_scale = image_aspect * (F32)gViewerWindow->getWindowHeightScaled() * mScale * scale_factor * x_pixel_vec; + LLVector3 y_scale = (F32)gViewerWindow->getWindowHeightScaled() * mScale * scale_factor * y_pixel_vec; LLVector3 lower_left = icon_position - (x_scale * 0.5f); LLVector3 lower_right = icon_position + (x_scale * 0.5f); @@ -261,8 +261,8 @@ BOOL LLHUDIcon::lineSegmentIntersect(const LLVector3& start, const LLVector3& en } F32 image_aspect = (F32)mImagep->getFullWidth() / (F32)mImagep->getFullHeight() ; - LLVector3 x_scale = image_aspect * (F32)gViewerWindow->getWindowHeight() * mScale * scale_factor * x_pixel_vec; - LLVector3 y_scale = (F32)gViewerWindow->getWindowHeight() * mScale * scale_factor * y_pixel_vec; + LLVector3 x_scale = image_aspect * (F32)gViewerWindow->getWindowHeightScaled() * mScale * scale_factor * x_pixel_vec; + LLVector3 y_scale = (F32)gViewerWindow->getWindowHeightScaled() * mScale * scale_factor * y_pixel_vec; LLVector3 lower_left = icon_position - (x_scale * 0.5f); LLVector3 lower_right = icon_position + (x_scale * 0.5f); diff --git a/indra/newview/llhudrender.cpp b/indra/newview/llhudrender.cpp index 886fe3da07..ab0be90def 100644 --- a/indra/newview/llhudrender.cpp +++ b/indra/newview/llhudrender.cpp @@ -77,8 +77,8 @@ void hud_render_text(const LLWString &wstr, const LLVector3 &pos_agent, LLVector3 up_axis; if (orthographic) { - right_axis.setVec(0.f, -1.f / gViewerWindow->getWorldViewWidth(), 0.f); - up_axis.setVec(0.f, 0.f, 1.f / gViewerWindow->getWorldViewHeight()); + right_axis.setVec(0.f, -1.f / gViewerWindow->getWorldViewWidthRaw(), 0.f); + up_axis.setVec(0.f, 0.f, 1.f / gViewerWindow->getWorldViewHeightRaw()); } else { @@ -106,7 +106,7 @@ void hud_render_text(const LLWString &wstr, const LLVector3 &pos_agent, //get the render_pos in screen space F64 winX, winY, winZ; - LLRect world_view_rect = gViewerWindow->getWorldViewRect(); + LLRect world_view_rect = gViewerWindow->getWorldViewRectRaw(); S32 viewport[4]; viewport[0] = world_view_rect.mLeft; viewport[1] = world_view_rect.mBottom; diff --git a/indra/newview/llhudtext.cpp b/indra/newview/llhudtext.cpp index 55019f91f8..0b5da40be4 100644 --- a/indra/newview/llhudtext.cpp +++ b/indra/newview/llhudtext.cpp @@ -156,8 +156,8 @@ BOOL LLHUDText::lineSegmentIntersect(const LLVector3& start, const LLVector3& en if (mOnHUDAttachment) { - x_pixel_vec = LLVector3::y_axis / (F32)gViewerWindow->getWindowWidth(); - y_pixel_vec = LLVector3::z_axis / (F32)gViewerWindow->getWindowHeight(); + x_pixel_vec = LLVector3::y_axis / (F32)gViewerWindow->getWindowWidthScaled(); + y_pixel_vec = LLVector3::z_axis / (F32)gViewerWindow->getWindowHeightScaled(); } else { @@ -316,8 +316,8 @@ void LLHUDText::renderText(BOOL for_select) if (mOnHUDAttachment) { - x_pixel_vec = LLVector3::y_axis / (F32)gViewerWindow->getWorldViewWidth(); - y_pixel_vec = LLVector3::z_axis / (F32)gViewerWindow->getWorldViewHeight(); + x_pixel_vec = LLVector3::y_axis / (F32)gViewerWindow->getWorldViewWidthRaw(); + y_pixel_vec = LLVector3::z_axis / (F32)gViewerWindow->getWorldViewHeightRaw(); } else { @@ -351,8 +351,8 @@ void LLHUDText::renderText(BOOL for_select) //if (mOnHUD) //{ - // render_position.mV[VY] -= fmodf(render_position.mV[VY], 1.f / (F32)gViewerWindow->getWindowWidth()); - // render_position.mV[VZ] -= fmodf(render_position.mV[VZ], 1.f / (F32)gViewerWindow->getWindowHeight()); + // render_position.mV[VY] -= fmodf(render_position.mV[VY], 1.f / (F32)gViewerWindow->getWindowWidthScaled()); + // render_position.mV[VZ] -= fmodf(render_position.mV[VZ], 1.f / (F32)gViewerWindow->getWindowHeightScaled()); //} //else //{ @@ -800,7 +800,7 @@ LLVector2 LLHUDText::updateScreenPos(LLVector2 &offset) screen_pos_vec.setVec((F32)screen_pos.mX, (F32)screen_pos.mY); - LLRect world_rect = gViewerWindow->getVirtualWorldViewRect(); + LLRect world_rect = gViewerWindow->getWorldViewRectScaled(); S32 bottom = world_rect.mBottom + STATUS_BAR_HEIGHT; LLVector2 screen_center; @@ -897,7 +897,7 @@ void LLHUDText::updateAll() std::sort(sVisibleHUDTextObjects.begin(), sVisibleHUDTextObjects.end(), lltextobject_further_away()); // iterate from front to back, and set LOD based on current screen coverage - F32 screen_area = (F32)(gViewerWindow->getWindowWidth() * gViewerWindow->getWindowHeight()); + F32 screen_area = (F32)(gViewerWindow->getWindowWidthScaled() * gViewerWindow->getWindowHeightScaled()); F32 current_screen_area = 0.f; std::vector<LLPointer<LLHUDText> >::reverse_iterator r_it; for (r_it = sVisibleTextObjects.rbegin(); r_it != sVisibleTextObjects.rend(); ++r_it) diff --git a/indra/newview/llimfloater.cpp b/indra/newview/llimfloater.cpp index a634a1b0fd..5a2331aa06 100644 --- a/indra/newview/llimfloater.cpp +++ b/indra/newview/llimfloater.cpp @@ -363,7 +363,7 @@ LLIMFloater* LLIMFloater::show(const LLUUID& session_id) void LLIMFloater::getAllowedRect(LLRect& rect) { - rect = gViewerWindow->getWorldViewRect(); + rect = gViewerWindow->getWorldViewRectRaw(); } void LLIMFloater::setDocked(bool docked, bool pop_on_undock) diff --git a/indra/newview/llimhandler.cpp b/indra/newview/llimhandler.cpp index 74971f3fd8..524a889f97 100644 --- a/indra/newview/llimhandler.cpp +++ b/indra/newview/llimhandler.cpp @@ -58,7 +58,7 @@ LLIMHandler::~LLIMHandler() //-------------------------------------------------------------------------- void LLIMHandler::initChannel() { - S32 channel_right_bound = gViewerWindow->getWorldViewRect().mRight - gSavedSettings.getS32("NotificationChannelRightMargin"); + S32 channel_right_bound = gViewerWindow->getWorldViewRectRaw().mRight - gSavedSettings.getS32("NotificationChannelRightMargin"); S32 channel_width = gSavedSettings.getS32("NotifyBoxWidth"); mChannel->init(channel_right_bound - channel_width, channel_right_bound); } diff --git a/indra/newview/llmanip.cpp b/indra/newview/llmanip.cpp index f62d7229a3..fa1dbe0603 100644 --- a/indra/newview/llmanip.cpp +++ b/indra/newview/llmanip.cpp @@ -265,8 +265,8 @@ BOOL LLManip::getMousePointOnPlaneGlobal(LLVector3d& point, S32 x, S32 y, LLVect if (mObjectSelection->getSelectType() == SELECT_TYPE_HUD) { BOOL result = FALSE; - F32 mouse_x = ((F32)x / gViewerWindow->getWindowWidth() - 0.5f) * LLViewerCamera::getInstance()->getAspect() / gAgent.mHUDCurZoom; - F32 mouse_y = ((F32)y / gViewerWindow->getWindowHeight() - 0.5f) / gAgent.mHUDCurZoom; + F32 mouse_x = ((F32)x / gViewerWindow->getWindowWidthScaled() - 0.5f) * LLViewerCamera::getInstance()->getAspect() / gAgent.mHUDCurZoom; + F32 mouse_y = ((F32)y / gViewerWindow->getWindowHeightScaled() - 0.5f) / gAgent.mHUDCurZoom; LLVector3 origin_agent = gAgent.getPosAgentFromGlobal(origin); LLVector3 mouse_pos = LLVector3(0.f, -mouse_x, mouse_y); @@ -304,8 +304,8 @@ BOOL LLManip::nearestPointOnLineFromMouse( S32 x, S32 y, const LLVector3& b1, co if (mObjectSelection->getSelectType() == SELECT_TYPE_HUD) { - F32 mouse_x = (((F32)x / gViewerWindow->getWindowWidth()) - 0.5f) * LLViewerCamera::getInstance()->getAspect() / gAgent.mHUDCurZoom; - F32 mouse_y = (((F32)y / gViewerWindow->getWindowHeight()) - 0.5f) / gAgent.mHUDCurZoom; + F32 mouse_x = (((F32)x / gViewerWindow->getWindowWidthScaled()) - 0.5f) * LLViewerCamera::getInstance()->getAspect() / gAgent.mHUDCurZoom; + F32 mouse_y = (((F32)y / gViewerWindow->getWindowHeightScaled()) - 0.5f) / gAgent.mHUDCurZoom; a1 = LLVector3(llmin(b1.mV[VX] - 0.1f, b2.mV[VX] - 0.1f, 0.f), -mouse_x, mouse_y); a2 = a1 + LLVector3(1.f, 0.f, 0.f); } @@ -429,9 +429,9 @@ void LLManip::renderXYZ(const LLVector3 &vec) const S32 PAD = 10; std::string feedback_string; LLVector3 camera_pos = LLViewerCamera::getInstance()->getOrigin() + LLViewerCamera::getInstance()->getAtAxis(); - S32 vertical_offset = gViewerWindow->getWindowHeight() / 2 - VERTICAL_OFFSET; - S32 window_center_x = gViewerWindow->getWindowWidth() / 2; - S32 window_center_y = gViewerWindow->getWindowHeight() / 2; + S32 vertical_offset = gViewerWindow->getWindowHeightScaled() / 2 - VERTICAL_OFFSET; + S32 window_center_x = gViewerWindow->getWindowWidthScaled() / 2; + S32 window_center_y = gViewerWindow->getWindowHeightScaled() / 2; glPushMatrix(); { diff --git a/indra/newview/llmaniprotate.cpp b/indra/newview/llmaniprotate.cpp index c99e67be3f..bcaebb6bbb 100644 --- a/indra/newview/llmaniprotate.cpp +++ b/indra/newview/llmaniprotate.cpp @@ -1107,8 +1107,8 @@ BOOL LLManipRotate::updateVisiblity() mCenterToProfilePlaneMag = mRadiusMeters * mRadiusMeters / mCenterToCamMag; mCenterToProfilePlane = -mCenterToProfilePlaneMag * mCenterToCamNorm; - mCenterScreen.set((S32)((0.5f - mRotationCenter.mdV[VY]) / gAgent.mHUDCurZoom * gViewerWindow->getWorldViewWidth()), - (S32)((mRotationCenter.mdV[VZ] + 0.5f) / gAgent.mHUDCurZoom * gViewerWindow->getWorldViewHeight())); + mCenterScreen.set((S32)((0.5f - mRotationCenter.mdV[VY]) / gAgent.mHUDCurZoom * gViewerWindow->getWorldViewWidthRaw()), + (S32)((mRotationCenter.mdV[VZ] + 0.5f) / gAgent.mHUDCurZoom * gViewerWindow->getWorldViewHeightRaw())); visible = TRUE; } else @@ -1624,8 +1624,8 @@ void LLManipRotate::mouseToRay( S32 x, S32 y, LLVector3* ray_pt, LLVector3* ray_ { if (LLSelectMgr::getInstance()->getSelection()->getSelectType() == SELECT_TYPE_HUD) { - F32 mouse_x = (((F32)x / gViewerWindow->getWorldViewWidth()) - 0.5f) / gAgent.mHUDCurZoom; - F32 mouse_y = ((((F32)y) / gViewerWindow->getWorldViewHeight()) - 0.5f) / gAgent.mHUDCurZoom; + F32 mouse_x = (((F32)x / gViewerWindow->getWorldViewWidthRaw()) - 0.5f) / gAgent.mHUDCurZoom; + F32 mouse_y = ((((F32)y) / gViewerWindow->getWorldViewHeightRaw()) - 0.5f) / gAgent.mHUDCurZoom; *ray_pt = LLVector3(-1.f, -mouse_x, mouse_y); *ray_dir = LLVector3(1.f, 0.f, 0.f); @@ -1699,7 +1699,7 @@ void LLManipRotate::highlightManipulators( S32 x, S32 y ) F32 dist_y = mouse_dir_y.normVec(); F32 dist_z = mouse_dir_z.normVec(); - F32 distance_threshold = (MAX_MANIP_SELECT_DISTANCE * mRadiusMeters) / gViewerWindow->getWorldViewHeight(); + F32 distance_threshold = (MAX_MANIP_SELECT_DISTANCE * mRadiusMeters) / gViewerWindow->getWorldViewHeightRaw(); if (llabs(dist_x - mRadiusMeters) * llmax(0.05f, proj_rot_x_axis) < distance_threshold) { diff --git a/indra/newview/llmanipscale.cpp b/indra/newview/llmanipscale.cpp index 72596e850a..84a5eb7352 100644 --- a/indra/newview/llmanipscale.cpp +++ b/indra/newview/llmanipscale.cpp @@ -493,8 +493,9 @@ void LLManipScale::highlightManipulators(S32 x, S32 y) mProjectedManipulators.insert(projManipulator); } - F32 half_width = (F32)gViewerWindow->getWorldViewWidth() / 2.f; - F32 half_height = (F32)gViewerWindow->getWorldViewHeight() / 2.f; + LLRect world_view_rect = gViewerWindow->getWorldViewRectScaled(); + F32 half_width = (F32)world_view_rect.getWidth() / 2.f; + F32 half_height = (F32)world_view_rect.getHeight() / 2.f; LLVector2 manip2d; LLVector2 mousePos((F32)x - half_width, (F32)y - half_height); LLVector2 delta; @@ -1368,7 +1369,7 @@ void LLManipScale::updateSnapGuides(const LLBBox& bbox) else { F32 object_distance = dist_vec(mScaleCenter, LLViewerCamera::getInstance()->getOrigin()); - mSnapRegimeOffset = (SNAP_GUIDE_SCREEN_OFFSET * gViewerWindow->getWorldViewWidth() * object_distance) / LLViewerCamera::getInstance()->getPixelMeterRatio(); + mSnapRegimeOffset = (SNAP_GUIDE_SCREEN_OFFSET * gViewerWindow->getWorldViewWidthRaw() * object_distance) / LLViewerCamera::getInstance()->getPixelMeterRatio(); } LLVector3 cam_at_axis; F32 snap_guide_length; @@ -1381,7 +1382,7 @@ void LLManipScale::updateSnapGuides(const LLBBox& bbox) { cam_at_axis = LLViewerCamera::getInstance()->getAtAxis(); F32 manipulator_distance = dist_vec(box_corner_agent, LLViewerCamera::getInstance()->getOrigin()); - snap_guide_length = (SNAP_GUIDE_SCREEN_LENGTH * gViewerWindow->getWorldViewWidth() * manipulator_distance) / LLViewerCamera::getInstance()->getPixelMeterRatio(); + snap_guide_length = (SNAP_GUIDE_SCREEN_LENGTH * gViewerWindow->getWorldViewWidthRaw() * manipulator_distance) / LLViewerCamera::getInstance()->getPixelMeterRatio(); } mSnapGuideLength = snap_guide_length / llmax(0.1f, (llmin(mSnapGuideDir1 * cam_at_axis, mSnapGuideDir2 * cam_at_axis))); diff --git a/indra/newview/llmaniptranslate.cpp b/indra/newview/llmaniptranslate.cpp index f1b3a37677..932a3d8a83 100644 --- a/indra/newview/llmaniptranslate.cpp +++ b/indra/newview/llmaniptranslate.cpp @@ -413,8 +413,9 @@ BOOL LLManipTranslate::handleHover(S32 x, S32 y, MASK mask) } // Handle auto-rotation if necessary. + LLRect world_rect = gViewerWindow->getWorldViewRectScaled(); const F32 ROTATE_ANGLE_PER_SECOND = 30.f * DEG_TO_RAD; - const S32 ROTATE_H_MARGIN = gViewerWindow->getWorldViewWidth() / 20; + const S32 ROTATE_H_MARGIN = world_rect.getWidth() / 20; const F32 rotate_angle = ROTATE_ANGLE_PER_SECOND / gFPSClamped; BOOL rotated = FALSE; @@ -426,7 +427,7 @@ BOOL LLManipTranslate::handleHover(S32 x, S32 y, MASK mask) gAgent.cameraOrbitAround(rotate_angle); rotated = TRUE; } - else if (x > gViewerWindow->getWorldViewWidth() - ROTATE_H_MARGIN) + else if (x > world_rect.getWidth() - ROTATE_H_MARGIN) { gAgent.cameraOrbitAround(-rotate_angle); rotated = TRUE; @@ -960,8 +961,9 @@ void LLManipTranslate::highlightManipulators(S32 x, S32 y) LLVector2 manip_start_2d; LLVector2 manip_end_2d; LLVector2 manip_dir; - F32 half_width = gViewerWindow->getWorldViewWidth() / 2.f; - F32 half_height = gViewerWindow->getWorldViewHeight() / 2.f; + LLRect world_view_rect = gViewerWindow->getWorldViewRectScaled(); + F32 half_width = (F32)world_view_rect.getWidth() / 2.f; + F32 half_height = (F32)world_view_rect.getHeight() / 2.f; LLVector2 mousePos((F32)x - half_width, (F32)y - half_height); LLVector2 mouse_delta; @@ -1225,7 +1227,7 @@ void LLManipTranslate::renderSnapGuides() { LLVector3 cam_to_selection = getPivotPoint() - LLViewerCamera::getInstance()->getOrigin(); F32 current_range = cam_to_selection.normVec(); - guide_size_meters = SNAP_GUIDE_SCREEN_SIZE * gViewerWindow->getWorldViewHeight() * current_range / LLViewerCamera::getInstance()->getPixelMeterRatio(); + guide_size_meters = SNAP_GUIDE_SCREEN_SIZE * gViewerWindow->getWorldViewHeightRaw() * current_range / LLViewerCamera::getInstance()->getPixelMeterRatio(); F32 fraction_of_fov = mAxisArrowLength / (F32) LLViewerCamera::getInstance()->getViewHeightInPixels(); F32 apparent_angle = fraction_of_fov * LLViewerCamera::getInstance()->getView(); // radians @@ -1800,7 +1802,7 @@ void LLManipTranslate::renderTranslationHandles() // Drag handles if (mObjectSelection->getSelectType() == SELECT_TYPE_HUD) { - mArrowLengthMeters = mAxisArrowLength / gViewerWindow->getWorldViewHeight(); + mArrowLengthMeters = mAxisArrowLength / gViewerWindow->getWorldViewHeightRaw(); mArrowLengthMeters /= gAgent.mHUDCurZoom; } else diff --git a/indra/newview/llmemoryview.cpp b/indra/newview/llmemoryview.cpp index b3aa67733b..cbe4cef12f 100644 --- a/indra/newview/llmemoryview.cpp +++ b/indra/newview/llmemoryview.cpp @@ -130,8 +130,8 @@ void LLMemoryView::draw() curUpdate++; // setup window properly - S32 height = (S32) (gViewerWindow->getVirtualWindowRect().getHeight()*0.75f); - S32 width = (S32) (gViewerWindow->getVirtualWindowRect().getWidth() * 0.9f); + S32 height = (S32) (gViewerWindow->getWindowRectScaled().getHeight()*0.75f); + S32 width = (S32) (gViewerWindow->getWindowRectScaled().getWidth() * 0.9f); setRect(LLRect().setLeftTopAndSize(getRect().mLeft, getRect().mTop, width, height)); // setup window color diff --git a/indra/newview/llnearbychat.cpp b/indra/newview/llnearbychat.cpp index 974291a54e..ac806d7106 100644 --- a/indra/newview/llnearbychat.cpp +++ b/indra/newview/llnearbychat.cpp @@ -290,7 +290,7 @@ void LLNearbyChat::setRect (const LLRect &rect) void LLNearbyChat::getAllowedRect(LLRect& rect) { - rect = gViewerWindow->getWorldViewRect(); + rect = gViewerWindow->getWorldViewRectRaw(); } diff --git a/indra/newview/llnearbychathandler.cpp b/indra/newview/llnearbychathandler.cpp index 8a8ad9d073..e10c506f08 100644 --- a/indra/newview/llnearbychathandler.cpp +++ b/indra/newview/llnearbychathandler.cpp @@ -122,8 +122,8 @@ protected: void LLNearbyChatScreenChannel::init(S32 channel_left, S32 channel_right) { - S32 channel_top = gViewerWindow->getWorldViewRect().getHeight(); - S32 channel_bottom = gViewerWindow->getWorldViewRect().mBottom; + S32 channel_top = gViewerWindow->getWorldViewRectRaw().getHeight(); + S32 channel_bottom = gViewerWindow->getWorldViewRectRaw().mBottom; setRect(LLRect(channel_left, channel_top, channel_right, channel_bottom)); setVisible(TRUE); } diff --git a/indra/newview/llnotificationalerthandler.cpp b/indra/newview/llnotificationalerthandler.cpp index 1be03cef0b..1f68c76bfc 100644 --- a/indra/newview/llnotificationalerthandler.cpp +++ b/indra/newview/llnotificationalerthandler.cpp @@ -66,7 +66,7 @@ LLAlertHandler::~LLAlertHandler() //-------------------------------------------------------------------------- void LLAlertHandler::initChannel() { - S32 channel_right_bound = gViewerWindow->getWorldViewRect().getWidth() / 2; + S32 channel_right_bound = gViewerWindow->getWorldViewRectRaw().getWidth() / 2; mChannel->init(channel_right_bound, channel_right_bound); } diff --git a/indra/newview/llnotificationgrouphandler.cpp b/indra/newview/llnotificationgrouphandler.cpp index ffa92b543c..fc6fb25644 100644 --- a/indra/newview/llnotificationgrouphandler.cpp +++ b/indra/newview/llnotificationgrouphandler.cpp @@ -57,7 +57,7 @@ LLGroupHandler::~LLGroupHandler() //-------------------------------------------------------------------------- void LLGroupHandler::initChannel() { - S32 channel_right_bound = gViewerWindow->getWorldViewRect().mRight - gSavedSettings.getS32("NotificationChannelRightMargin"); + S32 channel_right_bound = gViewerWindow->getWorldViewRectRaw().mRight - gSavedSettings.getS32("NotificationChannelRightMargin"); S32 channel_width = gSavedSettings.getS32("NotifyBoxWidth"); mChannel->init(channel_right_bound - channel_width, channel_right_bound); } diff --git a/indra/newview/llnotificationofferhandler.cpp b/indra/newview/llnotificationofferhandler.cpp index 75ef5208e7..1bf7be1c4e 100644 --- a/indra/newview/llnotificationofferhandler.cpp +++ b/indra/newview/llnotificationofferhandler.cpp @@ -65,7 +65,7 @@ LLOfferHandler::~LLOfferHandler() //-------------------------------------------------------------------------- void LLOfferHandler::initChannel() { - S32 channel_right_bound = gViewerWindow->getWorldViewRect().mRight - gSavedSettings.getS32("NotificationChannelRightMargin"); + S32 channel_right_bound = gViewerWindow->getWorldViewRectRaw().mRight - gSavedSettings.getS32("NotificationChannelRightMargin"); S32 channel_width = gSavedSettings.getS32("NotifyBoxWidth"); mChannel->init(channel_right_bound - channel_width, channel_right_bound); } diff --git a/indra/newview/llnotificationscripthandler.cpp b/indra/newview/llnotificationscripthandler.cpp index dac7a4ca3a..70b86e8b97 100644 --- a/indra/newview/llnotificationscripthandler.cpp +++ b/indra/newview/llnotificationscripthandler.cpp @@ -64,7 +64,7 @@ LLScriptHandler::~LLScriptHandler() //-------------------------------------------------------------------------- void LLScriptHandler::initChannel() { - S32 channel_right_bound = gViewerWindow->getWorldViewRect().mRight - gSavedSettings.getS32("NotificationChannelRightMargin"); + S32 channel_right_bound = gViewerWindow->getWorldViewRectRaw().mRight - gSavedSettings.getS32("NotificationChannelRightMargin"); S32 channel_width = gSavedSettings.getS32("NotifyBoxWidth"); mChannel->init(channel_right_bound - channel_width, channel_right_bound); } diff --git a/indra/newview/llnotificationtiphandler.cpp b/indra/newview/llnotificationtiphandler.cpp index 543198c1d2..823c92a94e 100644 --- a/indra/newview/llnotificationtiphandler.cpp +++ b/indra/newview/llnotificationtiphandler.cpp @@ -60,7 +60,7 @@ LLTipHandler::~LLTipHandler() //-------------------------------------------------------------------------- void LLTipHandler::initChannel() { - S32 channel_right_bound = gViewerWindow->getWorldViewRect().mRight - gSavedSettings.getS32("NotificationChannelRightMargin"); + S32 channel_right_bound = gViewerWindow->getWorldViewRectRaw().mRight - gSavedSettings.getS32("NotificationChannelRightMargin"); S32 channel_width = gSavedSettings.getS32("NotifyBoxWidth"); mChannel->init(channel_right_bound - channel_width, channel_right_bound); } diff --git a/indra/newview/llpanellogin.cpp b/indra/newview/llpanellogin.cpp index 5d826f0a56..b3e14eb2fb 100644 --- a/indra/newview/llpanellogin.cpp +++ b/indra/newview/llpanellogin.cpp @@ -310,7 +310,7 @@ LLPanelLogin::LLPanelLogin(const LLRect &rect, void LLPanelLogin::reshapeBrowser() { LLMediaCtrl* web_browser = getChild<LLMediaCtrl>("login_html"); - LLRect rect = gViewerWindow->getVirtualWindowRect(); + LLRect rect = gViewerWindow->getWindowRectScaled(); LLRect html_rect; #if USE_VIEWER_AUTH html_rect.setCenterAndSize( diff --git a/indra/newview/llpanelprimmediacontrols.cpp b/indra/newview/llpanelprimmediacontrols.cpp index d33fcc5512..5c3c260549 100644 --- a/indra/newview/llpanelprimmediacontrols.cpp +++ b/indra/newview/llpanelprimmediacontrols.cpp @@ -561,12 +561,12 @@ void LLPanelPrimMediaControls::updateShape() } LLCoordGL screen_min; - screen_min.mX = llround((F32)gViewerWindow->getWorldViewWidth() * (min.mV[VX] + 1.f) * 0.5f); - screen_min.mY = llround((F32)gViewerWindow->getWorldViewHeight() * (min.mV[VY] + 1.f) * 0.5f); + screen_min.mX = llround((F32)gViewerWindow->getWorldViewWidthRaw() * (min.mV[VX] + 1.f) * 0.5f); + screen_min.mY = llround((F32)gViewerWindow->getWorldViewHeightRaw() * (min.mV[VY] + 1.f) * 0.5f); LLCoordGL screen_max; - screen_max.mX = llround((F32)gViewerWindow->getWorldViewWidth() * (max.mV[VX] + 1.f) * 0.5f); - screen_max.mY = llround((F32)gViewerWindow->getWorldViewHeight() * (max.mV[VY] + 1.f) * 0.5f); + screen_max.mX = llround((F32)gViewerWindow->getWorldViewWidthRaw() * (max.mV[VX] + 1.f) * 0.5f); + screen_max.mY = llround((F32)gViewerWindow->getWorldViewHeightRaw() * (max.mV[VY] + 1.f) * 0.5f); // grow panel so that screenspace bounding box fits inside "media_region" element of HUD LLRect media_controls_rect; diff --git a/indra/newview/llpreview.cpp b/indra/newview/llpreview.cpp index 34e78b5c46..c95882931b 100644 --- a/indra/newview/llpreview.cpp +++ b/indra/newview/llpreview.cpp @@ -454,7 +454,7 @@ LLMultiPreview::LLMultiPreview() { // start with a rect in the top-left corner ; will get resized LLRect rect; - rect.setLeftTopAndSize(0, gViewerWindow->getWindowHeight(), 200, 200); + rect.setLeftTopAndSize(0, gViewerWindow->getWindowHeightScaled(), 200, 200); setRect(rect); } setTitle(LLTrans::getString("MultiPreviewTitle")); diff --git a/indra/newview/llpreviewtexture.cpp b/indra/newview/llpreviewtexture.cpp index 3eab13fc4a..13d02b7dec 100644 --- a/indra/newview/llpreviewtexture.cpp +++ b/indra/newview/llpreviewtexture.cpp @@ -394,8 +394,8 @@ void LLPreviewTexture::updateDimensions() S32 client_height = image_height; S32 horiz_pad = 2 * (LLPANEL_BORDER_WIDTH + PREVIEW_PAD) + PREVIEW_RESIZE_HANDLE_SIZE; S32 vert_pad = PREVIEW_HEADER_SIZE + 2 * CLIENT_RECT_VPAD + LLPANEL_BORDER_WIDTH; - S32 max_client_width = gViewerWindow->getWindowWidth() - horiz_pad; - S32 max_client_height = gViewerWindow->getWindowHeight() - vert_pad; + S32 max_client_width = gViewerWindow->getWindowWidthScaled() - horiz_pad; + S32 max_client_height = gViewerWindow->getWindowHeightScaled() - vert_pad; if (mAspectRatio > 0.f) { diff --git a/indra/newview/llscreenchannel.cpp b/indra/newview/llscreenchannel.cpp index e4dbcbd219..b667fbf5fd 100644 --- a/indra/newview/llscreenchannel.cpp +++ b/indra/newview/llscreenchannel.cpp @@ -103,8 +103,8 @@ void LLScreenChannelBase::updatePositionAndSize(LLRect old_world_rect, LLRect ne void LLScreenChannelBase::init(S32 channel_left, S32 channel_right) { - S32 channel_top = gViewerWindow->getWorldViewRect().getHeight(); - S32 channel_bottom = gViewerWindow->getWorldViewRect().mBottom + gSavedSettings.getS32("ChannelBottomPanelMargin"); + S32 channel_top = gViewerWindow->getWorldViewRectRaw().getHeight(); + S32 channel_bottom = gViewerWindow->getWorldViewRectRaw().mBottom + gSavedSettings.getS32("ChannelBottomPanelMargin"); setRect(LLRect(channel_left, channel_top, channel_right, channel_bottom)); setVisible(TRUE); } @@ -706,7 +706,7 @@ void LLScreenChannel::updateShowToastsState() // for Message Well floater showed in a docked state - adjust channel's height if(dynamic_cast<LLSysWellWindow*>(floater)) { - S32 channel_bottom = gViewerWindow->getWorldViewRect().mBottom + gSavedSettings.getS32("ChannelBottomPanelMargin");; + S32 channel_bottom = gViewerWindow->getWorldViewRectRaw().mBottom + gSavedSettings.getS32("ChannelBottomPanelMargin");; LLRect this_rect = getRect(); if(floater->getVisible() && floater->isDocked()) { diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index 2c1f468f77..25729c91e6 100644 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -1386,7 +1386,7 @@ bool idle_startup() // Make sure agent knows correct aspect ratio // FOV limits depend upon aspect ratio so this needs to happen before initializing the FOV below - LLViewerCamera::getInstance()->setViewHeightInPixels(gViewerWindow->getWorldViewHeight()); + LLViewerCamera::getInstance()->setViewHeightInPixels(gViewerWindow->getWorldViewHeightRaw()); LLViewerCamera::getInstance()->setAspect(gViewerWindow->getWorldViewAspectRatio()); // Initialize FOV LLViewerCamera::getInstance()->setDefaultFOV(gSavedSettings.getF32("CameraAngle")); @@ -2122,7 +2122,7 @@ void login_show() BOOL bUseDebugLogin = TRUE; #endif - LLPanelLogin::show( gViewerWindow->getVirtualWindowRect(), + LLPanelLogin::show( gViewerWindow->getWindowRectScaled(), bUseDebugLogin, login_callback, NULL ); diff --git a/indra/newview/llsyswellwindow.cpp b/indra/newview/llsyswellwindow.cpp index 723ac0fc33..4422c4b672 100644 --- a/indra/newview/llsyswellwindow.cpp +++ b/indra/newview/llsyswellwindow.cpp @@ -238,7 +238,7 @@ void LLSysWellWindow::initChannel() //--------------------------------------------------------------------------------- void LLSysWellWindow::getAllowedRect(LLRect& rect) { - rect = gViewerWindow->getWorldViewRect(); + rect = gViewerWindow->getWorldViewRectRaw(); } //--------------------------------------------------------------------------------- diff --git a/indra/newview/lltoolbar.cpp b/indra/newview/lltoolbar.cpp index 0572f9a698..268a18d2a2 100644 --- a/indra/newview/lltoolbar.cpp +++ b/indra/newview/lltoolbar.cpp @@ -206,7 +206,7 @@ void LLToolBar::layoutButtons() { #if LL_DARWIN const S32 FUDGE_WIDTH_OF_SCREEN = 4; - S32 width = gViewerWindow->getWindowWidth() + FUDGE_WIDTH_OF_SCREEN; + S32 width = gViewerWindow->getWindowWidthScaled() + FUDGE_WIDTH_OF_SCREEN; S32 pad = 2; // this function may be called before postBuild(), in which case mResizeHandle won't have been set up yet. diff --git a/indra/newview/lltoolfocus.cpp b/indra/newview/lltoolfocus.cpp index 9400840bdf..e2ccc05e30 100644 --- a/indra/newview/lltoolfocus.cpp +++ b/indra/newview/lltoolfocus.cpp @@ -365,7 +365,7 @@ BOOL LLToolCamera::handleHover(S32 x, S32 y, MASK mask) // Orbit tool if (hasMouseCapture()) { - const F32 RADIANS_PER_PIXEL = 360.f * DEG_TO_RAD / gViewerWindow->getWorldViewWidth(); + const F32 RADIANS_PER_PIXEL = 360.f * DEG_TO_RAD / gViewerWindow->getWorldViewWidthRaw(); if (dx != 0) { @@ -393,7 +393,7 @@ BOOL LLToolCamera::handleHover(S32 x, S32 y, MASK mask) F32 dist = (F32) camera_to_focus.normVec(); // Fudge factor for pan - F32 meters_per_pixel = 3.f * dist / gViewerWindow->getWorldViewWidth(); + F32 meters_per_pixel = 3.f * dist / gViewerWindow->getWorldViewWidthRaw(); if (dx != 0) { @@ -415,7 +415,7 @@ BOOL LLToolCamera::handleHover(S32 x, S32 y, MASK mask) if (hasMouseCapture()) { - const F32 RADIANS_PER_PIXEL = 360.f * DEG_TO_RAD / gViewerWindow->getWorldViewWidth(); + const F32 RADIANS_PER_PIXEL = 360.f * DEG_TO_RAD / gViewerWindow->getWorldViewWidthRaw(); if (dx != 0) { diff --git a/indra/newview/lltoolgrab.cpp b/indra/newview/lltoolgrab.cpp index b7a97562bd..44fb6e9271 100644 --- a/indra/newview/lltoolgrab.cpp +++ b/indra/newview/lltoolgrab.cpp @@ -510,8 +510,8 @@ void LLToolGrab::handleHoverActive(S32 x, S32 y, MASK mask) const F32 RADIANS_PER_PIXEL_X = 0.01f; const F32 RADIANS_PER_PIXEL_Y = 0.01f; - S32 dx = x - (gViewerWindow->getWorldViewWidth() / 2); - S32 dy = y - (gViewerWindow->getWorldViewHeight() / 2); + S32 dx = x - (gViewerWindow->getWorldViewWidthRaw() / 2); + S32 dy = y - (gViewerWindow->getWorldViewHeightRaw() / 2); if (dx != 0 || dy != 0) { @@ -631,10 +631,10 @@ void LLToolGrab::handleHoverActive(S32 x, S32 y, MASK mask) // Handle auto-rotation at screen edge. LLVector3 grab_pos_agent = gAgent.getPosAgentFromGlobal( grab_point_global ); - LLCoordGL grab_center_gl( gViewerWindow->getWorldViewWidth() / 2, gViewerWindow->getWorldViewHeight() / 2); + LLCoordGL grab_center_gl( gViewerWindow->getWorldViewWidthRaw() / 2, gViewerWindow->getWorldViewHeightRaw() / 2); LLViewerCamera::getInstance()->projectPosAgentToScreen(grab_pos_agent, grab_center_gl); - const S32 ROTATE_H_MARGIN = gViewerWindow->getWorldViewWidth() / 20; + const S32 ROTATE_H_MARGIN = gViewerWindow->getWorldViewWidthRaw() / 20; const F32 ROTATE_ANGLE_PER_SECOND = 30.f * DEG_TO_RAD; const F32 rotate_angle = ROTATE_ANGLE_PER_SECOND / gFPSClamped; // ...build mode moves camera about focus point @@ -649,7 +649,7 @@ void LLToolGrab::handleHoverActive(S32 x, S32 y, MASK mask) gAgent.cameraOrbitAround(rotate_angle); } } - else if (grab_center_gl.mX > gViewerWindow->getWorldViewWidth() - ROTATE_H_MARGIN) + else if (grab_center_gl.mX > gViewerWindow->getWorldViewWidthRaw() - ROTATE_H_MARGIN) { if (gAgent.getFocusOnAvatar()) { @@ -662,7 +662,7 @@ void LLToolGrab::handleHoverActive(S32 x, S32 y, MASK mask) } // Don't move above top of screen or below bottom - if ((grab_center_gl.mY < gViewerWindow->getWorldViewHeight() - 6) + if ((grab_center_gl.mY < gViewerWindow->getWorldViewHeightRaw() - 6) && (grab_center_gl.mY > 24)) { // Transmit update to simulator @@ -893,7 +893,7 @@ void LLToolGrab::handleHoverInactive(S32 x, S32 y, MASK mask) gAgent.yaw(rotate_angle); //gAgent.setControlFlags(AGENT_CONTROL_YAW_POS); } - else if (x == (gViewerWindow->getWorldViewWidth() - 1) ) + else if (x == (gViewerWindow->getWorldViewWidthRaw() - 1) ) { gAgent.yaw(-rotate_angle); //gAgent.setControlFlags(AGENT_CONTROL_YAW_NEG); diff --git a/indra/newview/lltoolgun.cpp b/indra/newview/lltoolgun.cpp index 53d71a42cf..a441d653c7 100644 --- a/indra/newview/lltoolgun.cpp +++ b/indra/newview/lltoolgun.cpp @@ -140,7 +140,7 @@ void LLToolGun::draw() { LLUIImagePtr crosshair = LLUI::getUIImage("crosshairs.tga"); crosshair->draw( - ( gViewerWindow->getVirtualWorldViewRect().getWidth() - crosshair->getWidth() ) / 2, - ( gViewerWindow->getVirtualWorldViewRect().getHeight() - crosshair->getHeight() ) / 2); + ( gViewerWindow->getWorldViewRectScaled().getWidth() - crosshair->getWidth() ) / 2, + ( gViewerWindow->getWorldViewRectScaled().getHeight() - crosshair->getHeight() ) / 2); } } diff --git a/indra/newview/llviewercamera.cpp b/indra/newview/llviewercamera.cpp index b5709fa102..5566fea89f 100644 --- a/indra/newview/llviewercamera.cpp +++ b/indra/newview/llviewercamera.cpp @@ -401,10 +401,10 @@ void LLViewerCamera::setPerspective(BOOL for_selection, if (for_selection && (width > 1 || height > 1)) { - calculateFrustumPlanesFromWindow((F32)(x - width / 2) / (F32)gViewerWindow->getWindowWidth() - 0.5f, - (F32)(y_from_bot - height / 2) / (F32)gViewerWindow->getWindowHeight() - 0.5f, - (F32)(x + width / 2) / (F32)gViewerWindow->getWindowWidth() - 0.5f, - (F32)(y_from_bot + height / 2) / (F32)gViewerWindow->getWindowHeight() - 0.5f); + calculateFrustumPlanesFromWindow((F32)(x - width / 2) / (F32)gViewerWindow->getWindowWidthScaled() - 0.5f, + (F32)(y_from_bot - height / 2) / (F32)gViewerWindow->getWindowHeightScaled() - 0.5f, + (F32)(x + width / 2) / (F32)gViewerWindow->getWindowWidthScaled() - 0.5f, + (F32)(y_from_bot + height / 2) / (F32)gViewerWindow->getWindowHeightScaled() - 0.5f); } @@ -469,7 +469,7 @@ BOOL LLViewerCamera::projectPosAgentToScreen(const LLVector3 &pos_agent, LLCoord } } - LLRect world_view_rect = gViewerWindow->getWorldViewRect(); + LLRect world_view_rect = gViewerWindow->getWorldViewRectRaw(); S32 viewport[4]; viewport[0] = world_view_rect.mLeft; viewport[1] = world_view_rect.mBottom; @@ -485,7 +485,7 @@ BOOL LLViewerCamera::projectPosAgentToScreen(const LLVector3 &pos_agent, LLCoord y /= gViewerWindow->getDisplayScale().mV[VY]; // should now have the x,y coords of grab_point in screen space - LLRect world_view_rect = gViewerWindow->getVirtualWorldViewRect(); + LLRect world_view_rect = gViewerWindow->getWorldViewRectScaled(); // convert to pixel coordinates S32 int_x = lltrunc(x); @@ -572,7 +572,7 @@ BOOL LLViewerCamera::projectPosAgentToScreenEdge(const LLVector3 &pos_agent, in_front = FALSE; } - LLRect world_view_rect = gViewerWindow->getWorldViewRect(); + LLRect world_view_rect = gViewerWindow->getWorldViewRectRaw(); S32 viewport[4]; viewport[0] = world_view_rect.mLeft; viewport[1] = world_view_rect.mBottom; @@ -587,7 +587,7 @@ BOOL LLViewerCamera::projectPosAgentToScreenEdge(const LLVector3 &pos_agent, x /= gViewerWindow->getDisplayScale().mV[VX]; y /= gViewerWindow->getDisplayScale().mV[VY]; // should now have the x,y coords of grab_point in screen space - const LLRect& world_rect = gViewerWindow->getVirtualWorldViewRect(); + const LLRect& world_rect = gViewerWindow->getWorldViewRectScaled(); // ...sanity check S32 int_x = lltrunc(x); diff --git a/indra/newview/llviewerdisplay.cpp b/indra/newview/llviewerdisplay.cpp index e0bb8fedeb..5b733ed817 100644 --- a/indra/newview/llviewerdisplay.cpp +++ b/indra/newview/llviewerdisplay.cpp @@ -782,10 +782,10 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) // LLRect floater_rect = frontmost_floaterp->calcScreenRect(); // // deflate by one pixel so rounding errors don't occlude outside of floater extents // floater_rect.stretch(-1); - // LLRectf floater_3d_rect((F32)floater_rect.mLeft / (F32)gViewerWindow->getWindowWidth(), - // (F32)floater_rect.mTop / (F32)gViewerWindow->getWindowHeight(), - // (F32)floater_rect.mRight / (F32)gViewerWindow->getWindowWidth(), - // (F32)floater_rect.mBottom / (F32)gViewerWindow->getWindowHeight()); + // LLRectf floater_3d_rect((F32)floater_rect.mLeft / (F32)gViewerWindow->getWindowWidthScaled(), + // (F32)floater_rect.mTop / (F32)gViewerWindow->getWindowHeightScaled(), + // (F32)floater_rect.mRight / (F32)gViewerWindow->getWindowWidthScaled(), + // (F32)floater_rect.mBottom / (F32)gViewerWindow->getWindowHeightScaled()); // floater_3d_rect.translate(-0.5f, -0.5f); // glTranslatef(0.f, 0.f, -LLViewerCamera::getInstance()->getNear()); // glScalef(LLViewerCamera::getInstance()->getNear() * LLViewerCamera::getInstance()->getAspect() / sinf(LLViewerCamera::getInstance()->getView()), LLViewerCamera::getInstance()->getNear() / sinf(LLViewerCamera::getInstance()->getView()), 1.f); @@ -874,7 +874,7 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) /// and then display it again with compositor effects. /// Using render to texture would be faster/better, but I don't have a /// grasp of their full display stack just yet. - // gPostProcess->apply(gViewerWindow->getWindowDisplayWidth(), gViewerWindow->getWindowDisplayHeight()); + // gPostProcess->apply(gViewerWindow->getWindowWidthRaw(), gViewerWindow->getWindowHeightRaw()); if (LLPipeline::sRenderDeferred && !LLPipeline::sUnderWaterRender) { @@ -1011,7 +1011,7 @@ void render_hud_attachments() BOOL setup_hud_matrices() { - LLRect whole_screen = gViewerWindow->getVirtualWindowRect(); + LLRect whole_screen = gViewerWindow->getWindowRectScaled(); // apply camera zoom transform (for high res screenshots) F32 zoom_factor = LLViewerCamera::getInstance()->getZoomFactor(); @@ -1019,13 +1019,13 @@ BOOL setup_hud_matrices() if (zoom_factor > 1.f) { S32 num_horizontal_tiles = llceil(zoom_factor); - S32 tile_width = llround((F32)gViewerWindow->getWindowWidth() / zoom_factor); - S32 tile_height = llround((F32)gViewerWindow->getWindowHeight() / zoom_factor); + S32 tile_width = llround((F32)gViewerWindow->getWindowWidthScaled() / zoom_factor); + S32 tile_height = llround((F32)gViewerWindow->getWindowHeightScaled() / zoom_factor); int tile_y = sub_region / num_horizontal_tiles; int tile_x = sub_region - (tile_y * num_horizontal_tiles); glh::matrix4f mat; - whole_screen.setLeftTopAndSize(tile_x * tile_width, gViewerWindow->getWindowHeight() - (tile_y * tile_height), tile_width, tile_height); + whole_screen.setLeftTopAndSize(tile_x * tile_width, gViewerWindow->getWindowHeightScaled() - (tile_y * tile_height), tile_width, tile_height); } return setup_hud_matrices(whole_screen); @@ -1048,12 +1048,12 @@ BOOL setup_hud_matrices(const LLRect& screen_region) F32 aspect_ratio = LLViewerCamera::getInstance()->getAspect(); glh::matrix4f mat; - F32 scale_x = (F32)gViewerWindow->getWindowWidth() / (F32)screen_region.getWidth(); - F32 scale_y = (F32)gViewerWindow->getWindowHeight() / (F32)screen_region.getHeight(); + F32 scale_x = (F32)gViewerWindow->getWindowWidthScaled() / (F32)screen_region.getWidth(); + F32 scale_y = (F32)gViewerWindow->getWindowHeightScaled() / (F32)screen_region.getHeight(); mat.set_scale(glh::vec3f(scale_x, scale_y, 1.f)); mat.set_translate( - glh::vec3f(clamp_rescale((F32)screen_region.getCenterX(), 0.f, (F32)gViewerWindow->getWindowWidth(), 0.5f * scale_x * aspect_ratio, -0.5f * scale_x * aspect_ratio), - clamp_rescale((F32)screen_region.getCenterY(), 0.f, (F32)gViewerWindow->getWindowHeight(), 0.5f * scale_y, -0.5f * scale_y), + glh::vec3f(clamp_rescale((F32)screen_region.getCenterX(), 0.f, (F32)gViewerWindow->getWindowWidthScaled(), 0.5f * scale_x * aspect_ratio, -0.5f * scale_x * aspect_ratio), + clamp_rescale((F32)screen_region.getCenterY(), 0.f, (F32)gViewerWindow->getWindowHeightScaled(), 0.5f * scale_y, -0.5f * scale_y), 0.f)); proj *= mat; @@ -1269,8 +1269,8 @@ void render_ui_2d() int pos_y = sub_region / llceil(zoom_factor); int pos_x = sub_region - (pos_y*llceil(zoom_factor)); // offset for this tile - LLFontGL::sCurOrigin.mX -= llround((F32)gViewerWindow->getWindowWidth() * (F32)pos_x / zoom_factor); - LLFontGL::sCurOrigin.mY -= llround((F32)gViewerWindow->getWindowHeight() * (F32)pos_y / zoom_factor); + LLFontGL::sCurOrigin.mX -= llround((F32)gViewerWindow->getWindowWidthScaled() * (F32)pos_x / zoom_factor); + LLFontGL::sCurOrigin.mY -= llround((F32)gViewerWindow->getWindowHeightScaled() * (F32)pos_y / zoom_factor); } stop_glerror(); @@ -1280,8 +1280,8 @@ void render_ui_2d() if (gAgent.getAvatarObject() && gAgent.mHUDCurZoom < 0.98f) { glPushMatrix(); - S32 half_width = (gViewerWindow->getWindowWidth() / 2); - S32 half_height = (gViewerWindow->getWindowHeight() / 2); + S32 half_width = (gViewerWindow->getWindowWidthScaled() / 2); + S32 half_height = (gViewerWindow->getWindowHeightScaled() / 2); glScalef(LLUI::sGLScaleFactor.mV[0], LLUI::sGLScaleFactor.mV[1], 1.f); glTranslatef((F32)half_width, (F32)half_height, 0.f); F32 zoom = gAgent.mHUDCurZoom; @@ -1341,8 +1341,8 @@ void render_ui_2d() LLGLDisable cull(GL_CULL_FACE); LLGLDisable blend(GL_BLEND); - S32 width = gViewerWindow->getWindowWidth(); - S32 height = gViewerWindow->getWindowHeight(); + S32 width = gViewerWindow->getWindowWidthScaled(); + S32 height = gViewerWindow->getWindowHeightScaled(); gGL.getTexUnit(0)->bind(&gPipeline.mUIScreen); gGL.begin(LLRender::TRIANGLE_STRIP); gGL.color4f(1,1,1,1); @@ -1411,8 +1411,8 @@ void render_disconnected_background() } // Make sure the progress view always fills the entire window. - S32 width = gViewerWindow->getWindowWidth(); - S32 height = gViewerWindow->getWindowHeight(); + S32 width = gViewerWindow->getWindowWidthScaled(); + S32 height = gViewerWindow->getWindowHeightScaled(); if (gDisconnectedImagep) { diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index 97879046a0..820f709ba5 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -3797,7 +3797,7 @@ class LLViewDefaultUISize : public view_listener_t { gSavedSettings.setF32("UIScaleFactor", 1.0f); gSavedSettings.setBOOL("UIAutoScale", FALSE); - gViewerWindow->reshape(gViewerWindow->getWindowDisplayWidth(), gViewerWindow->getWindowDisplayHeight()); + gViewerWindow->reshape(gViewerWindow->getWindowWidthRaw(), gViewerWindow->getWindowHeightRaw()); return true; } }; diff --git a/indra/newview/llviewermenufile.cpp b/indra/newview/llviewermenufile.cpp index d17c7e486f..753acab172 100644 --- a/indra/newview/llviewermenufile.cpp +++ b/indra/newview/llviewermenufile.cpp @@ -404,8 +404,8 @@ class LLFileTakeSnapshotToDisk : public view_listener_t { LLPointer<LLImageRaw> raw = new LLImageRaw; - S32 width = gViewerWindow->getWindowDisplayWidth(); - S32 height = gViewerWindow->getWindowDisplayHeight(); + S32 width = gViewerWindow->getWindowWidthRaw(); + S32 height = gViewerWindow->getWindowHeightRaw(); if (gSavedSettings.getBOOL("HighResSnapshot")) { diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index ea1097c477..a90790c59a 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -4338,7 +4338,7 @@ void process_alert_core(const std::string& message, BOOL modal) std::string snap_filename = gDirUtilp->getLindenUserDir(); snap_filename += gDirUtilp->getDirDelimiter(); snap_filename += SCREEN_HOME_FILENAME; - gViewerWindow->saveSnapshot(snap_filename, gViewerWindow->getWindowDisplayWidth(), gViewerWindow->getWindowDisplayHeight(), FALSE, FALSE); + gViewerWindow->saveSnapshot(snap_filename, gViewerWindow->getWindowWidthRaw(), gViewerWindow->getWindowHeightRaw(), FALSE, FALSE); } const std::string ALERT_PREFIX("ALERT: "); diff --git a/indra/newview/llviewerstats.cpp b/indra/newview/llviewerstats.cpp index caa94dba38..939d5e3970 100644 --- a/indra/newview/llviewerstats.cpp +++ b/indra/newview/llviewerstats.cpp @@ -822,8 +822,8 @@ void send_stats() // Screen size so the UI team can figure out how big the widgets // appear and use a "typical" size for end user tests. - S32 window_width = gViewerWindow->getWindowDisplayWidth(); - S32 window_height = gViewerWindow->getWindowDisplayHeight(); + S32 window_width = gViewerWindow->getWindowWidthRaw(); + S32 window_height = gViewerWindow->getWindowHeightRaw(); S32 window_size = (window_width * window_height) / 1024; misc["string_1"] = llformat("%d", window_size); // misc["string_2"] = diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index 29ce2510f2..6b0f8814b9 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -315,7 +315,7 @@ public: mTextColor = LLColor4( 0.86f, 0.86f, 0.86f, 1.f ); // Draw stuff growing up from right lower corner of screen - U32 xpos = mWindow->getWindowWidth() - 350; + U32 xpos = mWindow->getWindowWidthScaled() - 350; U32 ypos = 64; const U32 y_inc = 20; @@ -600,8 +600,8 @@ void LLViewerWindow::updateDebugText() BOOL LLViewerWindow::handleAnyMouseClick(LLWindow *window, LLCoordGL pos, MASK mask, LLMouseHandler::EClickType clicktype, BOOL down) { - std::string buttonname; - std::string buttonstatestr; + const char* buttonname = ""; + const char* buttonstatestr = ""; BOOL handled = FALSE; S32 x = pos.mX; S32 y = pos.mY; @@ -1196,9 +1196,9 @@ LLViewerWindow::LLViewerWindow( mActive(TRUE), mWantFullscreen(fullscreen), mShowFullscreenProgress(FALSE), - mWindowRect(0, height, width, 0), - mVirtualWindowRect(0, height, width, 0), - mWorldViewRect(0, height, width, 0), + mWindowRectRaw(0, height, width, 0), + mWindowRectScaled(0, height, width, 0), + mWorldViewRectRaw(0, height, width, 0), mLeftMouseDown(FALSE), mMiddleMouseDown(FALSE), mRightMouseDown(FALSE), @@ -1267,8 +1267,8 @@ LLViewerWindow::LLViewerWindow( { LLCoordWindow size; mWindow->getSize(&size); - mWindowRect.set(0, size.mY, size.mX, 0); - mVirtualWindowRect.set(0, llround((F32)size.mY / mDisplayScale.mV[VY]), llround((F32)size.mX / mDisplayScale.mV[VX]), 0); + mWindowRectRaw.set(0, size.mY, size.mX, 0); + mWindowRectScaled.set(0, llround((F32)size.mY / mDisplayScale.mV[VY]), llround((F32)size.mX / mDisplayScale.mV[VX]), 0); } LLFontManager::initClass(); @@ -1324,15 +1324,15 @@ LLViewerWindow::LLViewerWindow( // Create container for all sub-views LLView::Params rvp; rvp.name("root"); - rvp.rect(mVirtualWindowRect); + rvp.rect(mWindowRectScaled); rvp.mouse_opaque(false); rvp.follows.flags(FOLLOWS_NONE); mRootView = LLUICtrlFactory::create<LLRootView>(rvp); LLUI::setRootView(mRootView); // Make avatar head look forward at start - mCurrentMousePoint.mX = getWindowWidth() / 2; - mCurrentMousePoint.mY = getWindowHeight() / 2; + mCurrentMousePoint.mX = getWindowWidthScaled() / 2; + mCurrentMousePoint.mY = getWindowHeightScaled() / 2; gShowOverlayTitle = gSavedSettings.getBOOL("ShowOverlayTitle"); mOverlayTitle = gSavedSettings.getString("OverlayTitle"); @@ -1383,8 +1383,8 @@ struct MainPanel : public LLPanel void LLViewerWindow::initBase() { - S32 height = getWindowHeight(); - S32 width = getWindowWidth(); + S32 height = getWindowHeightScaled(); + S32 width = getWindowWidthScaled(); LLRect full_window(0, height, width, 0); @@ -1709,8 +1709,8 @@ void LLViewerWindow::sendShapeToSim() msg->addU32Fast(_PREHASH_CircuitCode, gMessageSystem->mOurCircuitCode); msg->nextBlockFast(_PREHASH_HeightWidthBlock); msg->addU32Fast(_PREHASH_GenCounter, 0); - U16 height16 = (U16) mWorldViewRect.getHeight(); - U16 width16 = (U16) mWorldViewRect.getWidth(); + U16 height16 = (U16) mWorldViewRectRaw.getHeight(); + U16 width16 = (U16) mWorldViewRectRaw.getWidth(); msg->addU16Fast(_PREHASH_Height, height16); msg->addU16Fast(_PREHASH_Width, width16); gAgent.sendReliableMessage(); @@ -1732,14 +1732,14 @@ void LLViewerWindow::reshape(S32 width, S32 height) } // update our window rectangle - mWindowRect.mRight = mWindowRect.mLeft + width; - mWindowRect.mTop = mWindowRect.mBottom + height; + mWindowRectRaw.mRight = mWindowRectRaw.mLeft + width; + mWindowRectRaw.mTop = mWindowRectRaw.mBottom + height; //glViewport(0, 0, width, height ); if (height > 0) { - LLViewerCamera::getInstance()->setViewHeightInPixels( mWorldViewRect.getHeight() ); + LLViewerCamera::getInstance()->setViewHeightInPixels( mWorldViewRectRaw.getHeight() ); LLViewerCamera::getInstance()->setAspect( getWorldViewAspectRatio() ); } @@ -1749,8 +1749,8 @@ void LLViewerWindow::reshape(S32 width, S32 height) LLUI::setScaleFactor(mDisplayScale); // update our window rectangle - mVirtualWindowRect.mRight = mVirtualWindowRect.mLeft + llround((F32)width / mDisplayScale.mV[VX]); - mVirtualWindowRect.mTop = mVirtualWindowRect.mBottom + llround((F32)height / mDisplayScale.mV[VY]); + mWindowRectScaled.mRight = mWindowRectScaled.mLeft + llround((F32)width / mDisplayScale.mV[VX]); + mWindowRectScaled.mTop = mWindowRectScaled.mBottom + llround((F32)height / mDisplayScale.mV[VY]); setup2DViewport(); @@ -1892,7 +1892,7 @@ void LLViewerWindow::draw() if (!gSavedSettings.getBOOL("RenderUIBuffer")) { - LLUI::sDirtyRect = this->getWindowRect(); + LLUI::sDirtyRect = this->getWindowRectRaw(); } // HACK for timecode debugging @@ -1906,8 +1906,8 @@ void LLViewerWindow::draw() microsecondsToTimecodeString(gFrameTime,text); const LLFontGL* font = LLFontGL::getFontSansSerif(); font->renderUTF8(text, 0, - llround((getWindowWidth()/2)-100.f), - llround((getWindowHeight()-60.f)), + llround((getWindowWidthScaled()/2)-100.f), + llround((getWindowHeightScaled()-60.f)), LLColor4( 1.f, 1.f, 1.f, 1.f ), LLFontGL::LEFT, LLFontGL::TOP); } @@ -1930,8 +1930,8 @@ void LLViewerWindow::draw() int pos_y = sub_region / llceil(zoom_factor); int pos_x = sub_region - (pos_y*llceil(zoom_factor)); // offset for this tile - glTranslatef((F32)getWindowWidth() * -(F32)pos_x, - (F32)getWindowHeight() * -(F32)pos_y, + glTranslatef((F32)getWindowWidthScaled() * -(F32)pos_x, + (F32)getWindowHeightScaled() * -(F32)pos_y, 0.f); glScalef(zoom_factor, zoom_factor, 1.f); LLUI::sGLScaleFactor *= zoom_factor; @@ -1976,8 +1976,8 @@ void LLViewerWindow::draw() const S32 DIST_FROM_TOP = 20; LLFontGL::getFontSansSerifBig()->renderUTF8( mOverlayTitle, 0, - llround( getWindowWidth() * 0.5f), - getWindowHeight() - DIST_FROM_TOP, + llround( getWindowWidthScaled() * 0.5f), + getWindowHeightScaled() - DIST_FROM_TOP, LLColor4(1, 1, 1, 0.4f), LLFontGL::HCENTER, LLFontGL::TOP); } @@ -2277,7 +2277,7 @@ void LLViewerWindow::handleScrollWheel(S32 clicks) // Zoom the camera in and out behavior - if(top_ctrl == 0 && mWorldViewRect.pointInRect(mCurrentMousePoint.mX, mCurrentMousePoint.mY) ) + if(top_ctrl == 0 && mWorldViewRectRaw.pointInRect(mCurrentMousePoint.mX, mCurrentMousePoint.mY) ) gAgent.handleScrollWheel(clicks); return; @@ -2285,8 +2285,8 @@ void LLViewerWindow::handleScrollWheel(S32 clicks) void LLViewerWindow::moveCursorToCenter() { - S32 x = mWorldViewRect.getWidth() / 2; - S32 y = mWorldViewRect.getHeight() / 2; + S32 x = mWorldViewRectRaw.getWidth() / 2; + S32 y = mWorldViewRectRaw.getHeight() / 2; //on a forced move, all deltas get zeroed out to prevent jumping mCurrentMousePoint.set(x,y); @@ -2724,8 +2724,8 @@ void LLViewerWindow::updateMouseDelta() mWindow->getCursorPosition(&mouse_pos); if (mouse_pos.mX < 0 || mouse_pos.mY < 0 || - mouse_pos.mX > mWindowRect.getWidth() || - mouse_pos.mY > mWindowRect.getHeight()) + mouse_pos.mX > mWindowRectRaw.getWidth() || + mouse_pos.mY > mWindowRectRaw.getHeight()) { mMouseInWindow = FALSE; } @@ -2846,7 +2846,7 @@ void LLViewerWindow::updateWorldViewRect(bool use_full_window) LLFastTimer ft(FTM_UPDATE_WORLD_VIEW); // start off using whole window to render world - LLRect new_world_rect = mWindowRect; + LLRect new_world_rect = mWindowRectRaw; if (use_full_window == false && mWorldViewPlaceholder.get()) { @@ -2856,14 +2856,14 @@ void LLViewerWindow::updateWorldViewRect(bool use_full_window) new_world_rect.mRight = llmax(new_world_rect.mRight, new_world_rect.mLeft + 1); } - if (mWorldViewRect != new_world_rect) + if (mWorldViewRectRaw != new_world_rect) { // sending a signal with a new WorldView rect - mOnWorldViewRectUpdated(mWorldViewRect, new_world_rect); + mOnWorldViewRectUpdated(mWorldViewRectRaw, new_world_rect); - mWorldViewRect = new_world_rect; + mWorldViewRectRaw = new_world_rect; gResizeScreenTexture = TRUE; - LLViewerCamera::getInstance()->setViewHeightInPixels( mWorldViewRect.getHeight() ); + LLViewerCamera::getInstance()->setViewHeightInPixels( mWorldViewRectRaw.getHeight() ); LLViewerCamera::getInstance()->setAspect( getWorldViewAspectRatio() ); } } @@ -2876,9 +2876,9 @@ void LLViewerWindow::saveLastMouse(const LLCoordGL &point) { mCurrentMousePoint.mX = 0; } - else if (point.mX > getWindowWidth()) + else if (point.mX > getWindowWidthScaled()) { - mCurrentMousePoint.mX = getWindowWidth(); + mCurrentMousePoint.mX = getWindowWidthScaled(); } else { @@ -2889,9 +2889,9 @@ void LLViewerWindow::saveLastMouse(const LLCoordGL &point) { mCurrentMousePoint.mY = 0; } - else if (point.mY > getWindowHeight() ) + else if (point.mY > getWindowHeightScaled() ) { - mCurrentMousePoint.mY = getWindowHeight(); + mCurrentMousePoint.mY = getWindowHeightScaled(); } else { @@ -3136,10 +3136,10 @@ void LLViewerWindow::pickAsync(S32 x, S32 y_from_bot, MASK mask, void (*callback { mPickScreenRegion.setCenterAndSize(x, y_from_bot, PICK_DIAMETER, PICK_DIAMETER); - if (mPickScreenRegion.mLeft < mWorldViewRect.mLeft) mPickScreenRegion.translate(mWorldViewRect.mLeft - mPickScreenRegion.mLeft, 0); - if (mPickScreenRegion.mBottom < mWorldViewRect.mBottom) mPickScreenRegion.translate(0, mWorldViewRect.mBottom - mPickScreenRegion.mBottom); - if (mPickScreenRegion.mRight > mWorldViewRect.mRight ) mPickScreenRegion.translate(mWorldViewRect.mRight - mPickScreenRegion.mRight, 0); - if (mPickScreenRegion.mTop > mWorldViewRect.mTop ) mPickScreenRegion.translate(0, mWorldViewRect.mTop - mPickScreenRegion.mTop); + if (mPickScreenRegion.mLeft < mWorldViewRectRaw.mLeft) mPickScreenRegion.translate(mWorldViewRectRaw.mLeft - mPickScreenRegion.mLeft, 0); + if (mPickScreenRegion.mBottom < mWorldViewRectRaw.mBottom) mPickScreenRegion.translate(0, mWorldViewRectRaw.mBottom - mPickScreenRegion.mBottom); + if (mPickScreenRegion.mRight > mWorldViewRectRaw.mRight ) mPickScreenRegion.translate(mWorldViewRectRaw.mRight - mPickScreenRegion.mRight, 0); + if (mPickScreenRegion.mTop > mWorldViewRectRaw.mTop ) mPickScreenRegion.translate(0, mWorldViewRectRaw.mTop - mPickScreenRegion.mTop); } // set frame buffer region for picking results @@ -3345,11 +3345,11 @@ LLVector3 LLViewerWindow::mouseDirectionGlobal(const S32 x, const S32 y) const F32 fov = LLViewerCamera::getInstance()->getView(); // find world view center in scaled ui coordinates - F32 center_x = (F32)getWorldViewRect().getCenterX() / mDisplayScale.mV[VX]; - F32 center_y = (F32)getWorldViewRect().getCenterY() / mDisplayScale.mV[VY]; + F32 center_x = (F32)getWorldViewRectRaw().getCenterX() / mDisplayScale.mV[VX]; + F32 center_y = (F32)getWorldViewRectRaw().getCenterY() / mDisplayScale.mV[VY]; // calculate pixel distance to screen - F32 distance = ((F32)getWorldViewHeight() / (mDisplayScale.mV[VY] * 2.f)) / (tan(fov / 2.f)); + F32 distance = ((F32)getWorldViewHeightRaw() / (mDisplayScale.mV[VY] * 2.f)) / (tan(fov / 2.f)); // calculate click point relative to middle of screen F32 click_x = x - center_x; @@ -3368,11 +3368,11 @@ LLVector3 LLViewerWindow::mouseDirectionGlobal(const S32 x, const S32 y) const LLVector3 LLViewerWindow::mousePointHUD(const S32 x, const S32 y) const { // find screen resolution - S32 height = llround((F32)getWorldViewHeight() / mDisplayScale.mV[VY]); + S32 height = llround((F32)getWorldViewHeightRaw() / mDisplayScale.mV[VY]); // find world view center - F32 center_x = (F32)getWorldViewRect().getCenterX() / mDisplayScale.mV[VX]; - F32 center_y = (F32)getWorldViewRect().getCenterY() / mDisplayScale.mV[VY]; + F32 center_x = (F32)getWorldViewRectRaw().getCenterX() / mDisplayScale.mV[VX]; + F32 center_y = (F32)getWorldViewRectRaw().getCenterY() / mDisplayScale.mV[VY]; // remap with uniform scale (1/height) so that top is -0.5, bottom is +0.5 F32 hud_x = -((F32)x - center_x) / height; @@ -3390,12 +3390,12 @@ LLVector3 LLViewerWindow::mouseDirectionCamera(const S32 x, const S32 y) const F32 fov_width = fov_height * LLViewerCamera::getInstance()->getAspect(); // find screen resolution - S32 height = llround((F32)getWorldViewHeight() / mDisplayScale.mV[VY]); - S32 width = llround((F32)getWorldViewWidth() / mDisplayScale.mV[VX]); + S32 height = llround((F32)getWorldViewHeightRaw() / mDisplayScale.mV[VY]); + S32 width = llround((F32)getWorldViewWidthRaw() / mDisplayScale.mV[VX]); // find world view center - F32 center_x = (F32)getWorldViewRect().getCenterX() / mDisplayScale.mV[VX]; - F32 center_y = (F32)getWorldViewRect().getCenterY() / mDisplayScale.mV[VY]; + F32 center_x = (F32)getWorldViewRectRaw().getCenterX() / mDisplayScale.mV[VX]; + F32 center_y = (F32)getWorldViewRectRaw().getCenterY() / mDisplayScale.mV[VY]; // calculate click point relative to middle of screen F32 click_x = (((F32)x - center_x) / (F32)width) * fov_width * -1.f; @@ -3635,8 +3635,8 @@ void LLViewerWindow::movieSize(S32 new_width, S32 new_height) ||(size.mY != new_height + BORDERHEIGHT)) { // use actual display dimensions, not virtual UI dimensions - S32 x = gViewerWindow->getWindowDisplayWidth(); - S32 y = gViewerWindow->getWindowDisplayHeight(); + S32 x = gViewerWindow->getWindowWidthRaw(); + S32 y = gViewerWindow->getWindowHeightRaw(); BORDERWIDTH = size.mX - x; BORDERHEIGHT = size.mY- y; LLCoordScreen new_size(new_width + BORDERWIDTH, @@ -3734,9 +3734,9 @@ BOOL LLViewerWindow::thumbnailSnapshot(LLImageRaw *raw, S32 preview_width, S32 p S32 w = preview_width ; S32 h = preview_height ; LLVector2 display_scale = mDisplayScale ; - mDisplayScale.setVec((F32)w / mWindowRect.getWidth(), (F32)h / mWindowRect.getHeight()) ; - LLRect window_rect = mWindowRect; - mWindowRect.set(0, h, w, 0); + mDisplayScale.setVec((F32)w / mWindowRectRaw.getWidth(), (F32)h / mWindowRectRaw.getHeight()) ; + LLRect window_rect = mWindowRectRaw; + mWindowRectRaw.set(0, h, w, 0); gDisplaySwapBuffers = FALSE; gDepthDirty = TRUE; @@ -3748,7 +3748,7 @@ BOOL LLViewerWindow::thumbnailSnapshot(LLImageRaw *raw, S32 preview_width, S32 p LLHUDText::setDisplayText(FALSE) ; if (type == SNAPSHOT_TYPE_OBJECT_ID) { - gObjectList.renderPickList(gViewerWindow->getVirtualWindowRect(), FALSE, FALSE); + gObjectList.renderPickList(gViewerWindow->getWindowRectScaled(), FALSE, FALSE); } else { @@ -3801,7 +3801,7 @@ BOOL LLViewerWindow::thumbnailSnapshot(LLImageRaw *raw, S32 preview_width, S32 p LLFontGL::setFontDisplay(TRUE) ; LLHUDText::setDisplayText(TRUE) ; mDisplayScale.setVec(display_scale) ; - mWindowRect = window_rect; + mWindowRectRaw = window_rect; setup3DRender(); gDisplaySwapBuffers = FALSE; gDepthDirty = TRUE; @@ -3869,12 +3869,12 @@ BOOL LLViewerWindow::rawSnapshot(LLImageRaw *raw, S32 image_width, S32 image_hei // Copy screen to a buffer // crop sides or top and bottom, if taking a snapshot of different aspect ratio // from window - S32 snapshot_width = mWindowRect.getWidth(); - S32 snapshot_height = mWindowRect.getHeight(); + S32 snapshot_width = mWindowRectRaw.getWidth(); + S32 snapshot_height = mWindowRectRaw.getHeight(); // SNAPSHOT - S32 window_width = mWindowRect.getWidth(); - S32 window_height = mWindowRect.getHeight(); - LLRect window_rect = mWindowRect; + S32 window_width = mWindowRectRaw.getWidth(); + S32 window_height = mWindowRectRaw.getHeight(); + LLRect window_rect = mWindowRectRaw; BOOL use_fbo = FALSE; LLRenderTarget target; @@ -3905,7 +3905,7 @@ BOOL LLViewerWindow::rawSnapshot(LLImageRaw *raw, S32 image_width, S32 image_hei window_width = snapshot_width; window_height = snapshot_height; scale_factor = 1.f; - mWindowRect.set(0, snapshot_height, snapshot_width, 0); + mWindowRectRaw.set(0, snapshot_height, snapshot_width, 0); target.bindTarget(); } } @@ -3973,7 +3973,7 @@ BOOL LLViewerWindow::rawSnapshot(LLImageRaw *raw, S32 image_width, S32 image_hei LLViewerCamera::getInstance()->setZoomParameters(scale_factor, subimage_x+(subimage_y*llceil(scale_factor))); setup3DRender(); - gObjectList.renderPickList(gViewerWindow->getVirtualWindowRect(), FALSE, FALSE); + gObjectList.renderPickList(gViewerWindow->getWindowRectScaled(), FALSE, FALSE); } else { @@ -4052,7 +4052,7 @@ BOOL LLViewerWindow::rawSnapshot(LLImageRaw *raw, S32 image_width, S32 image_hei if (use_fbo) { - mWindowRect = window_rect; + mWindowRectRaw = window_rect; target.flush(); glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); } @@ -4133,23 +4133,13 @@ void LLViewerWindow::drawMouselookInstructions() font->renderUTF8( instructions, 0, - getVirtualWorldViewRect().getCenterX(), - getVirtualWorldViewRect().mBottom + INSTRUCTIONS_PAD, + getWorldViewRectScaled().getCenterX(), + getWorldViewRectScaled().mBottom + INSTRUCTIONS_PAD, LLColor4( 1.0f, 1.0f, 1.0f, 0.5f ), LLFontGL::HCENTER, LLFontGL::TOP, LLFontGL::NORMAL,LLFontGL::DROP_SHADOW); } -S32 LLViewerWindow::getWindowHeight() const -{ - return mVirtualWindowRect.getHeight(); -} - -S32 LLViewerWindow::getWindowWidth() const -{ - return mVirtualWindowRect.getWidth(); -} - void* LLViewerWindow::getPlatformWindow() const { return mWindow->getPlatformWindow(); @@ -4170,9 +4160,9 @@ LLRootView* LLViewerWindow::getRootView() const return mRootView; } -LLRect LLViewerWindow::getVirtualWorldViewRect() const +LLRect LLViewerWindow::getWorldViewRectScaled() const { - LLRect world_view_rect = mWorldViewRect; + LLRect world_view_rect = mWorldViewRectRaw; world_view_rect.mLeft = llround((F32)world_view_rect.mLeft / mDisplayScale.mV[VX]); world_view_rect.mRight = llround((F32)world_view_rect.mRight / mDisplayScale.mV[VX]); world_view_rect.mBottom = llround((F32)world_view_rect.mBottom / mDisplayScale.mV[VY]); @@ -4180,39 +4170,49 @@ LLRect LLViewerWindow::getVirtualWorldViewRect() const return world_view_rect; } -S32 LLViewerWindow::getWorldViewHeight() const +S32 LLViewerWindow::getWorldViewHeightRaw() const { - return mWorldViewRect.getHeight(); + return mWorldViewRectRaw.getHeight(); } -S32 LLViewerWindow::getWorldViewWidth() const +S32 LLViewerWindow::getWorldViewWidthRaw() const { - return mWorldViewRect.getWidth(); + return mWorldViewRectRaw.getWidth(); +} + +S32 LLViewerWindow::getWindowHeightScaled() const +{ + return mWindowRectScaled.getHeight(); +} + +S32 LLViewerWindow::getWindowWidthScaled() const +{ + return mWindowRectScaled.getWidth(); } -S32 LLViewerWindow::getWindowDisplayHeight() const +S32 LLViewerWindow::getWindowHeightRaw() const { - return mWindowRect.getHeight(); + return mWindowRectRaw.getHeight(); } -S32 LLViewerWindow::getWindowDisplayWidth() const +S32 LLViewerWindow::getWindowWidthRaw() const { - return mWindowRect.getWidth(); + return mWindowRectRaw.getWidth(); } void LLViewerWindow::setup2DRender() { // setup ortho camera - gl_state_for_2d(mWindowRect.getWidth(), mWindowRect.getHeight()); + gl_state_for_2d(mWindowRectRaw.getWidth(), mWindowRectRaw.getHeight()); setup2DViewport(); } void LLViewerWindow::setup2DViewport(S32 x_offset, S32 y_offset) { - gGLViewport[0] = mWindowRect.mLeft + x_offset; - gGLViewport[1] = mWindowRect.mBottom + y_offset; - gGLViewport[2] = mWindowRect.getWidth(); - gGLViewport[3] = mWindowRect.getHeight(); + gGLViewport[0] = mWindowRectRaw.mLeft + x_offset; + gGLViewport[1] = mWindowRectRaw.mBottom + y_offset; + gGLViewport[2] = mWindowRectRaw.getWidth(); + gGLViewport[3] = mWindowRectRaw.getHeight(); glViewport(gGLViewport[0], gGLViewport[1], gGLViewport[2], gGLViewport[3]); } @@ -4220,7 +4220,7 @@ void LLViewerWindow::setup2DViewport(S32 x_offset, S32 y_offset) void LLViewerWindow::setup3DRender() { // setup perspective camera - LLViewerCamera::getInstance()->setPerspective(NOT_FOR_SELECTION, mWorldViewRect.mLeft, mWorldViewRect.mBottom, mWorldViewRect.getWidth(), mWorldViewRect.getHeight(), FALSE, LLViewerCamera::getInstance()->getNear(), MAX_FAR_CLIP*2.f); + LLViewerCamera::getInstance()->setPerspective(NOT_FOR_SELECTION, mWorldViewRectRaw.mLeft, mWorldViewRectRaw.mBottom, mWorldViewRectRaw.getWidth(), mWorldViewRectRaw.getHeight(), FALSE, LLViewerCamera::getInstance()->getNear(), MAX_FAR_CLIP*2.f); setup3DViewport(); } @@ -4228,17 +4228,17 @@ void LLViewerWindow::setup3DViewport(S32 x_offset, S32 y_offset) { if (LLRenderTarget::getCurrentBoundTarget() != NULL) { - // don't use translation component of mWorldViewRect, as we are already in a properly sized render target + // don't use translation component of mWorldViewRectRaw, as we are already in a properly sized render target gGLViewport[0] = x_offset; gGLViewport[1] = y_offset; } else { - gGLViewport[0] = mWorldViewRect.mLeft + x_offset; - gGLViewport[1] = mWorldViewRect.mBottom + y_offset; + gGLViewport[0] = mWorldViewRectRaw.mLeft + x_offset; + gGLViewport[1] = mWorldViewRectRaw.mBottom + y_offset; } - gGLViewport[2] = mWorldViewRect.getWidth(); - gGLViewport[3] = mWorldViewRect.getHeight(); + gGLViewport[2] = mWorldViewRectRaw.getWidth(); + gGLViewport[3] = mWorldViewRectRaw.getHeight(); glViewport(gGLViewport[0], gGLViewport[1], gGLViewport[2], gGLViewport[3]); } @@ -4449,8 +4449,8 @@ void LLViewerWindow::getTargetWindow(BOOL& fullscreen, S32& width, S32& height) if (mWindow && mWindow->getFullscreen() == mWantFullscreen) { - width = getWindowDisplayWidth(); - height = getWindowDisplayHeight(); + width = getWindowWidthRaw(); + height = getWindowHeightRaw(); } else if (mWantFullscreen) { @@ -4497,7 +4497,7 @@ BOOL LLViewerWindow::checkSettings() getWindow()->setNativeAspectRatio(gSavedSettings.getF32("FullScreenAspectRatio")); } - reshape(getWindowDisplayWidth(), getWindowDisplayHeight()); + reshape(getWindowWidthRaw(), getWindowHeightRaw()); // force aspect ratio if (mIsFullscreenChecked) @@ -4723,8 +4723,8 @@ F32 LLViewerWindow::getDisplayAspectRatio() const F32 LLViewerWindow::getWorldViewAspectRatio() const { - F32 world_aspect = (F32)mWorldViewRect.getWidth() / (F32)mWorldViewRect.getHeight(); - //F32 window_aspect = (F32)mWindowRect.getWidth() / (F32)mWindowRect.getHeight(); + F32 world_aspect = (F32)mWorldViewRectRaw.getWidth() / (F32)mWorldViewRectRaw.getHeight(); + //F32 window_aspect = (F32)mWindowRectRaw.getWidth() / (F32)mWindowRectRaw.getHeight(); if (mWindow->getFullscreen()) { return world_aspect * mWindow->getPixelAspectRatio(); @@ -4741,7 +4741,7 @@ void LLViewerWindow::calcDisplayScale() F32 ui_scale_factor = gSavedSettings.getF32("UIScaleFactor"); LLVector2 display_scale; display_scale.setVec(llmax(1.f / mWindow->getPixelAspectRatio(), 1.f), llmax(mWindow->getPixelAspectRatio(), 1.f)); - F32 height_normalization = gSavedSettings.getBOOL("UIAutoScale") ? ((F32)mWindowRect.getHeight() / display_scale.mV[VY]) / 768.f : 1.f; + F32 height_normalization = gSavedSettings.getBOOL("UIAutoScale") ? ((F32)mWindowRectRaw.getHeight() / display_scale.mV[VY]) / 768.f : 1.f; if(mWindow->getFullscreen()) { display_scale *= (ui_scale_factor * height_normalization); @@ -4759,8 +4759,8 @@ void LLViewerWindow::calcDisplayScale() if (mWindow->getFullscreen()) { - display_scale.mV[0] = llround(display_scale.mV[0], 2.0f/(F32) mWindowRect.getWidth()); - display_scale.mV[1] = llround(display_scale.mV[1], 2.0f/(F32) mWindowRect.getHeight()); + display_scale.mV[0] = llround(display_scale.mV[0], 2.0f/(F32) mWindowRectRaw.getWidth()); + display_scale.mV[1] = llround(display_scale.mV[1], 2.0f/(F32) mWindowRectRaw.getHeight()); } if (display_scale != mDisplayScale) @@ -4785,7 +4785,7 @@ S32 LLViewerWindow::getChatConsoleBottomPad() LLRect LLViewerWindow::getChatConsoleRect() { - LLRect full_window(0, getWindowHeight(), getWindowWidth(), 0); + LLRect full_window(0, getWindowHeightScaled(), getWindowWidthScaled(), 0); LLRect console_rect = full_window; const S32 CONSOLE_PADDING_TOP = 24; @@ -4807,7 +4807,7 @@ LLRect LLViewerWindow::getChatConsoleRect() { // Make console rect somewhat narrow so having inventory open is // less of a problem. - console_rect.mRight = console_rect.mLeft + 2 * getWindowWidth() / 3; + console_rect.mRight = console_rect.mLeft + 2 * getWindowWidthScaled() / 3; } return console_rect; diff --git a/indra/newview/llviewerwindow.h b/indra/newview/llviewerwindow.h index d8f0a99a49..ce71ef6173 100644 --- a/indra/newview/llviewerwindow.h +++ b/indra/newview/llviewerwindow.h @@ -210,21 +210,23 @@ public: // LLRootView* getRootView() const; + // 3D world area in scaled pixels (via UI scale), use for most UI computations + LLRect getWorldViewRectScaled() const; + + // 3D world area, in raw unscaled pixels + LLRect getWorldViewRectRaw() const { return mWorldViewRectRaw; } + S32 getWorldViewHeightRaw() const; + S32 getWorldViewWidthRaw() const; + + // Window in scaled pixels (via UI scale), use for most UI computations + LLRect getWindowRectScaled() const { return mWindowRectScaled; } + S32 getWindowHeightScaled() const; + S32 getWindowWidthScaled() const; + // Window in raw pixels as seen on screen. - const LLRect& getWindowRect() const { return mWindowRect; }; - // portion of window that shows 3d world - const LLRect& getWorldViewRect() const { return mWorldViewRect; }; - LLRect getVirtualWorldViewRect() const; - S32 getWorldViewHeight() const; - S32 getWorldViewWidth() const; - S32 getWindowDisplayHeight() const; - S32 getWindowDisplayWidth() const; - - // Window in scaled pixels (via UI scale), use this for - // UI elements checking size. - const LLRect& getVirtualWindowRect() const { return mVirtualWindowRect; }; - S32 getWindowHeight() const; - S32 getWindowWidth() const; + LLRect getWindowRectRaw() const { return mWindowRectRaw; } + S32 getWindowHeightRaw() const; + S32 getWindowWidthRaw() const; LLWindow* getWindow() const { return mWindow; } void* getPlatformWindow() const; @@ -409,10 +411,11 @@ protected: BOOL mActive; BOOL mWantFullscreen; BOOL mShowFullscreenProgress; - LLRect mWindowRect; - LLRect mVirtualWindowRect; - LLRect mWorldViewRect; // specifies area of screen where we render the 3D world - LLRootView* mRootView; // a view of size mWindowRect, containing all child views + + LLRect mWindowRectRaw; // whole window, including UI + LLRect mWindowRectScaled; // whole window, scaled by UI size + LLRect mWorldViewRectRaw; // area of screen for 3D world + LLRootView* mRootView; // a view of size mWindowRectRaw, containing all child views LLVector2 mDisplayScale; LLCoordGL mCurrentMousePoint; // last mouse position in GL coords diff --git a/indra/newview/llviewerwindowlistener.cpp b/indra/newview/llviewerwindowlistener.cpp index 317e361c80..a890b042ae 100644 --- a/indra/newview/llviewerwindowlistener.cpp +++ b/indra/newview/llviewerwindowlistener.cpp @@ -50,8 +50,8 @@ void LLViewerWindowListener::saveSnapshot(const LLSD& event) const #undef tp // Our add() call should ensure that the incoming LLSD does in fact // contain our required arguments. Deal with the optional ones. - S32 width (mViewerWindow->getWindowDisplayWidth()); - S32 height(mViewerWindow->getWindowDisplayHeight()); + S32 width (mViewerWindow->getWindowWidthRaw()); + S32 height(mViewerWindow->getWindowHeightRaw()); if (event.has("width")) width = event["width"].asInteger(); if (event.has("height")) diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index ba1732bc92..1129e9ffd1 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -512,8 +512,8 @@ void LLPipeline::resizeScreenTexture() LLFastTimer ft(FTM_RESIZE_SCREEN_TEXTURE); if (gPipeline.canUseVertexShaders() && assertInitialized()) { - GLuint resX = gViewerWindow->getWorldViewWidth(); - GLuint resY = gViewerWindow->getWorldViewHeight(); + GLuint resX = gViewerWindow->getWorldViewWidthRaw(); + GLuint resY = gViewerWindow->getWorldViewHeightRaw(); allocateScreenBuffer(resX,resY); @@ -698,8 +698,8 @@ void LLPipeline::createGLBuffers() stop_glerror(); - GLuint resX = gViewerWindow->getWorldViewWidth(); - GLuint resY = gViewerWindow->getWorldViewHeight(); + GLuint resX = gViewerWindow->getWorldViewWidthRaw(); + GLuint resY = gViewerWindow->getWorldViewHeightRaw(); if (LLPipeline::sRenderGlow) { //screen space glow buffers @@ -3051,7 +3051,7 @@ void LLPipeline::renderGeom(LLCamera& camera, BOOL forceVBOUpdate) if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_PICKING)) { LLAppViewer::instance()->pingMainloopTimeout("Pipeline:RenderForSelect"); - gObjectList.renderObjectsForSelect(camera, gViewerWindow->getVirtualWindowRect()); + gObjectList.renderObjectsForSelect(camera, gViewerWindow->getWindowRectScaled()); } else { @@ -5532,8 +5532,8 @@ void LLPipeline::renderBloom(BOOL for_snapshot, F32 zoom_factor, int subfield) U32 res_mod = gSavedSettings.getU32("RenderResolutionDivisor"); LLVector2 tc1(0,0); - LLVector2 tc2((F32) gViewerWindow->getWorldViewWidth()*2, - (F32) gViewerWindow->getWorldViewHeight()*2); + LLVector2 tc2((F32) gViewerWindow->getWorldViewWidthRaw()*2, + (F32) gViewerWindow->getWorldViewHeightRaw()*2); if (res_mod > 1) { @@ -5733,14 +5733,14 @@ void LLPipeline::renderBloom(BOOL for_snapshot, F32 zoom_factor, int subfield) glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); } - gGLViewport[0] = gViewerWindow->getWorldViewRect().mLeft; - gGLViewport[1] = gViewerWindow->getWorldViewRect().mBottom; - gGLViewport[2] = gViewerWindow->getWorldViewRect().getWidth(); - gGLViewport[3] = gViewerWindow->getWorldViewRect().getHeight(); + gGLViewport[0] = gViewerWindow->getWorldViewRectRaw().mLeft; + gGLViewport[1] = gViewerWindow->getWorldViewRectRaw().mBottom; + gGLViewport[2] = gViewerWindow->getWorldViewRectRaw().getWidth(); + gGLViewport[3] = gViewerWindow->getWorldViewRectRaw().getHeight(); glViewport(gGLViewport[0], gGLViewport[1], gGLViewport[2], gGLViewport[3]); - tc2.setVec((F32) gViewerWindow->getWorldViewWidth(), - (F32) gViewerWindow->getWorldViewHeight()); + tc2.setVec((F32) gViewerWindow->getWorldViewWidthRaw(), + (F32) gViewerWindow->getWorldViewHeightRaw()); gGL.flush(); @@ -8744,7 +8744,7 @@ void LLPipeline::generateImpostor(LLVOAvatar* avatar) glClearStencil(0); // get the number of pixels per angle - F32 pa = gViewerWindow->getWindowDisplayHeight() / (RAD_TO_DEG * LLViewerCamera::getInstance()->getView()); + F32 pa = gViewerWindow->getWindowHeightRaw() / (RAD_TO_DEG * LLViewerCamera::getInstance()->getView()); //get resolution based on angle width and height of impostor (double desired resolution to prevent aliasing) U32 resY = llmin(nhpo2((U32) (fov*pa)), (U32) 512); |