From 3ecfeda2fdb83c9d89f4e8743f9c99a8ec7b01f6 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Mon, 6 Feb 2023 20:52:56 +0200 Subject: SL-19134 Thumbnail ctrl LLIconCtrl stores icons indefinitely which is undesired for fairly large and expected to be numerous thumbnails, LLTextureCtrl is tied to texture picker and has a number of limitations (already processes clicks, enforces label area). Intent behind LLThumbnailCtrl is to bridge the gap - to not store texture indefinitely and to allow further customisation. --- indra/newview/llthumbnailctrl.cpp | 204 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 204 insertions(+) create mode 100644 indra/newview/llthumbnailctrl.cpp (limited to 'indra/newview/llthumbnailctrl.cpp') diff --git a/indra/newview/llthumbnailctrl.cpp b/indra/newview/llthumbnailctrl.cpp new file mode 100644 index 0000000000..35bf9cb04c --- /dev/null +++ b/indra/newview/llthumbnailctrl.cpp @@ -0,0 +1,204 @@ +/** + * @file llthumbnailctrl.cpp + * @brief LLThumbnailCtrl base class + * + * $LicenseInfo:firstyear=2023&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2023, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#include "llviewerprecompiledheaders.h" + +#include "llthumbnailctrl.h" + +#include "linden_common.h" +#include "llagent.h" +#include "lluictrlfactory.h" +#include "lluuid.h" +#include "lltrans.h" +#include "llviewborder.h" +#include "llviewertexture.h" +#include "llviewertexturelist.h" +#include "llwindow.h" + +static LLDefaultChildRegistry::Register r("thumbnail"); + +LLThumbnailCtrl::Params::Params() +: border("border") +, border_color("border_color") +, image_name("image_name") +, border_visible("show_visible", false) +, interactable("interactable", false) +, show_loading("show_loading", true) +{} + +LLThumbnailCtrl::LLThumbnailCtrl(const LLThumbnailCtrl::Params& p) +: LLUICtrl(p) +, mBorderColor(p.border_color()) +, mBorderVisible(p.border_visible()) +, mInteractable(p.interactable()) +, mShowLoadingPlaceholder(p.show_loading()) +, mPriority(LLGLTexture::BOOST_PREVIEW) +{ + mLoadingPlaceholderString = LLTrans::getString("texture_loading"); + + LLRect border_rect = getLocalRect(); + LLViewBorder::Params vbparams(p.border); + vbparams.name("border"); + vbparams.rect(border_rect); + mBorder = LLUICtrlFactory::create (vbparams); + addChild(mBorder); + + if (p.image_name.isProvided()) + { + setValue(p.image_name()); + } +} + +LLThumbnailCtrl::~LLThumbnailCtrl() +{ + mTexturep = nullptr; + mImagep = nullptr; +} + + +void LLThumbnailCtrl::draw() +{ + LLRect draw_rect = getLocalRect(); + + if (mBorderVisible) + { + mBorder->setKeyboardFocusHighlight(hasFocus()); + + gl_rect_2d( draw_rect, mBorderColor.get(), FALSE ); + draw_rect.stretch( -1 ); + } + + // If we're in a focused floater, don't apply the floater's alpha to the texture. + const F32 alpha = getTransparencyType() == TT_ACTIVE ? 1.0f : getCurrentTransparency(); + if( mTexturep ) + { + if( mTexturep->getComponents() == 4 ) + { + gl_rect_2d_checkerboard( draw_rect, alpha ); + } + + //LLRectf uv_rect(0, 0, draw_rect.getWidth()/32.f, draw_rect.getHeight()/32.f); + gl_draw_scaled_image( draw_rect.mLeft, draw_rect.mBottom, draw_rect.getWidth(), draw_rect.getHeight(), mTexturep, UI_VERTEX_COLOR % alpha); + //mTexturep->addTextureStats( (F32)(draw_rect.getWidth() * draw_rect.getHeight()) ); + + mTexturep->setKnownDrawSize(draw_rect.getWidth(), draw_rect.getHeight()); + } + else if( mImagep.notNull() ) + { + mImagep->draw(getLocalRect(), UI_VERTEX_COLOR % alpha ); + } + else + { + gl_rect_2d( draw_rect, LLColor4::grey % alpha, TRUE ); + + // Draw X + gl_draw_x( draw_rect, LLColor4::black ); + } + + // Show "Loading..." string on the top left corner while this texture is loading. + // Using the discard level, do not show the string if the texture is almost but not + // fully loaded. + if (mTexturep.notNull() + && mShowLoadingPlaceholder + && !mTexturep->isFullyLoaded()) + { + U32 v_offset = 25; + LLFontGL* font = LLFontGL::getFontSansSerif(); + + // Don't show as loaded if the texture is almost fully loaded (i.e. discard1) unless god + if ((mTexturep->getDiscardLevel() > 1) || gAgent.isGodlike()) + { + font->renderUTF8( + mLoadingPlaceholderString, + 0, + llfloor(draw_rect.mLeft+3), + llfloor(draw_rect.mTop-v_offset), + LLColor4::white, + LLFontGL::LEFT, + LLFontGL::BASELINE, + LLFontGL::DROP_SHADOW); + } + } + + LLUICtrl::draw(); +} + +// virtual +// value might be a string or a UUID +void LLThumbnailCtrl::setValue(const LLSD& value) +{ + LLSD tvalue(value); + if (value.isString() && LLUUID::validate(value.asString())) + { + //RN: support UUIDs masquerading as strings + tvalue = LLSD(LLUUID(value.asString())); + } + + LLUICtrl::setValue(tvalue); + + mImageAssetID = LLUUID::null; + mTexturep = nullptr; + mImagep = nullptr; + + if (tvalue.isUUID()) + { + mImageAssetID = tvalue.asUUID(); + // Should it support baked textures? + mTexturep = LLViewerTextureManager::getFetchedTexture(mImageAssetID, FTT_DEFAULT, MIPMAP_YES, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE); + + mTexturep->setBoostLevel(mPriority); + mTexturep->forceToSaveRawImage(0); + + S32 desired_draw_width = mTexturep->getWidth(); + S32 desired_draw_height = mTexturep->getHeight(); + + mTexturep->setKnownDrawSize(desired_draw_width, desired_draw_height); + } + else if (tvalue.isString()) + { + mImagep = LLUI::getUIImage(tvalue.asString(), LLGLTexture::BOOST_UI); + if (mImagep) + { + LLViewerFetchedTexture* texture = dynamic_cast(mImagep->getImage().get()); + if(texture) + { + mImageAssetID = texture->getID(); + } + } + } +} + +BOOL LLThumbnailCtrl::handleHover(S32 x, S32 y, MASK mask) +{ + if (mInteractable && getEnabled()) + { + getWindow()->setCursor(UI_CURSOR_HAND); + return TRUE; + } + return LLUICtrl::handleHover(x, y, mask); +} + + -- cgit v1.3 From 627c7de801bcf1f2a706c2c077a3fecf54a3bfe8 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Tue, 7 Feb 2023 12:36:20 +0200 Subject: SL-19134 Some texture related adjustments --- indra/llappearance/CMakeLists.txt | 2 -- indra/llappearance/lltexturemanagerbridge.cpp | 32 ------------------ indra/llappearance/lltexturemanagerbridge.h | 48 --------------------------- indra/llrender/CMakeLists.txt | 2 ++ indra/llrender/lltexturemanagerbridge.cpp | 32 ++++++++++++++++++ indra/llrender/lltexturemanagerbridge.h | 47 ++++++++++++++++++++++++++ indra/llui/lliconctrl.h | 4 ++- indra/newview/llthumbnailctrl.cpp | 2 -- 8 files changed, 84 insertions(+), 85 deletions(-) delete mode 100644 indra/llappearance/lltexturemanagerbridge.cpp delete mode 100644 indra/llappearance/lltexturemanagerbridge.h create mode 100644 indra/llrender/lltexturemanagerbridge.cpp create mode 100644 indra/llrender/lltexturemanagerbridge.h (limited to 'indra/newview/llthumbnailctrl.cpp') diff --git a/indra/llappearance/CMakeLists.txt b/indra/llappearance/CMakeLists.txt index 268849ad74..b3f6c7e32c 100644 --- a/indra/llappearance/CMakeLists.txt +++ b/indra/llappearance/CMakeLists.txt @@ -40,7 +40,6 @@ set(llappearance_SOURCE_FILES lltexglobalcolor.cpp lltexlayer.cpp lltexlayerparams.cpp - lltexturemanagerbridge.cpp llwearable.cpp llwearabledata.cpp llwearabletype.cpp @@ -63,7 +62,6 @@ set(llappearance_HEADER_FILES lltexglobalcolor.h lltexlayer.h lltexlayerparams.h - lltexturemanagerbridge.h llwearable.h llwearabledata.h llwearabletype.h diff --git a/indra/llappearance/lltexturemanagerbridge.cpp b/indra/llappearance/lltexturemanagerbridge.cpp deleted file mode 100644 index 33f2185e4f..0000000000 --- a/indra/llappearance/lltexturemanagerbridge.cpp +++ /dev/null @@ -1,32 +0,0 @@ - /** - * @file lltexturemanagerbridge.cpp - * @brief Defined a null texture manager bridge. Applications must provide their own bridge implementaton. - * - * $LicenseInfo:firstyear=2012&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#include "lltexturemanagerbridge.h" - -// Define a null texture manager bridge. Applications must provide their own bridge implementaton. -LLTextureManagerBridge* gTextureManagerBridgep = NULL; - - diff --git a/indra/llappearance/lltexturemanagerbridge.h b/indra/llappearance/lltexturemanagerbridge.h deleted file mode 100644 index 101704b162..0000000000 --- a/indra/llappearance/lltexturemanagerbridge.h +++ /dev/null @@ -1,48 +0,0 @@ -/** - * @file lltexturemanagerbridge.h - * @brief Bridge to an application-specific texture manager. - * - * $LicenseInfo:firstyear=2012&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#ifndef LL_TEXTUREMANAGERBRIDGE_H -#define LL_TEXTUREMANAGERBRIDGE_H - -#include "llavatarappearancedefines.h" -#include "llpointer.h" -#include "llgltexture.h" - -// Abstract bridge interface -class LLTextureManagerBridge -{ -public: - virtual ~LLTextureManagerBridge() {} - - virtual LLPointer getLocalTexture(BOOL usemipmaps = TRUE, BOOL generate_gl_tex = TRUE) = 0; - virtual LLPointer getLocalTexture(const U32 width, const U32 height, const U8 components, BOOL usemipmaps, BOOL generate_gl_tex = TRUE) = 0; - virtual LLGLTexture* getFetchedTexture(const LLUUID &image_id) = 0; -}; - -extern LLTextureManagerBridge* gTextureManagerBridgep; - -#endif // LL_TEXTUREMANAGERBRIDGE_H - diff --git a/indra/llrender/CMakeLists.txt b/indra/llrender/CMakeLists.txt index baab09a104..94b09127be 100644 --- a/indra/llrender/CMakeLists.txt +++ b/indra/llrender/CMakeLists.txt @@ -48,6 +48,7 @@ set(llrender_SOURCE_FILES llrendertarget.cpp llshadermgr.cpp lltexture.cpp + lltexturemanagerbridge.cpp lluiimage.cpp llvertexbuffer.cpp llglcommonfunc.cpp @@ -77,6 +78,7 @@ set(llrender_HEADER_FILES llrendersphere.h llshadermgr.h lltexture.h + lltexturemanagerbridge.h lluiimage.h lluiimage.inl llvertexbuffer.h diff --git a/indra/llrender/lltexturemanagerbridge.cpp b/indra/llrender/lltexturemanagerbridge.cpp new file mode 100644 index 0000000000..33f2185e4f --- /dev/null +++ b/indra/llrender/lltexturemanagerbridge.cpp @@ -0,0 +1,32 @@ + /** + * @file lltexturemanagerbridge.cpp + * @brief Defined a null texture manager bridge. Applications must provide their own bridge implementaton. + * + * $LicenseInfo:firstyear=2012&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#include "lltexturemanagerbridge.h" + +// Define a null texture manager bridge. Applications must provide their own bridge implementaton. +LLTextureManagerBridge* gTextureManagerBridgep = NULL; + + diff --git a/indra/llrender/lltexturemanagerbridge.h b/indra/llrender/lltexturemanagerbridge.h new file mode 100644 index 0000000000..f61433ea4d --- /dev/null +++ b/indra/llrender/lltexturemanagerbridge.h @@ -0,0 +1,47 @@ +/** + * @file lltexturemanagerbridge.h + * @brief Bridge to an application-specific texture manager. + * + * $LicenseInfo:firstyear=2012&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#ifndef LL_TEXTUREMANAGERBRIDGE_H +#define LL_TEXTUREMANAGERBRIDGE_H + +#include "llpointer.h" +#include "llgltexture.h" + +// Abstract bridge interface +class LLTextureManagerBridge +{ +public: + virtual ~LLTextureManagerBridge() {} + + virtual LLPointer getLocalTexture(BOOL usemipmaps = TRUE, BOOL generate_gl_tex = TRUE) = 0; + virtual LLPointer getLocalTexture(const U32 width, const U32 height, const U8 components, BOOL usemipmaps, BOOL generate_gl_tex = TRUE) = 0; + virtual LLGLTexture* getFetchedTexture(const LLUUID &image_id) = 0; +}; + +extern LLTextureManagerBridge* gTextureManagerBridgep; + +#endif // LL_TEXTUREMANAGERBRIDGE_H + diff --git a/indra/llui/lliconctrl.h b/indra/llui/lliconctrl.h index 9c3b517bca..b5aad17ca6 100644 --- a/indra/llui/lliconctrl.h +++ b/indra/llui/lliconctrl.h @@ -39,7 +39,9 @@ class LLUICtrlFactory; // Classes // -// +// Class for diplaying named UI textures +// Do not use for displaying textures from network, +// UI textures are stored permanently! class LLIconCtrl : public LLUICtrl { diff --git a/indra/newview/llthumbnailctrl.cpp b/indra/newview/llthumbnailctrl.cpp index 35bf9cb04c..8f51f2c80d 100644 --- a/indra/newview/llthumbnailctrl.cpp +++ b/indra/newview/llthumbnailctrl.cpp @@ -100,9 +100,7 @@ void LLThumbnailCtrl::draw() gl_rect_2d_checkerboard( draw_rect, alpha ); } - //LLRectf uv_rect(0, 0, draw_rect.getWidth()/32.f, draw_rect.getHeight()/32.f); gl_draw_scaled_image( draw_rect.mLeft, draw_rect.mBottom, draw_rect.getWidth(), draw_rect.getHeight(), mTexturep, UI_VERTEX_COLOR % alpha); - //mTexturep->addTextureStats( (F32)(draw_rect.getWidth() * draw_rect.getHeight()) ); mTexturep->setKnownDrawSize(draw_rect.getWidth(), draw_rect.getHeight()); } -- cgit v1.3 From 39a50b0face299bbcae2a63f3fd51a41f8bb35cd Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Wed, 8 Feb 2023 21:41:43 +0200 Subject: SL-19134 Fix thumbnail ctrl not drawing an 'X' for empty texture --- indra/newview/llthumbnailctrl.cpp | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) (limited to 'indra/newview/llthumbnailctrl.cpp') diff --git a/indra/newview/llthumbnailctrl.cpp b/indra/newview/llthumbnailctrl.cpp index 8f51f2c80d..4245237529 100644 --- a/indra/newview/llthumbnailctrl.cpp +++ b/indra/newview/llthumbnailctrl.cpp @@ -164,16 +164,19 @@ void LLThumbnailCtrl::setValue(const LLSD& value) if (tvalue.isUUID()) { mImageAssetID = tvalue.asUUID(); - // Should it support baked textures? - mTexturep = LLViewerTextureManager::getFetchedTexture(mImageAssetID, FTT_DEFAULT, MIPMAP_YES, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE); + if (mImageAssetID.notNull()) + { + // Should it support baked textures? + mTexturep = LLViewerTextureManager::getFetchedTexture(mImageAssetID, FTT_DEFAULT, MIPMAP_YES, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE); - mTexturep->setBoostLevel(mPriority); - mTexturep->forceToSaveRawImage(0); - - S32 desired_draw_width = mTexturep->getWidth(); - S32 desired_draw_height = mTexturep->getHeight(); - - mTexturep->setKnownDrawSize(desired_draw_width, desired_draw_height); + mTexturep->setBoostLevel(mPriority); + mTexturep->forceToSaveRawImage(0); + + S32 desired_draw_width = mTexturep->getWidth(); + S32 desired_draw_height = mTexturep->getHeight(); + + mTexturep->setKnownDrawSize(desired_draw_width, desired_draw_height); + } } else if (tvalue.isString()) { -- cgit v1.3 From 2b56570c6867dc39aa4c8a19d2657ffed6c596b2 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Fri, 24 Feb 2023 12:51:03 +0200 Subject: SL-19108 Fallback thumbnail --- indra/newview/llthumbnailctrl.cpp | 28 ++++++++++++++++++++- indra/newview/llthumbnailctrl.h | 2 ++ .../textures/icons/thumbnail_fallback_icon.png | Bin 0 -> 6162 bytes indra/newview/skins/default/textures/textures.xml | 1 + .../xui/en/floater_change_item_thumbnail.xml | 1 + .../skins/default/xui/en/sidepanel_item_info.xml | 1 + 6 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 indra/newview/skins/default/textures/icons/thumbnail_fallback_icon.png (limited to 'indra/newview/llthumbnailctrl.cpp') 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 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 border; Optional border_color; Optional image_name; + Optional fallback_image; Optional border_visible; Optional interactable; Optional show_loading; @@ -80,6 +81,7 @@ private: LLPointer mTexturep; LLPointer mImagep; + LLPointer 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 new file mode 100644 index 0000000000..8d5ca624af Binary files /dev/null and b/indra/newview/skins/default/textures/icons/thumbnail_fallback_icon.png differ 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 + Date: Fri, 31 Mar 2023 21:18:50 +0300 Subject: SL-19379 WIP show fallback image with original size --- indra/newview/llinventorygallery.cpp | 2 +- indra/newview/llthumbnailctrl.cpp | 7 +++++++ indra/newview/llthumbnailctrl.h | 1 + .../newview/skins/default/xui/en/panel_inventory_gallery_item.xml | 2 +- 4 files changed, 10 insertions(+), 2 deletions(-) (limited to 'indra/newview/llthumbnailctrl.cpp') diff --git a/indra/newview/llinventorygallery.cpp b/indra/newview/llinventorygallery.cpp index 499d51c431..290688f179 100644 --- a/indra/newview/llinventorygallery.cpp +++ b/indra/newview/llinventorygallery.cpp @@ -1081,7 +1081,7 @@ void LLInventoryGalleryItem::setThumbnail(LLUUID id) mDefaultImage = id.isNull(); if(mDefaultImage) { - getChild("preview_thumbnail")->setValue("Thumbnail_Fallback"); + getChild("preview_thumbnail")->clearTexture(); } else { diff --git a/indra/newview/llthumbnailctrl.cpp b/indra/newview/llthumbnailctrl.cpp index 1b054b4c27..340dba3717 100644 --- a/indra/newview/llthumbnailctrl.cpp +++ b/indra/newview/llthumbnailctrl.cpp @@ -170,6 +170,13 @@ void LLThumbnailCtrl::draw() LLUICtrl::draw(); } +void LLThumbnailCtrl::clearTexture() +{ + mImageAssetID = LLUUID::null; + mTexturep = nullptr; + mImagep = nullptr; +} + // virtual // value might be a string or a UUID void LLThumbnailCtrl::setValue(const LLSD& value) diff --git a/indra/newview/llthumbnailctrl.h b/indra/newview/llthumbnailctrl.h index dc21046841..686603b373 100644 --- a/indra/newview/llthumbnailctrl.h +++ b/indra/newview/llthumbnailctrl.h @@ -66,6 +66,7 @@ public: virtual void draw() override; virtual void setValue(const LLSD& value ) override; + void clearTexture(); virtual BOOL handleHover(S32 x, S32 y, MASK mask) override; diff --git a/indra/newview/skins/default/xui/en/panel_inventory_gallery_item.xml b/indra/newview/skins/default/xui/en/panel_inventory_gallery_item.xml index 05a02158c0..b343aafca5 100644 --- a/indra/newview/skins/default/xui/en/panel_inventory_gallery_item.xml +++ b/indra/newview/skins/default/xui/en/panel_inventory_gallery_item.xml @@ -16,7 +16,7 @@ (worn) Date: Mon, 14 Aug 2023 20:07:46 +0300 Subject: SL-20143 Alpha thumbnails should show solid color instead of checkerboard --- indra/newview/llthumbnailctrl.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'indra/newview/llthumbnailctrl.cpp') diff --git a/indra/newview/llthumbnailctrl.cpp b/indra/newview/llthumbnailctrl.cpp index 340dba3717..04130fc724 100644 --- a/indra/newview/llthumbnailctrl.cpp +++ b/indra/newview/llthumbnailctrl.cpp @@ -100,7 +100,8 @@ void LLThumbnailCtrl::draw() { if( mTexturep->getComponents() == 4 ) { - gl_rect_2d_checkerboard( draw_rect, alpha ); + const LLColor4 color(.098f, .098f, .098f); + gl_rect_2d( draw_rect, color, TRUE); } gl_draw_scaled_image( draw_rect.mLeft, draw_rect.mBottom, draw_rect.getWidth(), draw_rect.getHeight(), mTexturep, UI_VERTEX_COLOR % alpha); -- cgit v1.3