From 82f043c3338fdcf35e42dbe2ed512eb39808b90e Mon Sep 17 00:00:00 2001 From: Vadim ProductEngine Date: Wed, 14 Dec 2011 15:26:13 +0200 Subject: EXP-1639 FIXED Fixed a resolution rounding error. The error sometimes led to the following issues with maximized viewer window on MS Windows: * displaying incorrect resolution * failure to update snapshot --- indra/newview/llfloatersnapshot.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'indra') diff --git a/indra/newview/llfloatersnapshot.cpp b/indra/newview/llfloatersnapshot.cpp index 13f544e784..b7145d43f6 100644 --- a/indra/newview/llfloatersnapshot.cpp +++ b/indra/newview/llfloatersnapshot.cpp @@ -333,8 +333,7 @@ void LLSnapshotLivePreview::updateSnapshot(BOOL new_snapshot, BOOL new_thumbnail { S32 old_image_index = mCurImageIndex; mCurImageIndex = (mCurImageIndex + 1) % 2; - setWidth(mWidth[old_image_index]); - setHeight(mHeight[old_image_index]); + setSize(mWidth[old_image_index], mHeight[old_image_index]); mFallAnimTimer.start(); } mSnapshotUpToDate = FALSE; @@ -1447,7 +1446,6 @@ void LLFloaterSnapshot::Impl::updateControls(LLFloaterSnapshot* floater) if (previewp) { - lldebugs << "Setting snapshot type (" << shot_type << "), format (" << shot_format << ")" << llendl; previewp->setSnapshotType(shot_type); previewp->setSnapshotFormat(shot_format); previewp->setSnapshotBufferType(layer_type); @@ -1460,6 +1458,7 @@ void LLFloaterSnapshot::Impl::updateControls(LLFloaterSnapshot* floater) info["have-snapshot"] = got_snap; current_panel->updateControls(info); } + lldebugs << "finished updating controls" << llendl; } // static @@ -1696,6 +1695,7 @@ void LLFloaterSnapshot::Impl::setFinished(LLFloaterSnapshot* floater, bool finis } } +// Apply a new resolution selected from the given combobox. // static void LLFloaterSnapshot::Impl::updateResolution(LLUICtrl* ctrl, void* data, BOOL do_update) { @@ -1864,11 +1864,11 @@ BOOL LLFloaterSnapshot::Impl::checkImageSize(LLSnapshotLivePreview* previewp, S3 //change another value proportionally if(isWidthChanged) { - height = (S32)(width / aspect_ratio) ; + height = llround(width / aspect_ratio) ; } else { - width = (S32)(height * aspect_ratio) ; + width = llround(height * aspect_ratio) ; } //bound w/h by the max_value -- cgit v1.2.3 From 6cefa466361e37df8082f86a21a954199fbf14a4 Mon Sep 17 00:00:00 2001 From: Vadim ProductEngine Date: Wed, 14 Dec 2011 17:12:40 +0200 Subject: EXP-1635 FIXED Made it clear that inventory snapshots are limited to 512x512 px. --- indra/newview/llfloatersnapshot.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'indra') diff --git a/indra/newview/llfloatersnapshot.cpp b/indra/newview/llfloatersnapshot.cpp index b7145d43f6..6532a27b9d 100644 --- a/indra/newview/llfloatersnapshot.cpp +++ b/indra/newview/llfloatersnapshot.cpp @@ -832,7 +832,7 @@ BOOL LLSnapshotLivePreview::onIdle( void* snapshot_preview ) previewp->mPreviewImage->getHeight(), previewp->mPreviewImage->getComponents()); - scaled->biasedScaleToPowerOfTwo(512); + scaled->biasedScaleToPowerOfTwo(MAX_TEXTURE_SIZE); previewp->setImageScaled(TRUE); if (formatted->encode(scaled, 0.f)) { @@ -959,7 +959,7 @@ void LLSnapshotLivePreview::saveTexture() mPreviewImage->getHeight(), mPreviewImage->getComponents()); - scaled->biasedScaleToPowerOfTwo(512); + scaled->biasedScaleToPowerOfTwo(MAX_TEXTURE_SIZE); lldebugs << "scaled texture to " << scaled->getWidth() << "x" << scaled->getHeight() << llendl; if (formatted->encode(scaled, 0.0f)) @@ -1738,6 +1738,13 @@ void LLFloaterSnapshot::Impl::updateResolution(LLUICtrl* ctrl, void* data, BOOL lldebugs << "Loading typed res from panel " << spanel->getName() << llendl; new_width = spanel->getTypedPreviewWidth(); new_height = spanel->getTypedPreviewHeight(); + + // Limit custom size for inventory snapshots to 512x512 px. + if (getActiveSnapshotType(view) == LLSnapshotLivePreview::SNAPSHOT_TEXTURE) + { + new_width = llmin(new_width, MAX_TEXTURE_SIZE); + new_height = llmin(new_height, MAX_TEXTURE_SIZE); + } } else { -- cgit v1.2.3 From 16b6a472477bd389771fe4022e425f77ca85c2bd Mon Sep 17 00:00:00 2001 From: Leslie Linden Date: Fri, 16 Dec 2011 15:07:04 -0800 Subject: EXP-1742 FIX -- Clicking IM notification or receiving multiple IM notifications in quick succession crashes to desktop * Moved toast logic for mouse hover out of the draw call to avoid chain of callbacks that lead to reordering of the draw list while we are iterating over it. --- indra/newview/llappviewer.cpp | 2 + indra/newview/lltoast.cpp | 146 ++++++++++++++++++++++++------------------ indra/newview/lltoast.h | 8 ++- 3 files changed, 89 insertions(+), 67 deletions(-) (limited to 'indra') diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index b45f9c55fb..0861fe85a8 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -75,6 +75,7 @@ //#include "llfirstuse.h" #include "llrender.h" #include "llteleporthistory.h" +#include "lltoast.h" #include "lllocationhistory.h" #include "llfasttimerview.h" #include "llvector4a.h" @@ -4051,6 +4052,7 @@ void LLAppViewer::idle() LLFrameTimer::updateFrameTime(); LLFrameTimer::updateFrameCount(); LLEventTimer::updateClass(); + LLNotificationsUI::LLToast::updateClass(); LLCriticalDamp::updateInterpolants(); LLMortician::updateClass(); LLFilePickerThread::clearDead(); //calls LLFilePickerThread::notify() diff --git a/indra/newview/lltoast.cpp b/indra/newview/lltoast.cpp index c4b226b70b..da691a2d0c 100644 --- a/indra/newview/lltoast.cpp +++ b/indra/newview/lltoast.cpp @@ -140,7 +140,9 @@ LLToast::LLToast(const LLToast::Params& p) // init callbacks if present if(!p.on_delete_toast().empty()) + { mOnDeleteToastSignal.connect(p.on_delete_toast()); + } } void LLToast::reshape(S32 width, S32 height, BOOL called_from_parent) @@ -236,7 +238,9 @@ void LLToast::setCanFade(bool can_fade) { mCanFade = can_fade; if(!mCanFade) + { mTimer->stop(); + } } //-------------------------------------------------------------------------- @@ -328,55 +332,6 @@ void LLToast::draw() drawChild(mHideBtn); } } - - updateHoveredState(); - - LLToastLifeTimer* timer = getTimer(); - if (!timer) - { - return; - } - - // Started timer means the mouse had left the toast previously. - // If toast is hovered in the current frame we should handle - // a mouse enter event. - if(timer->getStarted() && mIsHovered) - { - mOnToastHoverSignal(this, MOUSE_ENTER); - - updateTransparency(); - - //toasts fading is management by Screen Channel - - sendChildToFront(mHideBtn); - if(mHideBtn && mHideBtn->getEnabled()) - { - mHideBtn->setVisible(TRUE); - } - mToastMouseEnterSignal(this, getValue()); - } - // Stopped timer means the mouse had entered the toast previously. - // If the toast is not hovered in the current frame we should handle - // a mouse leave event. - else if(!timer->getStarted() && !mIsHovered) - { - mOnToastHoverSignal(this, MOUSE_LEAVE); - - updateTransparency(); - - //toasts fading is management by Screen Channel - - if(mHideBtn && mHideBtn->getEnabled()) - { - if( mHideBtnPressed ) - { - mHideBtnPressed = false; - return; - } - mHideBtn->setVisible(FALSE); - } - mToastMouseLeaveSignal(this, getValue()); - } } //-------------------------------------------------------------------------- @@ -440,28 +395,80 @@ void LLToast::updateHoveredState() { // mouse is not over this toast mIsHovered = false; - return; } + else + { + bool is_overlapped_by_other_floater = false; - bool is_overlapped_by_other_floater = false; - - const child_list_t* child_list = gFloaterView->getChildList(); + const child_list_t* child_list = gFloaterView->getChildList(); - // find this toast in gFloaterView child list to check whether any floater - // with higher Z-order is visible under the mouse pointer overlapping this toast - child_list_const_reverse_iter_t r_iter = std::find(child_list->rbegin(), child_list->rend(), this); - if (r_iter != child_list->rend()) - { - // skip this toast and proceed to views above in Z-order - for (++r_iter; r_iter != child_list->rend(); ++r_iter) + // find this toast in gFloaterView child list to check whether any floater + // with higher Z-order is visible under the mouse pointer overlapping this toast + child_list_const_reverse_iter_t r_iter = std::find(child_list->rbegin(), child_list->rend(), this); + if (r_iter != child_list->rend()) { - LLView* view = *r_iter; - is_overlapped_by_other_floater = view->isInVisibleChain() && view->calcScreenRect().pointInRect(x, y); - if (is_overlapped_by_other_floater) break; + // skip this toast and proceed to views above in Z-order + for (++r_iter; r_iter != child_list->rend(); ++r_iter) + { + LLView* view = *r_iter; + is_overlapped_by_other_floater = view->isInVisibleChain() && view->calcScreenRect().pointInRect(x, y); + if (is_overlapped_by_other_floater) + { + break; + } + } } + + mIsHovered = !is_overlapped_by_other_floater; } - mIsHovered = !is_overlapped_by_other_floater; + LLToastLifeTimer* timer = getTimer(); + + if (timer) + { + // Started timer means the mouse had left the toast previously. + // If toast is hovered in the current frame we should handle + // a mouse enter event. + if(timer->getStarted() && mIsHovered) + { + mOnToastHoverSignal(this, MOUSE_ENTER); + + updateTransparency(); + + //toasts fading is management by Screen Channel + + sendChildToFront(mHideBtn); + if(mHideBtn && mHideBtn->getEnabled()) + { + mHideBtn->setVisible(TRUE); + } + + mToastMouseEnterSignal(this, getValue()); + } + // Stopped timer means the mouse had entered the toast previously. + // If the toast is not hovered in the current frame we should handle + // a mouse leave event. + else if(!timer->getStarted() && !mIsHovered) + { + mOnToastHoverSignal(this, MOUSE_LEAVE); + + updateTransparency(); + + //toasts fading is management by Screen Channel + + if(mHideBtn && mHideBtn->getEnabled()) + { + if( mHideBtnPressed ) + { + mHideBtnPressed = false; + return; + } + mHideBtn->setVisible(FALSE); + } + + mToastMouseLeaveSignal(this, getValue()); + } + } } void LLToast::setBackgroundOpaque(BOOL b) @@ -553,3 +560,14 @@ S32 LLToast::notifyParent(const LLSD& info) return LLModalDialog::notifyParent(info); } + +//static +void LLToast::updateClass() +{ + for (LLInstanceTracker::instance_iter iter = LLInstanceTracker::beginInstances(); iter != LLInstanceTracker::endInstances(); ) + { + LLToast& toast = *iter++; + + toast.updateHoveredState(); + } +} diff --git a/indra/newview/lltoast.h b/indra/newview/lltoast.h index 77229e7beb..0b06728935 100644 --- a/indra/newview/lltoast.h +++ b/indra/newview/lltoast.h @@ -27,7 +27,7 @@ #ifndef LL_LLTOAST_H #define LL_LLTOAST_H - +#include "llinstancetracker.h" #include "llpanel.h" #include "llmodaldialog.h" #include "lleventtimer.h" @@ -69,7 +69,7 @@ private : * Represents toast pop-up. * This is a parent view for all toast panels. */ -class LLToast : public LLModalDialog +class LLToast : public LLModalDialog, public LLInstanceTracker { friend class LLToastLifeTimer; public: @@ -102,6 +102,8 @@ public: Params(); }; + + static void updateClass(); LLToast(const LLToast::Params& p); virtual ~LLToast(); @@ -221,7 +223,7 @@ private: F32 mToastLifetime; // in seconds F32 mToastFadingTime; // in seconds - + LLPanel* mPanel; LLButton* mHideBtn; -- cgit v1.2.3