void LLTextureCtrl::draw() { mBorder->setKeyboardFocusHighlight(hasFocus()); if (!mValid) { mTexturep = NULL; } else if (!mImageAssetID.isNull()) { mTexturep = LLViewerTextureManager::getFetchedTexture(mImageAssetID, MIPMAP_YES,LLViewerTexture::BOOST_PREVIEW, LLViewerTexture::LOD_TEXTURE); mTexturep->forceToSaveRawImage(0) ; } else if (!mFallbackImageName.empty()) { // Show fallback image. mTexturep = LLViewerTextureManager::getFetchedTextureFromFile(mFallbackImageName, MIPMAP_YES,LLViewerTexture::BOOST_PREVIEW, LLViewerTexture::LOD_TEXTURE); } else // mImageAssetID == LLUUID::null { mTexturep = NULL; } // Border LLRect border( 0, getRect().getHeight(), getRect().getWidth(), BTN_HEIGHT_SMALL ); gl_rect_2d( border, mBorderColor, FALSE ); // Interior LLRect interior = border; interior.stretch( -1 ); if( mTexturep ) { if( mTexturep->getComponents() == 4 ) { gl_rect_2d_checkerboard( interior ); } gl_draw_scaled_image( interior.mLeft, interior.mBottom, interior.getWidth(), interior.getHeight(), mTexturep); mTexturep->addTextureStats( (F32)(interior.getWidth() * interior.getHeight()) ); } else { gl_rect_2d( interior, LLColor4::grey, TRUE ); // Draw X gl_draw_x( interior, LLColor4::black ); } mTentativeLabel->setVisible( !mTexturep.isNull() && getTentative() ); // 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() && (!mTexturep->isFullyLoaded()) && (mShowLoadingPlaceholder == TRUE)) { LLFontGL* font = LLFontGL::getFontSansSerifBig(); font->renderUTF8( mLoadingPlaceholderString, 0, llfloor(interior.mLeft+10), llfloor(interior.mTop-20), LLColor4::white, LLFontGL::LEFT, LLFontGL::BASELINE, LLFontGL::NORMAL, LLFontGL::DROP_SHADOW); } LLUICtrl::draw(); }
void LLTextureCtrl::draw() { mBorder->setKeyboardFocusHighlight(hasFocus()); if (!mValid) { mTexturep = NULL; } else if (!mImageAssetID.isNull()) { LLPointer<LLViewerFetchedTexture> texture = LLViewerTextureManager::getFetchedTexture(mImageAssetID, MIPMAP_YES,LLViewerTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE); texture->setBoostLevel(LLViewerTexture::BOOST_PREVIEW); texture->forceToSaveRawImage(0) ; mTexturep = texture; } else//mImageAssetID == LLUUID::null { mTexturep = NULL; } // Border LLRect border( 0, getRect().getHeight(), getRect().getWidth(), BTN_HEIGHT_SMALL ); gl_rect_2d( border, mBorderColor.get(), FALSE ); // Interior LLRect interior = border; interior.stretch( -1 ); // If we're in a focused floater, don't apply the floater's alpha to the texture (STORM-677). const F32 alpha = getTransparencyType() == TT_ACTIVE ? 1.0f : getCurrentTransparency(); if( mTexturep ) { if( mTexturep->getComponents() == 4 ) { gl_rect_2d_checkerboard( interior, alpha ); } gl_draw_scaled_image( interior.mLeft, interior.mBottom, interior.getWidth(), interior.getHeight(), mTexturep, UI_VERTEX_COLOR % alpha); mTexturep->addTextureStats( (F32)(interior.getWidth() * interior.getHeight()) ); } else if (!mFallbackImage.isNull()) { mFallbackImage->draw(interior, UI_VERTEX_COLOR % alpha); } else { gl_rect_2d( interior, LLColor4::grey % alpha, TRUE ); // Draw X gl_draw_x( interior, LLColor4::black ); } mTentativeLabel->setVisible( !mTexturep.isNull() && getTentative() ); // 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() && (!mTexturep->isFullyLoaded()) && (mShowLoadingPlaceholder == TRUE)) { 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(interior.mLeft+3), llfloor(interior.mTop-v_offset), LLColor4::white, LLFontGL::LEFT, LLFontGL::BASELINE, LLFontGL::DROP_SHADOW); } // Optionally show more detailed information. if (gSavedSettings.getBOOL("DebugAvatarRezTime")) { LLFontGL* font = LLFontGL::getFontSansSerif(); std::string tdesc; // Show what % the texture has loaded (0 to 100%, 100 is highest), and what level of detail (5 to 0, 0 is best). v_offset += 12; tdesc = llformat(" PK : %d%%", U32(mTexturep->getDownloadProgress()*100.0)); font->renderUTF8(tdesc, 0, llfloor(interior.mLeft+3), llfloor(interior.mTop-v_offset), LLColor4::white, LLFontGL::LEFT, LLFontGL::BASELINE, LLFontGL::DROP_SHADOW); v_offset += 12; tdesc = llformat(" LVL: %d", mTexturep->getDiscardLevel()); font->renderUTF8(tdesc, 0, llfloor(interior.mLeft+3), llfloor(interior.mTop-v_offset), LLColor4::white, LLFontGL::LEFT, LLFontGL::BASELINE, LLFontGL::DROP_SHADOW); v_offset += 12; tdesc = llformat(" ID : %s...", (mImageAssetID.asString().substr(0,7)).c_str()); font->renderUTF8(tdesc, 0, llfloor(interior.mLeft+3), llfloor(interior.mTop-v_offset), LLColor4::white, LLFontGL::LEFT, LLFontGL::BASELINE, LLFontGL::DROP_SHADOW); } } LLUICtrl::draw(); }
void lggBeamColorMapFloater::draw() { //set the color of the preview thing LLColorSwatchCtrl* colorctrl = getChild<LLColorSwatchCtrl>("BeamColor_Preview"); LLColor4 bColor = LLColor4(lggBeamMaps::beamColorFromData(myData)); colorctrl->set(bColor,TRUE); //Try draw rectangle attach beam LLRect swatch_rect; LLButton* createButton = empanel->getChild<LLButton>("BeamColor_new"); createButton->localRectToOtherView(createButton->getLocalRect(), &swatch_rect, this); LLRect local_rect = getLocalRect(); if (gFocusMgr.childHasKeyboardFocus(this) && empanel->isInVisibleChain() && mContextConeOpacity > 0.001f) { gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); LLGLEnable(GL_CULL_FACE); gGL.begin(LLRender::QUADS); { F32 r = bColor.mV[0]; F32 g = bColor.mV[1]; F32 b = bColor.mV[2]; gGL.color4f(r, g, b, CONTEXT_CONE_IN_ALPHA * mContextConeOpacity); gGL.vertex2i(swatch_rect.mLeft, swatch_rect.mTop); gGL.vertex2i(swatch_rect.mRight, swatch_rect.mTop); gGL.color4f(r, g, b, CONTEXT_CONE_OUT_ALPHA * mContextConeOpacity); gGL.vertex2i(local_rect.mRight, local_rect.mTop); gGL.vertex2i(local_rect.mLeft, local_rect.mTop); gGL.color4f(r, g, b, CONTEXT_CONE_OUT_ALPHA * mContextConeOpacity); gGL.vertex2i(local_rect.mLeft, local_rect.mTop); gGL.vertex2i(local_rect.mLeft, local_rect.mBottom); gGL.color4f(r, g, b, CONTEXT_CONE_IN_ALPHA * mContextConeOpacity); gGL.vertex2i(swatch_rect.mLeft, swatch_rect.mBottom); gGL.vertex2i(swatch_rect.mLeft, swatch_rect.mTop); gGL.color4f(r, g, b, CONTEXT_CONE_OUT_ALPHA * mContextConeOpacity); gGL.vertex2i(local_rect.mRight, local_rect.mBottom); gGL.vertex2i(local_rect.mRight, local_rect.mTop); gGL.color4f(r, g, b, CONTEXT_CONE_IN_ALPHA * mContextConeOpacity); gGL.vertex2i(swatch_rect.mRight, swatch_rect.mTop); gGL.vertex2i(swatch_rect.mRight, swatch_rect.mBottom); gGL.color4f(r, g, b, CONTEXT_CONE_OUT_ALPHA * mContextConeOpacity); gGL.vertex2i(local_rect.mLeft, local_rect.mBottom); gGL.vertex2i(local_rect.mRight, local_rect.mBottom); gGL.color4f(r, g, b, CONTEXT_CONE_IN_ALPHA * mContextConeOpacity); gGL.vertex2i(swatch_rect.mRight, swatch_rect.mBottom); gGL.vertex2i(swatch_rect.mLeft, swatch_rect.mBottom); } gGL.end(); } static LLCachedControl<F32> opacity(gSavedSettings, "PickerContextOpacity"); mContextConeOpacity = lerp(mContextConeOpacity, opacity, LLCriticalDamp::getInterpolant(CONTEXT_FADE_TIME)); //Draw Base Stuff LLFloater::draw(); //Draw hues and pointers at color gGL.pushMatrix(); F32 r, g, b; LLColor4 output; for (int i = 0;i <= 720;i++) { int hi =i%360; hslToRgb1((hi/360.0f), 1.0f, 0.5f, r, g, b); output.set(r, g, b); gl_line_2d( convertHueToX(i),201, convertHueToX(i),277,output); } S32 X1 = convertHueToX(myData.startHue); S32 X2 = convertHueToX(myData.endHue); LLFontGL* font = LLFontGL::getFontSansSerifSmall(); gGL.color4fv(LLColor4::white.mV); gl_circle_2d(X1,238,9.0f,(S32)30,false); gGL.color4fv(LLColor4::black.mV); gl_circle_2d(X1,238,8.0f,(S32)30,false); gGL.color4fv(LLColor4::white.mV); gl_circle_2d(X1,238,7.0f,(S32)30,false); gl_line_2d(X1+1,210,X1+1,266,LLColor4::white); gl_line_2d(X1-1,210,X1-1,266,LLColor4::white); gl_line_2d(X1,210,X1,266,LLColor4::black); gl_line_2d(X1-25,238+1,X1+25,238+1,LLColor4::white); gl_line_2d(X1-25,238-1,X1+25,238-1,LLColor4::white); gl_line_2d(X1-25,238,X1+25,238,LLColor4::black); font->renderUTF8( "Start Hue", 0, X1, 212, LLColor4::white, LLFontGL::HCENTER, LLFontGL::BASELINE, LLFontGL::DROP_SHADOW); gGL.color4fv(LLColor4::white.mV); gl_circle_2d(X2,238,9.0f,(S32)30,false); gGL.color4fv(LLColor4::black.mV); gl_circle_2d(X2,238,8.0f,(S32)30,false); gGL.color4fv(LLColor4::white.mV); gl_circle_2d(X2,238,7.0f,(S32)30,false); gl_line_2d(X2+1,210,X2+1,266,LLColor4::white); gl_line_2d(X2-1,210,X2-1,266,LLColor4::white); gl_line_2d(X2,210,X2,266,LLColor4::black); gl_line_2d(X2-25,238+1,X2+25,238+1,LLColor4::white); gl_line_2d(X2-25,238-1,X2+25,238-1,LLColor4::white); gl_line_2d(X2-25,238,X2+25,238,LLColor4::black); font->renderUTF8( "End Hue", 0, X2, 212, LLColor4::white, LLFontGL::HCENTER, LLFontGL::BASELINE, LLFontGL::DROP_SHADOW); gGL.popMatrix(); }