diff options
-rw-r--r-- | indra/newview/llthumbnailctrl.cpp | 28 | ||||
-rw-r--r-- | indra/newview/llthumbnailctrl.h | 2 | ||||
-rw-r--r-- | indra/newview/skins/default/textures/icons/thumbnail_fallback_icon.png | bin | 0 -> 6162 bytes | |||
-rw-r--r-- | indra/newview/skins/default/textures/textures.xml | 1 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/floater_change_item_thumbnail.xml | 1 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/sidepanel_item_info.xml | 1 |
6 files changed, 32 insertions, 1 deletions
diff --git a/indra/newview/llthumbnailctrl.cpp b/indra/newview/llthumbnailctrl.cpp index 4245237529..1b054b4c27 100644 --- a/indra/newview/llthumbnailctrl.cpp +++ b/indra/newview/llthumbnailctrl.cpp @@ -43,6 +43,7 @@ static LLDefaultChildRegistry::Register<LLThumbnailCtrl> r("thumbnail"); LLThumbnailCtrl::Params::Params() : border("border") , border_color("border_color") +, fallback_image("fallback_image") , image_name("image_name") , border_visible("show_visible", false) , interactable("interactable", false) @@ -53,6 +54,7 @@ LLThumbnailCtrl::LLThumbnailCtrl(const LLThumbnailCtrl::Params& p) : LLUICtrl(p) , mBorderColor(p.border_color()) , mBorderVisible(p.border_visible()) +, mFallbackImagep(p.fallback_image) , mInteractable(p.interactable()) , mShowLoadingPlaceholder(p.show_loading()) , mPriority(LLGLTexture::BOOST_PREVIEW) @@ -76,6 +78,7 @@ LLThumbnailCtrl::~LLThumbnailCtrl() { mTexturep = nullptr; mImagep = nullptr; + mFallbackImagep = nullptr; } @@ -106,7 +109,30 @@ void LLThumbnailCtrl::draw() } else if( mImagep.notNull() ) { - mImagep->draw(getLocalRect(), UI_VERTEX_COLOR % alpha ); + mImagep->draw(draw_rect, UI_VERTEX_COLOR % alpha ); + } + else if (mFallbackImagep.notNull()) + { + if (draw_rect.getWidth() > mFallbackImagep->getWidth() + && draw_rect.getHeight() > mFallbackImagep->getHeight()) + { + S32 img_width = mFallbackImagep->getWidth(); + S32 img_height = mFallbackImagep->getHeight(); + S32 rect_width = draw_rect.getWidth(); + S32 rect_height = draw_rect.getHeight(); + + LLRect fallback_rect; + fallback_rect.mLeft = draw_rect.mLeft + (rect_width - img_width) / 2; + fallback_rect.mRight = fallback_rect.mLeft + img_width; + fallback_rect.mBottom = draw_rect.mBottom + (rect_height - img_height) / 2; + fallback_rect.mTop = fallback_rect.mBottom + img_height; + + mFallbackImagep->draw(fallback_rect, UI_VERTEX_COLOR % alpha); + } + else + { + mFallbackImagep->draw(draw_rect, UI_VERTEX_COLOR % alpha); + } } else { diff --git a/indra/newview/llthumbnailctrl.h b/indra/newview/llthumbnailctrl.h index 978da8d71c..dc21046841 100644 --- a/indra/newview/llthumbnailctrl.h +++ b/indra/newview/llthumbnailctrl.h @@ -49,6 +49,7 @@ public: Optional<LLViewBorder::Params> border; Optional<LLUIColor> border_color; Optional<std::string> image_name; + Optional<LLUIImage*> fallback_image; Optional<bool> border_visible; Optional<bool> interactable; Optional<bool> show_loading; @@ -80,6 +81,7 @@ private: LLPointer<LLViewerFetchedTexture> mTexturep; LLPointer<LLUIImage> mImagep; + LLPointer<LLUIImage> mFallbackImagep; }; #endif diff --git a/indra/newview/skins/default/textures/icons/thumbnail_fallback_icon.png b/indra/newview/skins/default/textures/icons/thumbnail_fallback_icon.png Binary files differnew file mode 100644 index 0000000000..8d5ca624af --- /dev/null +++ b/indra/newview/skins/default/textures/icons/thumbnail_fallback_icon.png diff --git a/indra/newview/skins/default/textures/textures.xml b/indra/newview/skins/default/textures/textures.xml index 5d9c362e78..424fc851fd 100644 --- a/indra/newview/skins/default/textures/textures.xml +++ b/indra/newview/skins/default/textures/textures.xml @@ -690,6 +690,7 @@ with the same filename but different name <texture name="TextField_Active" file_name="widgets/TextField_Active.png" preload="true" scale.left="9" scale.top="12" scale.right="248" scale.bottom="12" /> <texture name="TextField_Search_Highlight" file_name="widgets/TextField_Search_Highlight.png" preload="true" scale.left="9" scale.top="12" scale.right="248" scale.bottom="12" /> + <texture name="Thumbnail_Fallback" file_name="icons/thumbnail_fallback_icon.png" preload="true" /> <texture name="Toast_CloseBtn" file_name="windows/Toast_CloseBtn.png" preload="true" /> <texture name="Toast_Background" file_name="windows/Toast_Background.png" preload="true" diff --git a/indra/newview/skins/default/xui/en/floater_change_item_thumbnail.xml b/indra/newview/skins/default/xui/en/floater_change_item_thumbnail.xml index f5c266c553..95e868a696 100644 --- a/indra/newview/skins/default/xui/en/floater_change_item_thumbnail.xml +++ b/indra/newview/skins/default/xui/en/floater_change_item_thumbnail.xml @@ -56,6 +56,7 @@ <thumbnail name="item_thumbnail" + fallback_image="Thumbnail_Fallback" follows="top|left" layout="topleft" left="32" diff --git a/indra/newview/skins/default/xui/en/sidepanel_item_info.xml b/indra/newview/skins/default/xui/en/sidepanel_item_info.xml index f755ec0ec4..ad521cb1af 100644 --- a/indra/newview/skins/default/xui/en/sidepanel_item_info.xml +++ b/indra/newview/skins/default/xui/en/sidepanel_item_info.xml @@ -93,6 +93,7 @@ <thumbnail name="item_thumbnail" + fallback_image="Thumbnail_Fallback" follows="top|left" layout="topleft" left="5" |