Innitial commit. Did as much as I can for llmediactrl without diving too deep into llviewermedia
This commit is contained in:
@@ -62,6 +62,28 @@ LLFloaterMediaBrowser::LLFloaterMediaBrowser(const LLSD& media_data)
|
||||
|
||||
}
|
||||
|
||||
|
||||
void LLFloaterMediaBrowser::geometryChanged(S32 x, S32 y, S32 width, S32 height)
|
||||
{
|
||||
// Make sure the layout of the browser control is updated, so this calculation is correct.
|
||||
LLLayoutStack::updateClass();
|
||||
|
||||
// TODO: need to adjust size and constrain position to make sure floaters aren't moved outside the window view, etc.
|
||||
LLCoordWindow window_size;
|
||||
getWindow()->getSize(&window_size);
|
||||
|
||||
// Adjust width and height for the size of the chrome on the Media Browser window.
|
||||
width += getRect().getWidth() - mBrowser->getRect().getWidth();
|
||||
height += getRect().getHeight() - mBrowser->getRect().getHeight();
|
||||
|
||||
LLRect geom;
|
||||
geom.setOriginAndSize(x, window_size.mY - (y + height), width, height);
|
||||
|
||||
lldebugs << "geometry change: " << geom << llendl;
|
||||
|
||||
handleReshape(geom,false);
|
||||
}
|
||||
|
||||
void LLFloaterMediaBrowser::draw()
|
||||
{
|
||||
childSetEnabled("go", !mAddressCombo->getValue().asString().empty());
|
||||
@@ -105,6 +127,7 @@ BOOL LLFloaterMediaBrowser::postBuild()
|
||||
mAddressCombo = getChild<LLComboBox>("address");
|
||||
mAddressCombo->setCommitCallback(onEnterAddress);
|
||||
mAddressCombo->setCallbackUserData(this);
|
||||
mAddressCombo->sortByName();
|
||||
|
||||
childSetAction("back", onClickBack, this);
|
||||
childSetAction("forward", onClickForward, this);
|
||||
@@ -146,7 +169,10 @@ void LLFloaterMediaBrowser::buildURLHistory()
|
||||
}
|
||||
|
||||
// initialize URL history in the plugin
|
||||
mBrowser->getMediaPlugin()->initializeUrlHistory(browser_history);
|
||||
if(mBrowser && mBrowser->getMediaPlugin())
|
||||
{
|
||||
mBrowser->getMediaPlugin()->initializeUrlHistory(browser_history);
|
||||
}
|
||||
}
|
||||
|
||||
std::string LLFloaterMediaBrowser::getSupportURL()
|
||||
@@ -171,6 +197,15 @@ void LLFloaterMediaBrowser::handleMediaEvent(LLPluginClassMedia* self, EMediaEve
|
||||
childSetEnabled("back", self->getHistoryBackAvailable());
|
||||
childSetEnabled("forward", self->getHistoryForwardAvailable());
|
||||
}
|
||||
else if(event == MEDIA_EVENT_CLOSE_REQUEST)
|
||||
{
|
||||
// The browser instance wants its window closed.
|
||||
close();
|
||||
}
|
||||
else if(event == MEDIA_EVENT_GEOMETRY_CHANGE)
|
||||
{
|
||||
geometryChanged(self->getGeometryX(), self->getGeometryY(), self->getGeometryWidth(), self->getGeometryHeight());
|
||||
}
|
||||
}
|
||||
void LLFloaterMediaBrowser::setCurrentURL(const std::string& url)
|
||||
{
|
||||
@@ -213,7 +248,15 @@ void LLFloaterMediaBrowser::onClickRefresh(void* user_data)
|
||||
LLFloaterMediaBrowser* self = (LLFloaterMediaBrowser*)user_data;
|
||||
|
||||
self->mAddressCombo->remove(0);
|
||||
self->mBrowser->navigateTo(self->mCurrentURL);
|
||||
if( self->mBrowser->getMediaPlugin() && self->mBrowser->getMediaPlugin()->pluginSupportsMediaBrowser())
|
||||
{
|
||||
bool ignore_cache = true;
|
||||
self->mBrowser->getMediaPlugin()->browse_reload( ignore_cache );
|
||||
}
|
||||
else
|
||||
{
|
||||
self->mBrowser->navigateTo(self->mCurrentURL);
|
||||
}
|
||||
}
|
||||
|
||||
//static
|
||||
|
||||
@@ -64,6 +64,9 @@ class LLFloaterMediaBrowser :
|
||||
public:
|
||||
LLFloaterMediaBrowser(const LLSD& media_data);
|
||||
|
||||
|
||||
void geometryChanged(S32 x, S32 y, S32 width, S32 height);
|
||||
|
||||
/*virtual*/ BOOL postBuild();
|
||||
/*virtual*/ void onClose(bool app_quitting);
|
||||
/*virtual*/ void draw();
|
||||
|
||||
@@ -64,6 +64,7 @@ static LLRegisterWidget<LLMediaCtrl> r("web_browser");
|
||||
|
||||
LLMediaCtrl::LLMediaCtrl( const std::string& name, const LLRect& rect ) :
|
||||
LLUICtrl( name, rect, FALSE, NULL, NULL ),
|
||||
LLInstanceTracker<LLMediaCtrl, LLUUID>(LLUUID::generateNewID()),
|
||||
mTextureDepthBytes( 4 ),
|
||||
mWebBrowserImage( 0 ),
|
||||
mBorder(NULL),
|
||||
@@ -82,28 +83,26 @@ LLMediaCtrl::LLMediaCtrl( const std::string& name, const LLRect& rect ) :
|
||||
mLastSetCursor( UI_CURSOR_ARROW ),
|
||||
mStretchToFill( true ),
|
||||
mMaintainAspectRatio ( true ),
|
||||
mDecoupleTextureSize ( false ),
|
||||
mTextureWidth ( 1024 ),
|
||||
mTextureHeight ( 1024 ),
|
||||
mHideLoading (false)
|
||||
{
|
||||
S32 screen_width = mIgnoreUIScale ?
|
||||
llround((F32)getRect().getWidth() * LLUI::sGLScaleFactor.mV[VX]) : getRect().getWidth();
|
||||
S32 screen_height = mIgnoreUIScale ?
|
||||
llround((F32)getRect().getHeight() * LLUI::sGLScaleFactor.mV[VY]) : getRect().getHeight();
|
||||
|
||||
mMediaSource = LLViewerMedia::newMediaImpl(mHomePageUrl, LLUUID::null, screen_width, screen_height, false, false, "text/html");
|
||||
if ( !mMediaSource )
|
||||
if(!getDecoupleTextureSize())
|
||||
{
|
||||
llwarns << "media source create failed " << llendl;
|
||||
return;
|
||||
S32 screen_width = mIgnoreUIScale ?
|
||||
llround((F32)getRect().getWidth() * LLUI::sGLScaleFactor.mV[VX]) : getRect().getWidth();
|
||||
S32 screen_height = mIgnoreUIScale ?
|
||||
llround((F32)getRect().getHeight() * LLUI::sGLScaleFactor.mV[VY]) : getRect().getHeight();
|
||||
|
||||
setTextureSize(screen_width, screen_height);
|
||||
}
|
||||
else
|
||||
// We don't need to create the media source up front anymore unless we have a non-empty home URL to navigate to.
|
||||
if(!mHomePageUrl.empty())
|
||||
{
|
||||
// create a new texture (based on LLDynamic texture) that will be used to display the output
|
||||
mWebBrowserImage = new LLWebBrowserTexture( screen_width, screen_height, this, mMediaSource );
|
||||
navigateHome();
|
||||
}
|
||||
|
||||
mMediaSource->setVisible( getVisible() );
|
||||
|
||||
mMediaSource->addObserver( this );
|
||||
|
||||
|
||||
LLRect border_rect( 0, getRect().getHeight() + 2, getRect().getWidth() + 2, 0 );
|
||||
mBorder = new LLViewBorder( std::string("web control border"), border_rect, LLViewBorder::BEVEL_IN );
|
||||
@@ -121,10 +120,7 @@ LLMediaCtrl::~LLMediaCtrl()
|
||||
mMediaSource = NULL;
|
||||
}
|
||||
|
||||
if ( mWebBrowserImage )
|
||||
{
|
||||
mWebBrowserImage = NULL;
|
||||
}
|
||||
mWebBrowserImage = NULL;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -144,6 +140,7 @@ void LLMediaCtrl::setTakeFocusOnClick( bool take_focus )
|
||||
mTakeFocusOnClick = take_focus;
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// set flag that forces the embedded browser to open links in the external system browser
|
||||
void LLMediaCtrl::setOpenInExternalBrowser( bool valIn )
|
||||
@@ -168,12 +165,15 @@ void LLMediaCtrl::setTrusted( bool valIn )
|
||||
//
|
||||
BOOL LLMediaCtrl::handleHover( S32 x, S32 y, MASK mask )
|
||||
{
|
||||
if (LLUICtrl::handleHover(x, y, mask)) return TRUE;
|
||||
convertInputCoords(x, y);
|
||||
|
||||
if (mMediaSource)
|
||||
{
|
||||
mMediaSource->mouseMove(x, y);
|
||||
|
||||
gViewerWindow->setCursor(mLastSetCursor);
|
||||
gViewerWindow->setCursor(mLastSetCursor);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
@@ -182,6 +182,7 @@ BOOL LLMediaCtrl::handleHover( S32 x, S32 y, MASK mask )
|
||||
//
|
||||
BOOL LLMediaCtrl::handleScrollWheel( S32 x, S32 y, S32 clicks )
|
||||
{
|
||||
if (LLUICtrl::handleScrollWheel(x, y, clicks)) return TRUE;
|
||||
if (mMediaSource && mMediaSource->hasMedia())
|
||||
mMediaSource->getMediaPlugin()->scrollEvent(0, clicks, MASK_NONE);
|
||||
|
||||
@@ -192,19 +193,20 @@ BOOL LLMediaCtrl::handleScrollWheel( S32 x, S32 y, S32 clicks )
|
||||
//
|
||||
BOOL LLMediaCtrl::handleMouseUp( S32 x, S32 y, MASK mask )
|
||||
{
|
||||
if (LLUICtrl::handleMouseUp(x, y, mask)) return TRUE;
|
||||
convertInputCoords(x, y);
|
||||
|
||||
if (mMediaSource)
|
||||
{
|
||||
mMediaSource->mouseUp(x, y);
|
||||
|
||||
// *HACK: LLMediaImplLLMozLib automatically takes focus on mouseup,
|
||||
/*// *HACK: LLMediaImplLLMozLib automatically takes focus on mouseup,
|
||||
// in addition to the onFocusReceived() call below. Undo this. JC
|
||||
if (!mTakeFocusOnClick)
|
||||
{
|
||||
mMediaSource->focus(false);
|
||||
gViewerWindow->focusClient();
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
gFocusMgr.setMouseCapture( NULL );
|
||||
@@ -216,6 +218,7 @@ BOOL LLMediaCtrl::handleMouseUp( S32 x, S32 y, MASK mask )
|
||||
//
|
||||
BOOL LLMediaCtrl::handleMouseDown( S32 x, S32 y, MASK mask )
|
||||
{
|
||||
if (LLUICtrl::handleMouseDown(x, y, mask)) return TRUE;
|
||||
convertInputCoords(x, y);
|
||||
|
||||
if (mMediaSource)
|
||||
@@ -233,12 +236,60 @@ BOOL LLMediaCtrl::handleMouseDown( S32 x, S32 y, MASK mask )
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
BOOL LLMediaCtrl::handleDoubleClick( S32 x, S32 y, MASK mask )
|
||||
BOOL LLMediaCtrl::handleRightMouseUp( S32 x, S32 y, MASK mask )
|
||||
{
|
||||
/*if (LLPanel::handleRightMouseUp(x, y, mask)) return TRUE;
|
||||
convertInputCoords(x, y);
|
||||
|
||||
if (mMediaSource)
|
||||
mMediaSource->mouseLeftDoubleClick( x, y );
|
||||
{
|
||||
mMediaSource->mouseUp(x, y, mask, 1);
|
||||
|
||||
// *HACK: LLMediaImplLLMozLib automatically takes focus on mouseup,
|
||||
// in addition to the onFocusReceived() call below. Undo this. JC
|
||||
if (!mTakeFocusOnClick)
|
||||
{
|
||||
mMediaSource->focus(false);
|
||||
gViewerWindow->focusClient();
|
||||
}
|
||||
}
|
||||
|
||||
gFocusMgr.setMouseCapture( NULL );
|
||||
*/
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
BOOL LLMediaCtrl::handleRightMouseDown( S32 x, S32 y, MASK mask )
|
||||
{
|
||||
if (LLUICtrl::handleRightMouseDown(x, y, mask)) return TRUE;
|
||||
|
||||
/*S32 media_x = x, media_y = y;
|
||||
convertInputCoords(media_x, media_y);
|
||||
|
||||
if (mMediaSource)
|
||||
mMediaSource->mouseDown(media_x, media_y);
|
||||
|
||||
gFocusMgr.setMouseCapture( this );
|
||||
|
||||
if (mTakeFocusOnClick)
|
||||
{
|
||||
setFocus( TRUE );
|
||||
}
|
||||
*/
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
BOOL LLMediaCtrl::handleDoubleClick( S32 x, S32 y, MASK mask )
|
||||
{
|
||||
if (LLUICtrl::handleDoubleClick(x, y, mask)) return TRUE;
|
||||
convertInputCoords(x, y);
|
||||
|
||||
if (mMediaSource)
|
||||
mMediaSource->mouseLeftDoubleClick( x, y);
|
||||
|
||||
gFocusMgr.setMouseCapture( this );
|
||||
|
||||
@@ -374,18 +425,18 @@ void LLMediaCtrl::onVisibilityChange ( BOOL new_visibility )
|
||||
//
|
||||
void LLMediaCtrl::reshape( S32 width, S32 height, BOOL called_from_parent )
|
||||
{
|
||||
S32 screen_width = mIgnoreUIScale ? llround((F32)width * LLUI::sGLScaleFactor.mV[VX]) : width;
|
||||
S32 screen_height = mIgnoreUIScale ? llround((F32)height * LLUI::sGLScaleFactor.mV[VY]) : height;
|
||||
|
||||
// llinfos << "reshape called with width = " << width << ", height = " << height << llendl;
|
||||
|
||||
// when floater is minimized, these sizes are negative
|
||||
if ( mWebBrowserImage && screen_height > 0 && screen_width > 0 )
|
||||
if(!getDecoupleTextureSize())
|
||||
{
|
||||
mWebBrowserImage->resize( screen_width, screen_height );
|
||||
mForceUpdate = true;
|
||||
}
|
||||
S32 screen_width = mIgnoreUIScale ? llround((F32)width * LLUI::sGLScaleFactor.mV[VX]) : width;
|
||||
S32 screen_height = mIgnoreUIScale ? llround((F32)height * LLUI::sGLScaleFactor.mV[VY]) : height;
|
||||
|
||||
// when floater is minimized, these sizes are negative
|
||||
if ( screen_height > 0 && screen_width > 0 )
|
||||
{
|
||||
setTextureSize(screen_width, screen_height);
|
||||
}
|
||||
}
|
||||
|
||||
LLUICtrl::reshape( width, height, called_from_parent );
|
||||
}
|
||||
|
||||
@@ -460,9 +511,10 @@ void LLMediaCtrl::navigateTo( std::string url_in, std::string mime_type)
|
||||
return;
|
||||
}
|
||||
|
||||
if (mMediaSource)
|
||||
if (ensureMediaSourceExists())
|
||||
{
|
||||
mCurrentNavUrl = url_in;
|
||||
mMediaSource->setSize(mTextureWidth, mTextureHeight);
|
||||
mMediaSource->navigateTo(url_in, mime_type, mime_type.empty());
|
||||
}
|
||||
}
|
||||
@@ -498,9 +550,10 @@ void LLMediaCtrl::navigateToLocalPage( const std::string& subdir, const std::str
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (mMediaSource)
|
||||
if (ensureMediaSourceExists())
|
||||
{
|
||||
mCurrentNavUrl = expanded_filename;
|
||||
mMediaSource->setSize(mTextureWidth, mTextureHeight);
|
||||
mMediaSource->navigateTo(expanded_filename, "text/html", false);
|
||||
}
|
||||
|
||||
@@ -510,11 +563,11 @@ void LLMediaCtrl::navigateToLocalPage( const std::string& subdir, const std::str
|
||||
//
|
||||
void LLMediaCtrl::navigateHome()
|
||||
{
|
||||
if( mHomePageUrl.length() )
|
||||
if (ensureMediaSourceExists())
|
||||
{
|
||||
if (mMediaSource)
|
||||
mMediaSource->navigateTo(mHomePageUrl);
|
||||
};
|
||||
mMediaSource->setSize(mTextureWidth, mTextureHeight);
|
||||
mMediaSource->navigateHome();
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -522,6 +575,10 @@ void LLMediaCtrl::navigateHome()
|
||||
void LLMediaCtrl::setHomePageUrl( const std::string urlIn )
|
||||
{
|
||||
mHomePageUrl = urlIn;
|
||||
if (mMediaSource)
|
||||
{
|
||||
mMediaSource->setHomeURL(mHomePageUrl);
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -531,6 +588,22 @@ bool LLMediaCtrl::setCaretColor(unsigned int red, unsigned int green, unsigned i
|
||||
//NOOP
|
||||
return false;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
void LLMediaCtrl::setTextureSize(S32 width, S32 height)
|
||||
{
|
||||
mTextureWidth = width;
|
||||
mTextureHeight = height;
|
||||
|
||||
if(mMediaSource)
|
||||
{
|
||||
mMediaSource->setSize(mTextureWidth, mTextureHeight);
|
||||
mWebBrowserImage->resize( mTextureWidth, mTextureHeight );
|
||||
mForceUpdate = true;
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
std::string LLMediaCtrl::getHomePageUrl()
|
||||
@@ -538,6 +611,39 @@ std::string LLMediaCtrl::getHomePageUrl()
|
||||
return mHomePageUrl;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
bool LLMediaCtrl::ensureMediaSourceExists()
|
||||
{
|
||||
if(mMediaSource.isNull())
|
||||
{
|
||||
mMediaSource = LLViewerMedia::newMediaImpl(mHomePageUrl, LLUUID::null, mTextureWidth, mTextureWidth, false, false, "text/html");
|
||||
if ( mMediaSource )
|
||||
{
|
||||
// create a new texture (based on LLDynamic texture) that will be used to display the output
|
||||
mWebBrowserImage = new LLWebBrowserTexture( mTextureWidth, mTextureWidth, this, mMediaSource );
|
||||
mMediaSource->setHomeURL(mHomePageUrl);
|
||||
mMediaSource->setVisible( getVisible() );
|
||||
mMediaSource->addObserver( this );
|
||||
}
|
||||
else
|
||||
{
|
||||
llwarns << "media source create failed " << llendl;
|
||||
// return;
|
||||
}
|
||||
}
|
||||
|
||||
return !mMediaSource.isNull();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
void LLMediaCtrl::unloadMediaSource()
|
||||
{
|
||||
mMediaSource = NULL;
|
||||
mWebBrowserImage = NULL; //release the dynamic texture too.
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
LLPluginClassMedia* LLMediaCtrl::getMediaPlugin()
|
||||
@@ -575,111 +681,132 @@ void LLMediaCtrl::draw()
|
||||
LLGLSUIDefault gls_ui;
|
||||
LLGLDisable gls_alphaTest( GL_ALPHA_TEST );
|
||||
|
||||
gGL.pushMatrix();
|
||||
bool draw_media = false;
|
||||
|
||||
LLPluginClassMedia* media_plugin = NULL;
|
||||
LLWebBrowserTexture* media_texture = mWebBrowserImage;
|
||||
|
||||
if(mMediaSource && mMediaSource->hasMedia())
|
||||
{
|
||||
if (mIgnoreUIScale)
|
||||
{
|
||||
glLoadIdentity();
|
||||
// font system stores true screen origin, need to scale this by UI scale factor
|
||||
// to get render origin for this view (with unit scale)
|
||||
gGL.translatef(floorf(LLFontGL::sCurOrigin.mX * LLUI::sGLScaleFactor.mV[VX]),
|
||||
floorf(LLFontGL::sCurOrigin.mY * LLUI::sGLScaleFactor.mV[VY]),
|
||||
LLFontGL::sCurOrigin.mZ);
|
||||
}
|
||||
media_plugin = mMediaSource->getMediaPlugin();
|
||||
|
||||
// scale texture to fit the space using texture coords
|
||||
gGL.getTexUnit(0)->bind(mWebBrowserImage);
|
||||
gGL.color4fv( LLColor4::white.mV );
|
||||
F32 max_u = ( F32 )mWebBrowserImage->getMediaWidth() / ( F32 )mWebBrowserImage->getWidth();
|
||||
F32 max_v = ( F32 )mWebBrowserImage->getMediaHeight() / ( F32 )mWebBrowserImage->getHeight();
|
||||
|
||||
LLRect r = getRect();
|
||||
S32 width, height;
|
||||
S32 x_offset = 0;
|
||||
S32 y_offset = 0;
|
||||
|
||||
if(mStretchToFill)
|
||||
if(media_plugin && (media_plugin->textureValid()))
|
||||
{
|
||||
if(mMaintainAspectRatio)
|
||||
media_texture = mWebBrowserImage;
|
||||
if(media_texture)
|
||||
{
|
||||
F32 media_aspect = (F32)(mWebBrowserImage->getMediaWidth()) / (F32)(mWebBrowserImage->getMediaHeight());
|
||||
F32 view_aspect = (F32)(r.getWidth()) / (F32)(r.getHeight());
|
||||
if(media_aspect > view_aspect)
|
||||
draw_media = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(draw_media)
|
||||
{
|
||||
gGL.pushMatrix();
|
||||
{
|
||||
if (mIgnoreUIScale)
|
||||
{
|
||||
glLoadIdentity();
|
||||
// font system stores true screen origin, need to scale this by UI scale factor
|
||||
// to get render origin for this view (with unit scale)
|
||||
gGL.translatef(floorf(LLFontGL::sCurOrigin.mX * LLUI::sGLScaleFactor.mV[VX]),
|
||||
floorf(LLFontGL::sCurOrigin.mY * LLUI::sGLScaleFactor.mV[VY]),
|
||||
LLFontGL::sCurOrigin.mZ);
|
||||
}
|
||||
|
||||
// scale texture to fit the space using texture coords
|
||||
gGL.getTexUnit(0)->bind(media_texture);
|
||||
LLColor4 media_color = LLColor4::white;
|
||||
gGL.color4fv( media_color.mV );
|
||||
F32 max_u = ( F32 )media_plugin->getWidth() / ( F32 )media_plugin->getTextureWidth();
|
||||
F32 max_v = ( F32 )media_plugin->getHeight() / ( F32 )media_plugin->getTextureHeight();
|
||||
|
||||
LLRect r = getRect();
|
||||
S32 width, height;
|
||||
S32 x_offset = 0;
|
||||
S32 y_offset = 0;
|
||||
|
||||
if(mStretchToFill)
|
||||
{
|
||||
if(mMaintainAspectRatio)
|
||||
{
|
||||
// max width, adjusted height
|
||||
width = r.getWidth();
|
||||
height = llmin(llmax(S32(width / media_aspect), 0), r.getHeight());
|
||||
F32 media_aspect = (F32)(media_plugin->getWidth()) / (F32)(media_plugin->getHeight());
|
||||
F32 view_aspect = (F32)(r.getWidth()) / (F32)(r.getHeight());
|
||||
if(media_aspect > view_aspect)
|
||||
{
|
||||
// max width, adjusted height
|
||||
width = r.getWidth();
|
||||
height = llmin(llmax(llround(width / media_aspect), 0), r.getHeight());
|
||||
}
|
||||
else
|
||||
{
|
||||
// max height, adjusted width
|
||||
height = r.getHeight();
|
||||
width = llmin(llmax(llround(height * media_aspect), 0), r.getWidth());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// max height, adjusted width
|
||||
width = r.getWidth();
|
||||
height = r.getHeight();
|
||||
width = llmin(llmax(S32(height * media_aspect), 0), r.getWidth());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
width = r.getWidth();
|
||||
height = r.getHeight();
|
||||
width = llmin(media_plugin->getWidth(), r.getWidth());
|
||||
height = llmin(media_plugin->getHeight(), r.getHeight());
|
||||
}
|
||||
|
||||
x_offset = (r.getWidth() - width) / 2;
|
||||
y_offset = (r.getHeight() - height) / 2;
|
||||
|
||||
if (mIgnoreUIScale)
|
||||
{
|
||||
x_offset = llround((F32)x_offset * LLUI::sGLScaleFactor.mV[VX]);
|
||||
y_offset = llround((F32)y_offset * LLUI::sGLScaleFactor.mV[VY]);
|
||||
width = llround((F32)width * LLUI::sGLScaleFactor.mV[VX]);
|
||||
height = llround((F32)height * LLUI::sGLScaleFactor.mV[VY]);
|
||||
}
|
||||
|
||||
// draw the browser
|
||||
gGL.setSceneBlendType(LLRender::BT_REPLACE);
|
||||
gGL.begin( LLRender::QUADS );
|
||||
if (! media_plugin->getTextureCoordsOpenGL())
|
||||
{
|
||||
// render using web browser reported width and height, instead of trying to invert GL scale
|
||||
gGL.texCoord2f( max_u, 0.f );
|
||||
gGL.vertex2i( x_offset + width, y_offset + height );
|
||||
|
||||
gGL.texCoord2f( 0.f, 0.f );
|
||||
gGL.vertex2i( x_offset, y_offset + height );
|
||||
|
||||
gGL.texCoord2f( 0.f, max_v );
|
||||
gGL.vertex2i( x_offset, y_offset );
|
||||
|
||||
gGL.texCoord2f( max_u, max_v );
|
||||
gGL.vertex2i( x_offset + width, y_offset );
|
||||
}
|
||||
else
|
||||
{
|
||||
// render using web browser reported width and height, instead of trying to invert GL scale
|
||||
gGL.texCoord2f( max_u, max_v );
|
||||
gGL.vertex2i( x_offset + width, y_offset + height );
|
||||
|
||||
gGL.texCoord2f( 0.f, max_v );
|
||||
gGL.vertex2i( x_offset, y_offset + height );
|
||||
|
||||
gGL.texCoord2f( 0.f, 0.f );
|
||||
gGL.vertex2i( x_offset, y_offset );
|
||||
|
||||
gGL.texCoord2f( max_u, 0.f );
|
||||
gGL.vertex2i( x_offset + width, y_offset );
|
||||
}
|
||||
gGL.end();
|
||||
gGL.setSceneBlendType(LLRender::BT_ALPHA);
|
||||
}
|
||||
else
|
||||
{
|
||||
width = llmin(mWebBrowserImage->getMediaWidth(), r.getWidth());
|
||||
height = llmin(mWebBrowserImage->getMediaHeight(), r.getHeight());
|
||||
}
|
||||
|
||||
x_offset = (r.getWidth() - width) / 2;
|
||||
y_offset = (r.getHeight() - height) / 2;
|
||||
|
||||
if (mIgnoreUIScale)
|
||||
{
|
||||
width = llround((F32)width * LLUI::sGLScaleFactor.mV[VX]);
|
||||
height = llround((F32)height * LLUI::sGLScaleFactor.mV[VY]);
|
||||
x_offset = llround((F32)x_offset * LLUI::sGLScaleFactor.mV[VX]);
|
||||
y_offset = llround((F32)y_offset * LLUI::sGLScaleFactor.mV[VY]);
|
||||
}
|
||||
|
||||
// draw the browser
|
||||
gGL.setSceneBlendType(LLRender::BT_REPLACE);
|
||||
gGL.begin( LLRender::QUADS );
|
||||
if (! mWebBrowserImage->getTextureCoordsOpenGL())
|
||||
{
|
||||
// render using web browser reported width and height, instead of trying to invert GL scale
|
||||
gGL.texCoord2f( max_u, 0.f );
|
||||
gGL.vertex2i( x_offset + width, y_offset + height );
|
||||
|
||||
gGL.texCoord2f( 0.f, 0.f );
|
||||
gGL.vertex2i( x_offset, y_offset + height );
|
||||
|
||||
gGL.texCoord2f( 0.f, max_v );
|
||||
gGL.vertex2i( x_offset, y_offset );
|
||||
|
||||
gGL.texCoord2f( max_u, max_v );
|
||||
gGL.vertex2i( x_offset + width, y_offset );
|
||||
}
|
||||
else
|
||||
{
|
||||
// render using web browser reported width and height, instead of trying to invert GL scale
|
||||
gGL.texCoord2f( max_u, max_v );
|
||||
gGL.vertex2i( x_offset + width, y_offset + height );
|
||||
|
||||
gGL.texCoord2f( 0.f, max_v );
|
||||
gGL.vertex2i( x_offset, y_offset + height );
|
||||
|
||||
gGL.texCoord2f( 0.f, 0.f );
|
||||
gGL.vertex2i( x_offset, y_offset );
|
||||
|
||||
gGL.texCoord2f( max_u, 0.f );
|
||||
gGL.vertex2i( x_offset + width, y_offset );
|
||||
}
|
||||
gGL.end();
|
||||
gGL.setSceneBlendType(LLRender::BT_ALPHA);
|
||||
gGL.popMatrix();
|
||||
}
|
||||
gGL.popMatrix();
|
||||
|
||||
// highlight if keyboard focus here. (TODO: this needs some work)
|
||||
if ( mBorder->getVisible() )
|
||||
if ( mBorder && mBorder->getVisible() )
|
||||
mBorder->setKeyboardFocusHighlight( gFocusMgr.childHasKeyboardFocus( this ) );
|
||||
|
||||
|
||||
@@ -690,8 +817,15 @@ void LLMediaCtrl::draw()
|
||||
//
|
||||
void LLMediaCtrl::convertInputCoords(S32& x, S32& y)
|
||||
{
|
||||
bool coords_opengl = false;
|
||||
|
||||
if(mMediaSource && mMediaSource->hasMedia())
|
||||
{
|
||||
coords_opengl = mMediaSource->getMediaPlugin()->getTextureCoordsOpenGL();
|
||||
}
|
||||
|
||||
x = mIgnoreUIScale ? llround((F32)x * LLUI::sGLScaleFactor.mV[VX]) : x;
|
||||
if ( ! mWebBrowserImage->getTextureCoordsOpenGL() )
|
||||
if ( ! coords_opengl )
|
||||
{
|
||||
y = mIgnoreUIScale ? llround((F32)(y) * LLUI::sGLScaleFactor.mV[VY]) : y;
|
||||
}
|
||||
@@ -930,7 +1064,6 @@ LLWebBrowserTexture::LLWebBrowserTexture( S32 width, S32 height, LLMediaCtrl* br
|
||||
LLWebBrowserTexture::~LLWebBrowserTexture()
|
||||
{
|
||||
mElapsedTime.stop();
|
||||
mMediaSource = NULL;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -48,7 +48,8 @@ class LLUICtrlFactory;
|
||||
class LLMediaCtrl :
|
||||
public LLUICtrl,
|
||||
public LLViewerMediaObserver,
|
||||
public LLViewerMediaEventEmitter
|
||||
public LLViewerMediaEventEmitter,
|
||||
public LLInstanceTracker<LLMediaCtrl, LLUUID>
|
||||
{
|
||||
public:
|
||||
LLMediaCtrl( const std::string& name, const LLRect& rect );
|
||||
@@ -69,6 +70,8 @@ class LLMediaCtrl :
|
||||
virtual BOOL handleHover( S32 x, S32 y, MASK mask );
|
||||
virtual BOOL handleMouseUp( S32 x, S32 y, MASK mask );
|
||||
virtual BOOL handleMouseDown( S32 x, S32 y, MASK mask );
|
||||
virtual BOOL handleRightMouseDown(S32 x, S32 y, MASK mask);
|
||||
virtual BOOL handleRightMouseUp(S32 x, S32 y, MASK mask);
|
||||
virtual BOOL handleDoubleClick( S32 x, S32 y, MASK mask );
|
||||
virtual BOOL handleScrollWheel( S32 x, S32 y, S32 clicks );
|
||||
|
||||
@@ -112,10 +115,17 @@ class LLMediaCtrl :
|
||||
void setForceUpdate(bool force_update) { mForceUpdate = force_update; }
|
||||
bool getForceUpdate() { return mForceUpdate; }
|
||||
|
||||
bool ensureMediaSourceExists();
|
||||
void unloadMediaSource();
|
||||
|
||||
LLPluginClassMedia* getMediaPlugin();
|
||||
|
||||
bool setCaretColor( unsigned int red, unsigned int green, unsigned int blue );
|
||||
|
||||
void setDecoupleTextureSize(bool decouple) { mDecoupleTextureSize = decouple; }
|
||||
bool getDecoupleTextureSize() { return mDecoupleTextureSize; }
|
||||
|
||||
void setTextureSize(S32 width, S32 height);
|
||||
|
||||
// over-rides
|
||||
virtual BOOL handleKeyHere( KEY key, MASK mask);
|
||||
@@ -143,6 +153,7 @@ class LLMediaCtrl :
|
||||
static bool onClickLinkExternalTarget( const LLSD&, const LLSD& );
|
||||
|
||||
const S32 mTextureDepthBytes;
|
||||
LLUUID mMediaTextureID;
|
||||
LLPointer<LLWebBrowserTexture> mWebBrowserImage;
|
||||
LLViewBorder* mBorder;
|
||||
bool mFrequentUpdates;
|
||||
@@ -161,6 +172,9 @@ class LLMediaCtrl :
|
||||
bool mStretchToFill;
|
||||
bool mMaintainAspectRatio;
|
||||
bool mHideLoading;
|
||||
bool mDecoupleTextureSize;
|
||||
S32 mTextureWidth;
|
||||
S32 mTextureHeight;
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -122,7 +122,8 @@ public:
|
||||
bool canNavigateForward();
|
||||
bool canNavigateBack();
|
||||
std::string getMediaURL() { return mMediaURL; }
|
||||
std::string getMediaHomeURL() { return mHomeURL; }
|
||||
std::string getHomeURL() { return mHomeURL; }
|
||||
void setHomeURL(const std::string& home_url) { mHomeURL = home_url; }
|
||||
std::string getMimeType() { return mMimeType; }
|
||||
void getTextureSize(S32 *texture_width, S32 *texture_height);
|
||||
void scaleMouse(S32 *mouse_x, S32 *mouse_y);
|
||||
|
||||
@@ -66,7 +66,9 @@
|
||||
//#include "lltextureatlas.h"
|
||||
//#include "lltextureatlasmanager.h"
|
||||
#include "lltextureentry.h"
|
||||
//#include "llmediaentry.h"
|
||||
#if NEW_MEDIA_TEXTURE
|
||||
#include "llmediaentry.h"
|
||||
#endif //NEW_MEDIA_TEXTURE
|
||||
#include "llvovolume.h"
|
||||
#include "llviewermedia.h"
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
@@ -79,9 +81,11 @@ LLPointer<LLViewerFetchedTexture> LLViewerFetchedTexture::sDefaultImagep = NULL;
|
||||
LLPointer<LLViewerFetchedTexture> LLViewerFetchedTexture::sSmokeImagep = NULL;
|
||||
#if NEW_MEDIA_TEXTURE
|
||||
LLViewerMediaTexture::media_map_t LLViewerMediaTexture::sMediaMap ;
|
||||
#endif //NEW_MEDIA_TEXTURE
|
||||
#if 0
|
||||
LLTexturePipelineTester* LLViewerTextureManager::sTesterp = NULL ;
|
||||
#endif
|
||||
//LLTexturePipelineTester* LLViewerTextureManager::sTesterp = NULL ;
|
||||
//const std::string sTesterName("TextureTester");
|
||||
const std::string sTesterName("TextureTester");
|
||||
|
||||
S32 LLViewerTexture::sImageCount = 0;
|
||||
S32 LLViewerTexture::sRawCount = 0;
|
||||
@@ -171,7 +175,7 @@ LLViewerMediaTexture* LLViewerTextureManager::createMediaTexture(const LLUUID &m
|
||||
{
|
||||
return new LLViewerMediaTexture(media_id, usemipmaps, gl_image) ;
|
||||
}
|
||||
#endif
|
||||
#endif //NEW_MEDIA_TEXTURE
|
||||
|
||||
LLViewerTexture* LLViewerTextureManager::findTexture(const LLUUID& id)
|
||||
{
|
||||
@@ -185,7 +189,7 @@ LLViewerTexture* LLViewerTextureManager::findTexture(const LLUUID& id)
|
||||
{
|
||||
tex = LLViewerTextureManager::findMediaTexture(id) ;
|
||||
}
|
||||
#endif
|
||||
#endif //NEW_MEDIA_TEXTURE
|
||||
return tex ;
|
||||
}
|
||||
|
||||
@@ -207,7 +211,7 @@ LLViewerMediaTexture* LLViewerTextureManager::getMediaTexture(const LLUUID& id,
|
||||
|
||||
return tex ;
|
||||
}
|
||||
#endif
|
||||
#endif //NEW_MEDIA_TEXTURE
|
||||
|
||||
LLViewerFetchedTexture* LLViewerTextureManager::staticCastToFetchedTexture(LLTexture* tex, BOOL report_error)
|
||||
{
|
||||
@@ -358,7 +362,8 @@ void LLViewerTextureManager::init()
|
||||
|
||||
LLViewerTexture::initClass() ;
|
||||
|
||||
/*if (LLMetricPerformanceTesterBasic::isMetricLogRequested(sTesterName) && !LLMetricPerformanceTesterBasic::getTester(sTesterName))
|
||||
#if 0
|
||||
if (LLMetricPerformanceTesterBasic::isMetricLogRequested(sTesterName) && !LLMetricPerformanceTesterBasic::getTester(sTesterName))
|
||||
{
|
||||
sTesterp = new LLTexturePipelineTester() ;
|
||||
if (!sTesterp->isValid())
|
||||
@@ -366,7 +371,8 @@ void LLViewerTextureManager::init()
|
||||
delete sTesterp;
|
||||
sTesterp = NULL;
|
||||
}
|
||||
}*/
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void LLViewerTextureManager::cleanup()
|
||||
@@ -382,7 +388,7 @@ void LLViewerTextureManager::cleanup()
|
||||
|
||||
#if NEW_MEDIA_TEXTURE
|
||||
LLViewerMediaTexture::cleanUpClass() ;
|
||||
#endif
|
||||
#endif //NEW_MEDIA_TEXTURE
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------
|
||||
@@ -432,14 +438,16 @@ void LLViewerTexture::updateClass(const F32 velocity, const F32 angular_velocity
|
||||
{
|
||||
sCurrentTime = gFrameTimeSeconds ;
|
||||
|
||||
/*LLTexturePipelineTester* tester = (LLTexturePipelineTester*)LLMetricPerformanceTesterBasic::getTester(sTesterName);
|
||||
#if 0
|
||||
LLTexturePipelineTester* tester = (LLTexturePipelineTester*)LLMetricPerformanceTesterBasic::getTester(sTesterName);
|
||||
if (tester)
|
||||
{
|
||||
tester->update() ;
|
||||
}*/
|
||||
}
|
||||
#endif
|
||||
#if NEW_MEDIA_TEXTURE
|
||||
LLViewerMediaTexture::updateClass() ;
|
||||
#endif
|
||||
#endif //NEW_MEDIA_TEXTURE
|
||||
|
||||
sBoundTextureMemoryInBytes = LLImageGL::sBoundTextureMemoryInBytes;//in bytes
|
||||
sTotalTextureMemoryInBytes = LLImageGL::sGlobalTextureMemoryInBytes;//in bytes
|
||||
@@ -560,7 +568,9 @@ void LLViewerTexture::init(bool firstinit)
|
||||
mFaceList.clear() ;
|
||||
mVolumeList.clear();
|
||||
|
||||
#if !NEW_MEDIA_TEXTURE
|
||||
mIsMediaTexture = false;
|
||||
#endif //!NEW_MEDIA_TEXTURE
|
||||
}
|
||||
|
||||
//virtual
|
||||
@@ -632,11 +642,13 @@ bool LLViewerTexture::bindDefaultImage(S32 stage)
|
||||
//check if there is cached raw image and switch to it if possible
|
||||
switchToCachedImage() ;
|
||||
|
||||
/*LLTexturePipelineTester* tester = (LLTexturePipelineTester*)LLMetricPerformanceTesterBasic::getTester(sTesterName);
|
||||
#if 0
|
||||
LLTexturePipelineTester* tester = (LLTexturePipelineTester*)LLMetricPerformanceTesterBasic::getTester(sTesterName);
|
||||
if (tester)
|
||||
{
|
||||
tester->updateGrayTextureBinding() ;
|
||||
}*/
|
||||
}
|
||||
#endif
|
||||
return res;
|
||||
}
|
||||
|
||||
@@ -1096,11 +1108,13 @@ BOOL LLViewerTexture::isLargeImage()
|
||||
//virtual
|
||||
void LLViewerTexture::updateBindStatsForTester()
|
||||
{
|
||||
/*LLTexturePipelineTester* tester = (LLTexturePipelineTester*)LLMetricPerformanceTesterBasic::getTester(sTesterName);
|
||||
#if 0
|
||||
LLTexturePipelineTester* tester = (LLTexturePipelineTester*)LLMetricPerformanceTesterBasic::getTester(sTesterName);
|
||||
if (tester)
|
||||
{
|
||||
tester->updateTextureBindingStats(this) ;
|
||||
}*/
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------
|
||||
@@ -1888,12 +1902,14 @@ bool LLViewerFetchedTexture::updateFetch()
|
||||
// We may have data ready regardless of whether or not we are finished (e.g. waiting on write)
|
||||
if (mRawImage.notNull())
|
||||
{
|
||||
/*LLTexturePipelineTester* tester = (LLTexturePipelineTester*)LLMetricPerformanceTesterBasic::getTester(sTesterName);
|
||||
#if 0
|
||||
LLTexturePipelineTester* tester = (LLTexturePipelineTester*)LLMetricPerformanceTesterBasic::getTester(sTesterName);
|
||||
if (tester)
|
||||
{
|
||||
mIsFetched = TRUE ;
|
||||
tester->updateTextureLoadingStats(this, mRawImage, LLAppViewer::getTextureFetch()->isFromLocalCache(mID)) ;
|
||||
}*/
|
||||
}
|
||||
#endif
|
||||
mRawDiscardLevel = fetch_discard;
|
||||
if ((mRawImage->getDataSize() > 0 && mRawDiscardLevel >= 0) &&
|
||||
(current_discard < 0 || mRawDiscardLevel < current_discard))
|
||||
@@ -3134,11 +3150,13 @@ void LLViewerLODTexture::scaleDown()
|
||||
{
|
||||
switchToCachedImage() ;
|
||||
|
||||
/*LLTexturePipelineTester* tester = (LLTexturePipelineTester*)LLMetricPerformanceTesterBasic::getTester(sTesterName);
|
||||
#if 0
|
||||
LLTexturePipelineTester* tester = (LLTexturePipelineTester*)LLMetricPerformanceTesterBasic::getTester(sTesterName);
|
||||
if (tester)
|
||||
{
|
||||
tester->setStablizingTime() ;
|
||||
}*/
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
//----------------------------------------------------------------------------------------------
|
||||
@@ -3154,7 +3172,7 @@ void LLViewerMediaTexture::updateClass()
|
||||
{
|
||||
static const F32 MAX_INACTIVE_TIME = 30.f ;
|
||||
|
||||
#if NEW_MEDIA_TEXTURE
|
||||
#if 0
|
||||
//force to play media.
|
||||
gSavedSettings.setBOOL("AudioStreamingMedia", true) ;
|
||||
#endif
|
||||
@@ -3247,7 +3265,7 @@ LLViewerMediaTexture::~LLViewerMediaTexture()
|
||||
tex->setParcelMedia(NULL) ;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif //NEW_MEDIA_TEXTURE
|
||||
void LLViewerMediaTexture::reinit(BOOL usemipmaps /* = TRUE */)
|
||||
{
|
||||
llassert(mGLTexturep.notNull()) ;
|
||||
@@ -3641,7 +3659,7 @@ F32 LLViewerMediaTexture::getMaxVirtualSize()
|
||||
|
||||
return mMaxVirtualSize ;
|
||||
}
|
||||
#endif
|
||||
#endif //NEW_MEDIA_TEXTURE
|
||||
//----------------------------------------------------------------------------------------------
|
||||
//end of LLViewerMediaTexture
|
||||
//----------------------------------------------------------------------------------------------
|
||||
@@ -3743,22 +3761,23 @@ void LLTexturePipelineTester::reset()
|
||||
//virtual
|
||||
void LLTexturePipelineTester::outputTestRecord(LLSD *sd)
|
||||
{
|
||||
(*sd)[mCurLabel]["TotalBytesLoaded"] = (LLSD::Integer)mTotalBytesLoaded ;
|
||||
(*sd)[mCurLabel]["TotalBytesLoadedFromCache"] = (LLSD::Integer)mTotalBytesLoadedFromCache ;
|
||||
(*sd)[mCurLabel]["TotalBytesLoadedForLargeImage"] = (LLSD::Integer)mTotalBytesLoadedForLargeImage ;
|
||||
(*sd)[mCurLabel]["TotalBytesLoadedForSculpties"] = (LLSD::Integer)mTotalBytesLoadedForSculpties ;
|
||||
std::string currentLabel = getCurrentLabelName();
|
||||
(*sd)[currentLabel]["TotalBytesLoaded"] = (LLSD::Integer)mTotalBytesLoaded ;
|
||||
(*sd)[currentLabel]["TotalBytesLoadedFromCache"] = (LLSD::Integer)mTotalBytesLoadedFromCache ;
|
||||
(*sd)[currentLabel]["TotalBytesLoadedForLargeImage"] = (LLSD::Integer)mTotalBytesLoadedForLargeImage ;
|
||||
(*sd)[currentLabel]["TotalBytesLoadedForSculpties"] = (LLSD::Integer)mTotalBytesLoadedForSculpties ;
|
||||
|
||||
(*sd)[mCurLabel]["StartFetchingTime"] = (LLSD::Real)mStartFetchingTime ;
|
||||
(*sd)[mCurLabel]["TotalGrayTime"] = (LLSD::Real)mTotalGrayTime ;
|
||||
(*sd)[mCurLabel]["TotalStablizingTime"] = (LLSD::Real)mTotalStablizingTime ;
|
||||
(*sd)[currentLabel]["StartFetchingTime"] = (LLSD::Real)mStartFetchingTime ;
|
||||
(*sd)[currentLabel]["TotalGrayTime"] = (LLSD::Real)mTotalGrayTime ;
|
||||
(*sd)[currentLabel]["TotalStablizingTime"] = (LLSD::Real)mTotalStablizingTime ;
|
||||
|
||||
(*sd)[mCurLabel]["StartTimeLoadingSculpties"] = (LLSD::Real)mStartTimeLoadingSculpties ;
|
||||
(*sd)[mCurLabel]["EndTimeLoadingSculpties"] = (LLSD::Real)mEndTimeLoadingSculpties ;
|
||||
(*sd)[currentLabel]["StartTimeLoadingSculpties"] = (LLSD::Real)mStartTimeLoadingSculpties ;
|
||||
(*sd)[currentLabel]["EndTimeLoadingSculpties"] = (LLSD::Real)mEndTimeLoadingSculpties ;
|
||||
|
||||
(*sd)[mCurLabel]["Time"] = LLImageGL::sLastFrameTime ;
|
||||
(*sd)[mCurLabel]["TotalBytesBound"] = (LLSD::Integer)mLastTotalBytesUsed ;
|
||||
(*sd)[mCurLabel]["TotalBytesBoundForLargeImage"] = (LLSD::Integer)mLastTotalBytesUsedForLargeImage ;
|
||||
(*sd)[mCurLabel]["PercentageBytesBound"] = (LLSD::Real)(100.f * mLastTotalBytesUsed / mTotalBytesLoaded) ;
|
||||
(*sd)[currentLabel]["Time"] = LLImageGL::sLastFrameTime ;
|
||||
(*sd)[currentLabel]["TotalBytesBound"] = (LLSD::Integer)mLastTotalBytesUsed ;
|
||||
(*sd)[currentLabel]["TotalBytesBoundForLargeImage"] = (LLSD::Integer)mLastTotalBytesUsedForLargeImage ;
|
||||
(*sd)[currentLabel]["PercentageBytesBound"] = (LLSD::Real)(100.f * mLastTotalBytesUsed / mTotalBytesLoaded) ;
|
||||
}
|
||||
|
||||
void LLTexturePipelineTester::updateTextureBindingStats(const LLViewerTexture* imagep)
|
||||
@@ -3847,7 +3866,7 @@ void LLTexturePipelineTester::compareTestSessions(std::ofstream* os)
|
||||
}
|
||||
|
||||
//compare and output the comparison
|
||||
*os << llformat("%s\n", mName.c_str()) ;
|
||||
*os << llformat("%s\n", getTesterName().c_str()) ;
|
||||
*os << llformat("AggregateResults\n") ;
|
||||
|
||||
compareTestResults(os, "TotalFetchingTime", base_sessionp->mTotalFetchingTime, current_sessionp->mTotalFetchingTime) ;
|
||||
@@ -3902,7 +3921,7 @@ void LLTexturePipelineTester::compareTestSessions(std::ofstream* os)
|
||||
}
|
||||
|
||||
//virtual
|
||||
LLMetricPerformanceTester::LLTestSession* LLTexturePipelineTester::loadTestSession(LLSD* log)
|
||||
LLMetricPerformanceTesterWithSession::LLTestSession* LLTexturePipelineTester::loadTestSession(LLSD* log)
|
||||
{
|
||||
LLTexturePipelineTester::LLTextureTestSession* sessionp = new LLTexturePipelineTester::LLTextureTestSession() ;
|
||||
if(!sessionp)
|
||||
@@ -3929,12 +3948,11 @@ LLMetricPerformanceTester::LLTestSession* LLTexturePipelineTester::loadTestSessi
|
||||
sessionp->mInstantPerformanceList[sessionp->mInstantPerformanceListCounter].mTime = 0.f ;
|
||||
|
||||
//load a session
|
||||
BOOL in_log = (*log).has(mCurLabel) ;
|
||||
while(in_log)
|
||||
std::string currentLabel = getCurrentLabelName();
|
||||
BOOL in_log = (*log).has(currentLabel) ;
|
||||
while (in_log)
|
||||
{
|
||||
LLSD::String label = mCurLabel ;
|
||||
incLabel() ;
|
||||
in_log = (*log).has(mCurLabel) ;
|
||||
LLSD::String label = currentLabel ;
|
||||
|
||||
if(sessionp->mInstantPerformanceListCounter >= (S32)sessionp->mInstantPerformanceList.size())
|
||||
{
|
||||
@@ -4000,7 +4018,11 @@ LLMetricPerformanceTester::LLTestSession* LLTexturePipelineTester::loadTestSessi
|
||||
sessionp->mInstantPerformanceList[sessionp->mInstantPerformanceListCounter].mAverageBytesUsedForLargeImagePerSecond = 0 ;
|
||||
sessionp->mInstantPerformanceList[sessionp->mInstantPerformanceListCounter].mAveragePercentageBytesUsedPerSecond = 0.f ;
|
||||
sessionp->mInstantPerformanceList[sessionp->mInstantPerformanceListCounter].mTime = 0.f ;
|
||||
}
|
||||
}
|
||||
// Next label
|
||||
incrementCurrentCount() ;
|
||||
currentLabel = getCurrentLabelName();
|
||||
in_log = (*log).has(currentLabel) ;
|
||||
}
|
||||
|
||||
sessionp->mTotalFetchingTime += total_fetching_time ;
|
||||
@@ -4040,7 +4062,7 @@ void LLTexturePipelineTester::LLTextureTestSession::reset()
|
||||
|
||||
mInstantPerformanceListCounter = 0 ;
|
||||
}
|
||||
#endif //0
|
||||
#endif 0
|
||||
//----------------------------------------------------------------------------------------------
|
||||
//end of LLTexturePipelineTester
|
||||
//----------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -40,7 +40,9 @@
|
||||
#include "llhost.h"
|
||||
#include "llgltypes.h"
|
||||
#include "llrender.h"
|
||||
//#include "llmetricperformancetester.h"
|
||||
#if 0
|
||||
#include "llmetricperformancetester.h"
|
||||
#endif
|
||||
|
||||
#include <map>
|
||||
#include <list>
|
||||
@@ -620,14 +622,16 @@ class LLViewerMediaTexture : public LLViewerTexture
|
||||
{
|
||||
#if NEW_MEDIA_TEXTURE
|
||||
protected:
|
||||
*virtual*/ ~LLViewerMediaTexture() ;
|
||||
/*virtual*/ ~LLViewerMediaTexture() ;
|
||||
|
||||
public:
|
||||
LLViewerMediaTexture(const LLUUID& id, BOOL usemipmaps = TRUE, LLImageGL* gl_image = NULL) ;
|
||||
|
||||
/*virtual*/* S8 getType() const;
|
||||
#endif
|
||||
/*virtual*/ S8 getType() const;
|
||||
#endif //NEW_MEDIA_TEXTURE
|
||||
#if !NEW_MEDIA_TEXTURE
|
||||
public:
|
||||
#endif //!NEW_MEDIA_TEXTURE
|
||||
void reinit(BOOL usemipmaps = TRUE);
|
||||
|
||||
BOOL getUseMipMaps() {return mUseMipMaps ; }
|
||||
@@ -642,7 +646,7 @@ public:
|
||||
void invalidateMediaImpl() ;
|
||||
|
||||
void addMediaToFace(LLFace* facep) ;
|
||||
void removeMediaFromFace(LLFace* facep) ;*/
|
||||
void removeMediaFromFace(LLFace* facep) ;
|
||||
|
||||
/*virtual*/ void addFace(LLFace* facep) ;
|
||||
/*virtual*/ void removeFace(LLFace* facep) ;
|
||||
@@ -678,7 +682,7 @@ public:
|
||||
private:
|
||||
typedef std::map< LLUUID, LLPointer<LLViewerMediaTexture> > media_map_t ;
|
||||
static media_map_t sMediaMap ;
|
||||
#endif
|
||||
#endif //NEW_MEDIA_TEXTURE
|
||||
};
|
||||
|
||||
//just an interface class, do not create instance from this class.
|
||||
@@ -690,7 +694,9 @@ private:
|
||||
|
||||
public:
|
||||
//texture pipeline tester
|
||||
//static LLTexturePipelineTester* sTesterp ;
|
||||
#if 0
|
||||
static LLTexturePipelineTester* sTesterp ;
|
||||
#endif
|
||||
|
||||
//returns NULL if tex is not a LLViewerFetchedTexture nor derived from LLViewerFetchedTexture.
|
||||
static LLViewerFetchedTexture* staticCastToFetchedTexture(LLTexture* tex, BOOL report_error = FALSE) ;
|
||||
@@ -708,7 +714,7 @@ public:
|
||||
//"get-texture" will create a new texture if the texture does not exist.
|
||||
//
|
||||
static LLViewerMediaTexture* getMediaTexture(const LLUUID& id, BOOL usemipmaps = TRUE, LLImageGL* gl_image = NULL) ;
|
||||
#endif
|
||||
#endif //NEW_MEDIA_TEXTURE
|
||||
|
||||
static LLPointer<LLViewerTexture> getLocalTexture(BOOL usemipmaps = TRUE, BOOL generate_gl_tex = TRUE);
|
||||
static LLPointer<LLViewerTexture> getLocalTexture(const LLUUID& id, BOOL usemipmaps, BOOL generate_gl_tex = TRUE) ;
|
||||
@@ -839,8 +845,8 @@ private:
|
||||
S32 mInstantPerformanceListCounter ;
|
||||
};
|
||||
|
||||
/*virtual*/ LLMetricPerformanceTester::LLTestSession* loadTestSession(LLSD* log) ;
|
||||
/*virtual*/ LLMetricPerformanceTesterWithSession::LLTestSession* loadTestSession(LLSD* log) ;
|
||||
/*virtual*/ void compareTestSessions(std::ofstream* os) ;
|
||||
};
|
||||
#endif //0
|
||||
#endif
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user