diff options
Diffstat (limited to 'indra/newview/lltextureview.cpp')
-rw-r--r-- | indra/newview/lltextureview.cpp | 61 |
1 files changed, 42 insertions, 19 deletions
diff --git a/indra/newview/lltextureview.cpp b/indra/newview/lltextureview.cpp index f00d5e5b48..50b73bfbc7 100644 --- a/indra/newview/lltextureview.cpp +++ b/indra/newview/lltextureview.cpp @@ -83,12 +83,20 @@ public: S32 mHilite; public: - LLTextureBar(const std::string& name, const LLRect& r, LLTextureView* texview) - : LLView(name, r, FALSE), - mHilite(0), - mTextureView(texview) + struct Params : public LLInitParam::Block<Params, LLView::Params> { - } + Mandatory<LLTextureView*> texture_view; + Params() + : texture_view("texture_view") + { + mouse_opaque(false); + } + }; + LLTextureBar(const Params& p) + : LLView(p), + mHilite(0), + mTextureView(p.texture_view) + {} virtual void draw(); virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask); @@ -366,13 +374,21 @@ LLRect LLTextureBar::getRequiredRect() class LLGLTexMemBar : public LLView { public: - LLGLTexMemBar(const std::string& name, LLTextureView* texview) - : LLView(name, FALSE), - mTextureView(texview) + struct Params : public LLInitParam::Block<Params, LLView::Params> { - S32 line_height = (S32)(LLFontGL::getFontMonospace()->getLineHeight() + .5f); - setRect(LLRect(0,0,100,line_height * 4)); - } + Mandatory<LLTextureView*> texture_view; + Params() + : texture_view("texture_view") + { + S32 line_height = (S32)(LLFontGL::getFontMonospace()->getLineHeight() + .5f); + rect(LLRect(0,0,100,line_height * 4)); + } + }; + + LLGLTexMemBar(const Params& p) + : LLView(p), + mTextureView(p.texture_view) + {} virtual void draw(); virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask); @@ -384,10 +400,10 @@ private: void LLGLTexMemBar::draw() { - S32 bound_mem = (LLViewerImage::sBoundTextureMemory >> 20); - S32 max_bound_mem = LLViewerImage::sMaxBoundTextureMem; - S32 total_mem = (LLViewerImage::sTotalTextureMemory >> 20); - S32 max_total_mem = LLViewerImage::sMaxTotalTextureMem; + S32 bound_mem = BYTES_TO_MEGA_BYTES(LLViewerImage::sBoundTextureMemoryInBytes); + S32 max_bound_mem = LLViewerImage::sMaxBoundTextureMemInMegaBytes; + S32 total_mem = BYTES_TO_MEGA_BYTES(LLViewerImage::sTotalTextureMemoryInBytes); + S32 max_total_mem = LLViewerImage::sMaxTotalTextureMemInMegaBytes; F32 discard_bias = LLViewerImage::sDesiredDiscardBias; S32 line_height = (S32)(LLFontGL::getFontMonospace()->getLineHeight() + .5f); @@ -521,8 +537,8 @@ LLRect LLGLTexMemBar::getRequiredRect() //////////////////////////////////////////////////////////////////////////// -LLTextureView::LLTextureView(const std::string& name, const LLRect& rect) - : LLContainerView(name, rect), +LLTextureView::LLTextureView(const LLTextureView::Params& p) + : LLContainerView(p), mFreezeView(FALSE), mOrderFetch(FALSE), mPrintList(FALSE), @@ -709,7 +725,10 @@ void LLTextureView::draw() else sortChildren(LLTextureBar::sort()); - mGLTexMemBar = new LLGLTexMemBar("gl texmem bar", this); + LLGLTexMemBar::Params tmbp; + tmbp.name("gl texmem bar"); + tmbp.texture_view(this); + mGLTexMemBar = LLUICtrlFactory::create<LLGLTexMemBar>(tmbp); addChild(mGLTexMemBar); reshape(getRect().getWidth(), getRect().getHeight(), TRUE); @@ -746,7 +765,11 @@ BOOL LLTextureView::addBar(LLViewerImage *imagep, S32 hilite) mNumTextureBars++; - barp = new LLTextureBar("texture bar", r, this); + LLTextureBar::Params tbp; + tbp.name("texture bar"); + tbp.rect(r); + tbp.texture_view(this); + barp = LLUICtrlFactory::create<LLTextureBar>(tbp); barp->mImagep = imagep; barp->mHilite = hilite; |