Add masking feature to texture picker control; Original implementation by Skills Hak, with permission to use under LGPL

meow-7.2.2
Ansariel 2013-04-23 18:22:10 +02:00
parent 810f1821e8
commit 9230cd37c1
2 changed files with 16 additions and 0 deletions

View File

@ -1102,6 +1102,9 @@ LLTextureCtrl::LLTextureCtrl(const LLTextureCtrl::Params& p)
mDefaultImageAssetID(p.default_image_id),
mDefaultImageName(p.default_image_name),
mFallbackImage(p.fallback_image),
// <FS:Ansariel> Mask texture if desired
mIsMasked(FALSE),
// </FS:Ansariel> Mask texture if desired
mPreviewMode(!p.enabled) // For texture preview mode
{
setAllowNoTexture(p.allow_no_texture);
@ -1535,6 +1538,13 @@ void LLTextureCtrl::draw()
gl_draw_scaled_image( interior.mLeft, interior.mBottom, interior.getWidth(), interior.getHeight(), mTexturep, UI_VERTEX_COLOR % alpha);
mTexturep->addTextureStats( (F32)(interior.getWidth() * interior.getHeight()) );
// <FS:Ansariel> Mask texture if desired
if (mIsMasked)
{
gl_rect_2d( interior, LLColor4(0.5, 0.5, 0.5, 0.44), TRUE);
gl_draw_x( interior, LLColor4::black );
}
// </FS:Ansariel> Mask texture if desired
}
else if (!mFallbackImage.isNull())
{

View File

@ -186,6 +186,9 @@ public:
LLViewerFetchedTexture* getTexture() { return mTexturep; }
// <FS:Ansariel> Mask texture if desired
void setIsMasked(BOOL masked) { mIsMasked = masked; }
private:
BOOL allowDrop(LLInventoryItem* item);
BOOL doDrop(LLInventoryItem* item);
@ -220,6 +223,9 @@ private:
std::string mLoadingPlaceholderString;
S32 mLabelWidth;
BOOL mPreviewMode; // If true open texture in preview floater
// <FS:Ansariel> Mask texture if desired
BOOL mIsMasked;
};
// XUI HACK: When floaters converted, switch this file to lltexturepicker.h/cpp