diff options
Diffstat (limited to 'indra/newview')
-rw-r--r-- | indra/newview/llviewerwindow.cpp | 27 | ||||
-rw-r--r-- | indra/newview/llviewerwindow.h | 1 |
2 files changed, 20 insertions, 8 deletions
diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index db66faef81..3840f337d4 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -1347,6 +1347,7 @@ LLViewerWindow::LLViewerWindow( mDebugText = new LLDebugText(this); + mWorldViewRectScaled = calcScaledRect(mWorldViewRectRaw, mDisplayScale); } void LLViewerWindow::initGLDefaults() @@ -2867,19 +2868,17 @@ void LLViewerWindow::updateWorldViewRect(bool use_full_window) if (mWorldViewRectRaw != new_world_rect) { - // sending a signal with a new WorldView rect - mOnWorldViewRectUpdated(mWorldViewRectRaw, new_world_rect); - + LLRect old_world_rect = mWorldViewRectRaw; mWorldViewRectRaw = new_world_rect; gResizeScreenTexture = TRUE; LLViewerCamera::getInstance()->setViewHeightInPixels( mWorldViewRectRaw.getHeight() ); LLViewerCamera::getInstance()->setAspect( getWorldViewAspectRatio() ); - mWorldViewRectScaled = mWorldViewRectRaw; - mWorldViewRectScaled.mLeft = llround((F32)mWorldViewRectScaled.mLeft / mDisplayScale.mV[VX]); - mWorldViewRectScaled.mRight = llround((F32)mWorldViewRectScaled.mRight / mDisplayScale.mV[VX]); - mWorldViewRectScaled.mBottom = llround((F32)mWorldViewRectScaled.mBottom / mDisplayScale.mV[VY]); - mWorldViewRectScaled.mTop = llround((F32)mWorldViewRectScaled.mTop / mDisplayScale.mV[VY]); + mWorldViewRectScaled = calcScaledRect(mWorldViewRectRaw, mDisplayScale); + + // sending a signal with a new WorldView rect + old_world_rect = calcScaledRect(old_world_rect, mDisplayScale); + mOnWorldViewRectUpdated(old_world_rect, mWorldViewRectScaled); } } @@ -4794,6 +4793,18 @@ void LLViewerWindow::calcDisplayScale() } } +//static +LLRect LLViewerWindow::calcScaledRect(const LLRect & rect, const LLVector2& display_scale) +{ + LLRect res = rect; + res.mLeft = llround((F32)res.mLeft / display_scale.mV[VX]); + res.mRight = llround((F32)res.mRight / display_scale.mV[VX]); + res.mBottom = llround((F32)res.mBottom / display_scale.mV[VY]); + res.mTop = llround((F32)res.mTop / display_scale.mV[VY]); + + return res; +} + S32 LLViewerWindow::getChatConsoleBottomPad() { S32 offset = 0; diff --git a/indra/newview/llviewerwindow.h b/indra/newview/llviewerwindow.h index 517993182b..747fd3b253 100644 --- a/indra/newview/llviewerwindow.h +++ b/indra/newview/llviewerwindow.h @@ -391,6 +391,7 @@ public: F32 getWorldViewAspectRatio() const; const LLVector2& getDisplayScale() const { return mDisplayScale; } void calcDisplayScale(); + static LLRect calcScaledRect(const LLRect & rect, const LLVector2& display_scale); private: bool shouldShowToolTipFor(LLMouseHandler *mh); |