summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
Diffstat (limited to 'indra')
-rw-r--r--indra/llplugin/llpluginclassmedia.cpp7
-rw-r--r--indra/llplugin/llpluginclassmedia.h6
-rw-r--r--indra/media_plugins/webkit/media_plugin_webkit.cpp34
-rw-r--r--indra/newview/llmediactrl.cpp227
-rw-r--r--indra/newview/llviewermedia.cpp20
-rw-r--r--indra/newview/llviewermedia.h4
-rw-r--r--indra/newview/skins/default/xui/en/floater_help_browser.xml1
-rw-r--r--indra/newview/skins/default/xui/en/floater_search.xml1
-rw-r--r--indra/newview/skins/default/xui/en/panel_login.xml1
9 files changed, 183 insertions, 118 deletions
diff --git a/indra/llplugin/llpluginclassmedia.cpp b/indra/llplugin/llpluginclassmedia.cpp
index 1a382643da..ed8d10a88c 100644
--- a/indra/llplugin/llpluginclassmedia.cpp
+++ b/indra/llplugin/llpluginclassmedia.cpp
@@ -124,7 +124,8 @@ void LLPluginClassMedia::reset()
mCanPaste = false;
mMediaName.clear();
mMediaDescription.clear();
-
+ mBackgroundColor = LLColor4::white;
+
// media_browser class
mNavigateURI.clear();
mNavigateResultCode = -1;
@@ -234,6 +235,10 @@ void LLPluginClassMedia::idle(void)
message.setValueS32("height", mRequestedMediaHeight);
message.setValueS32("texture_width", mRequestedTextureWidth);
message.setValueS32("texture_height", mRequestedTextureHeight);
+ message.setValueReal("background_r", mBackgroundColor.mV[VX]);
+ message.setValueReal("background_g", mBackgroundColor.mV[VY]);
+ message.setValueReal("background_b", mBackgroundColor.mV[VZ]);
+ message.setValueReal("background_a", mBackgroundColor.mV[VW]);
mPlugin->sendMessage(message); // DO NOT just use sendMessage() here -- we want this to jump ahead of the queue.
LL_DEBUGS("Plugin") << "Sending size_change" << LL_ENDL;
diff --git a/indra/llplugin/llpluginclassmedia.h b/indra/llplugin/llpluginclassmedia.h
index b58067733b..5a1928ab1d 100644
--- a/indra/llplugin/llpluginclassmedia.h
+++ b/indra/llplugin/llpluginclassmedia.h
@@ -39,7 +39,7 @@
#include "llrect.h"
#include "llpluginclassmediaowner.h"
#include <queue>
-
+#include "v4color.h"
class LLPluginClassMedia : public LLPluginProcessParentOwner
{
@@ -86,6 +86,8 @@ public:
void setSize(int width, int height);
void setAutoScale(bool auto_scale);
+ void setBackgroundColor(LLColor4 color) { mBackgroundColor = color; };
+
// Returns true if all of the texture parameters (depth, format, size, and texture size) are set up and consistent.
// This will initially be false, and will also be false for some time after setSize while the resize is processed.
// Note that if this returns true, it is safe to use all the get() functions above without checking for invalid return values
@@ -328,6 +330,8 @@ protected:
std::string mMediaName;
std::string mMediaDescription;
+ LLColor4 mBackgroundColor;
+
/////////////////////////////////////////
// media_browser class
std::string mNavigateURI;
diff --git a/indra/media_plugins/webkit/media_plugin_webkit.cpp b/indra/media_plugins/webkit/media_plugin_webkit.cpp
index 02f0045800..a0336f6156 100644
--- a/indra/media_plugins/webkit/media_plugin_webkit.cpp
+++ b/indra/media_plugins/webkit/media_plugin_webkit.cpp
@@ -98,6 +98,9 @@ private:
int mLastMouseX;
int mLastMouseY;
bool mFirstFocus;
+ F32 mBackgroundR;
+ F32 mBackgroundG;
+ F32 mBackgroundB;
void setInitState(int state)
{
@@ -237,8 +240,9 @@ private:
// don't flip bitmap
LLQtWebKit::getInstance()->flipWindow( mBrowserWindowId, true );
- // set background color to be black - mostly for initial login page
- LLQtWebKit::getInstance()->setBackgroundColor( mBrowserWindowId, 0x00, 0x00, 0x00 );
+ // set background color
+ // convert background color channels from [0.0, 1.0] to [0, 255];
+ LLQtWebKit::getInstance()->setBackgroundColor( mBrowserWindowId, int(mBackgroundR * 255.0f), int(mBackgroundG * 255.0f), int(mBackgroundB * 255.0f) );
// Set state _before_ starting the navigate, since onNavigateBegin might get called before this call returns.
setInitState(INIT_STATE_NAVIGATING);
@@ -246,7 +250,21 @@ private:
// Don't do this here -- it causes the dreaded "white flash" when loading a browser instance.
// FIXME: Re-added this because navigating to a "page" initializes things correctly - especially
// for the HTTP AUTH dialog issues (DEV-41731). Will fix at a later date.
- LLQtWebKit::getInstance()->navigateTo( mBrowserWindowId, "about:blank" );
+ // Build a data URL like this: "data:text/html,%3Chtml%3E%3Cbody bgcolor=%22#RRGGBB%22%3E%3C/body%3E%3C/html%3E"
+ // where RRGGBB is the background color in HTML style
+ std::stringstream url;
+
+ url << "data:text/html,%3Chtml%3E%3Cbody%20bgcolor=%22#";
+ // convert background color channels from [0.0, 1.0] to [0, 255];
+ url << std::setfill('0') << std::setw(2) << std::hex << int(mBackgroundR * 255.0f);
+ url << std::setfill('0') << std::setw(2) << std::hex << int(mBackgroundG * 255.0f);
+ url << std::setfill('0') << std::setw(2) << std::hex << int(mBackgroundB * 255.0f);
+ url << "%22%3E%3C/body%3E%3C/html%3E";
+
+ lldebugs << "data url is: " << url.str() << llendl;
+
+ LLQtWebKit::getInstance()->navigateTo( mBrowserWindowId, url.str() );
+// LLQtWebKit::getInstance()->navigateTo( mBrowserWindowId, "about:blank" );
return true;
};
@@ -318,7 +336,9 @@ private:
if(mInitState == INIT_STATE_NAVIGATE_COMPLETE)
{
- setInitState(INIT_STATE_WAIT_REDRAW);
+ // Skip the WAIT_REDRAW state now -- with the right background color set, it should no longer be necessary.
+// setInitState(INIT_STATE_WAIT_REDRAW);
+ setInitState(INIT_STATE_WAIT_COMPLETE);
}
}
@@ -704,7 +724,11 @@ void MediaPluginWebKit::receiveMessage(const char *message_string)
S32 height = message_in.getValueS32("height");
S32 texture_width = message_in.getValueS32("texture_width");
S32 texture_height = message_in.getValueS32("texture_height");
-
+ mBackgroundR = message_in.getValueReal("background_r");
+ mBackgroundG = message_in.getValueReal("background_g");
+ mBackgroundB = message_in.getValueReal("background_b");
+// mBackgroundA = message_in.setValueReal("background_a"); // Ignore any alpha
+
if(!name.empty())
{
// Find the shared memory region with this name
diff --git a/indra/newview/llmediactrl.cpp b/indra/newview/llmediactrl.cpp
index 93f926b5d0..6b0f9b709d 100644
--- a/indra/newview/llmediactrl.cpp
+++ b/indra/newview/llmediactrl.cpp
@@ -632,6 +632,7 @@ bool LLMediaCtrl::ensureMediaSourceExists()
mMediaSource->setHomeURL(mHomePageUrl);
mMediaSource->setVisible( getVisible() );
mMediaSource->addObserver( this );
+ mMediaSource->setBackgroundColor( getBackgroundColor() );
if(mClearCache)
{
mMediaSource->clearCache();
@@ -671,34 +672,12 @@ LLPluginClassMedia* LLMediaCtrl::getMediaPlugin()
//
void LLMediaCtrl::draw()
{
- LLPluginClassMedia* media_plugin = NULL;
-
- if(mMediaSource && mMediaSource->hasMedia())
- {
- media_plugin = mMediaSource->getMediaPlugin();
- }
- else
- {
- return;
- }
-
- if(!media_plugin || (!media_plugin->textureValid()))
- {
- // Don't try to draw without a valid texture
- return;
- }
-
- LLViewerMediaTexture* media_texture = LLViewerTextureManager::findMediaTexture(mMediaTextureID);
-
- if (!media_texture )
- return;
-
if ( gRestoreGL == 1 )
{
LLRect r = getRect();
reshape( r.getWidth(), r.getHeight(), FALSE );
return;
- };
+ }
// NOTE: optimization needed here - probably only need to do this once
// unless tearoffs change the parent which they probably do.
@@ -712,125 +691,161 @@ void LLMediaCtrl::draw()
setFrequentUpdates( false );
};
+ bool draw_media = false;
+
+ LLPluginClassMedia* media_plugin = NULL;
+ LLViewerMediaTexture* media_texture = NULL;
+
+ if(mMediaSource && mMediaSource->hasMedia())
+ {
+ media_plugin = mMediaSource->getMediaPlugin();
+
+ if(media_plugin && (media_plugin->textureValid()))
+ {
+ media_texture = LLViewerTextureManager::findMediaTexture(mMediaTextureID);
+ if(media_texture)
+ {
+ draw_media = true;
+ }
+ }
+ }
+
if(mHidingInitialLoad)
{
// If we're hiding loading, don't draw at all.
- return;
+ draw_media = false;
}
- // alpha off for this
- LLGLSUIDefault gls_ui;
- LLGLDisable gls_alphaTest( GL_ALPHA_TEST );
-
- gGL.pushMatrix();
+ bool background_visible = isBackgroundVisible();
+ bool background_opaque = isBackgroundOpaque();
+
+ if(draw_media)
{
- if (mIgnoreUIScale)
+ // alpha off for this
+ LLGLSUIDefault gls_ui;
+ LLGLDisable gls_alphaTest( GL_ALPHA_TEST );
+
+ gGL.pushMatrix();
{
- 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);
- }
+ 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);
- gGL.color4fv( LLColor4::white.mV );
- F32 max_u = ( F32 )media_plugin->getWidth() / ( F32 )media_plugin->getTextureWidth();
- F32 max_v = ( F32 )media_plugin->getHeight() / ( F32 )media_plugin->getTextureHeight();
+ // scale texture to fit the space using texture coords
+ gGL.getTexUnit(0)->bind(media_texture);
+ gGL.color4fv( LLColor4::white.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)
+ LLRect r = getRect();
+ S32 width, height;
+ S32 x_offset = 0;
+ S32 y_offset = 0;
+
+ if(mStretchToFill)
{
- 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)
+ if(mMaintainAspectRatio)
{
- // max width, adjusted height
- width = r.getWidth();
- height = llmin(llmax(llround(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(llround(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());
}
- }
- else
- {
- 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;
+
+ 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]);
- }
+ 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 );
+ // 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, 0.f );
+ gGL.vertex2i( x_offset, y_offset + height );
- gGL.texCoord2f( 0.f, max_v );
- gGL.vertex2i( x_offset, y_offset );
+ 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( 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, max_v );
+ gGL.vertex2i( x_offset, y_offset + height );
- gGL.texCoord2f( 0.f, 0.f );
- gGL.vertex2i( x_offset, y_offset );
+ 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.texCoord2f( max_u, 0.f );
+ gGL.vertex2i( x_offset + width, y_offset );
+ }
+ gGL.end();
+ gGL.setSceneBlendType(LLRender::BT_ALPHA);
}
- gGL.end();
- gGL.setSceneBlendType(LLRender::BT_ALPHA);
+ gGL.popMatrix();
+
}
- gGL.popMatrix();
-
+ else
+ {
+ // Setting these will make LLPanel::draw draw the opaque background color.
+ setBackgroundVisible(true);
+ setBackgroundOpaque(true);
+ }
+
// highlight if keyboard focus here. (TODO: this needs some work)
if ( mBorder && mBorder->getVisible() )
mBorder->setKeyboardFocusHighlight( gFocusMgr.childHasKeyboardFocus( this ) );
LLPanel::draw();
+
+ // Restore the previous values
+ setBackgroundVisible(background_visible);
+ setBackgroundOpaque(background_opaque);
}
////////////////////////////////////////////////////////////////////////////////
diff --git a/indra/newview/llviewermedia.cpp b/indra/newview/llviewermedia.cpp
index 9671b9e5dc..023c288d92 100644
--- a/indra/newview/llviewermedia.cpp
+++ b/indra/newview/llviewermedia.cpp
@@ -1005,6 +1005,7 @@ LLViewerMediaImpl::LLViewerMediaImpl( const LLUUID& texture_id,
mMediaAutoPlay(false),
mInNearbyMediaList(false),
mClearCache(false),
+ mBackgroundColor(LLColor4::white),
mIsUpdated(false)
{
@@ -1217,6 +1218,7 @@ bool LLViewerMediaImpl::initializePlugin(const std::string& media_type)
media_source->setAutoScale(mMediaAutoScale);
media_source->setBrowserUserAgent(LLViewerMedia::getCurrentUserAgent());
media_source->focus(mHasFocus);
+ media_source->setBackgroundColor(mBackgroundColor);
if(mClearCache)
{
@@ -1983,8 +1985,8 @@ LLViewerMediaTexture* LLViewerMediaImpl::updatePlaceholderImage()
|| placeholder_image->getUseMipMaps()
|| (placeholder_image->getWidth() != mMediaSource->getTextureWidth())
|| (placeholder_image->getHeight() != mMediaSource->getTextureHeight())
- || (mTextureUsedWidth > mMediaSource->getWidth())
- || (mTextureUsedHeight > mMediaSource->getHeight())
+ || (mTextureUsedWidth != mMediaSource->getWidth())
+ || (mTextureUsedHeight != mMediaSource->getHeight())
)
{
LL_DEBUGS("Media") << "initializing media placeholder" << LL_ENDL;
@@ -2002,7 +2004,9 @@ LLViewerMediaTexture* LLViewerMediaImpl::updatePlaceholderImage()
// MEDIAOPT: seems insane that we actually have to make an imageraw then
// immediately discard it
LLPointer<LLImageRaw> raw = new LLImageRaw(texture_width, texture_height, texture_depth);
- raw->clear(0x00, 0x00, 0x00, 0xff);
+ // Clear the texture to the background color, ignoring alpha.
+ // convert background color channels from [0.0, 1.0] to [0, 255];
+ raw->clear(int(mBackgroundColor.mV[VX] * 255.0f), int(mBackgroundColor.mV[VY] * 255.0f), int(mBackgroundColor.mV[VZ] * 255.0f), 0xff);
int discard_level = 0;
// ask media source for correct GL image format constants
@@ -2473,6 +2477,16 @@ void LLViewerMediaImpl::setUsedInUI(bool used_in_ui)
}
};
+void LLViewerMediaImpl::setBackgroundColor(LLColor4 color)
+{
+ mBackgroundColor = color;
+
+ if(mMediaSource)
+ {
+ mMediaSource->setBackgroundColor(mBackgroundColor);
+ }
+};
+
F64 LLViewerMediaImpl::getCPUUsage() const
{
F64 result = 0.0f;
diff --git a/indra/newview/llviewermedia.h b/indra/newview/llviewermedia.h
index 3ce9f1887c..8a5cd804aa 100644
--- a/indra/newview/llviewermedia.h
+++ b/indra/newview/llviewermedia.h
@@ -42,6 +42,7 @@
#include "llviewermediaobserver.h"
#include "llpluginclassmedia.h"
+#include "v4color.h"
class LLViewerMediaImpl;
class LLUUID;
@@ -295,6 +296,8 @@ public:
// This will be used as part of the interest sorting algorithm.
void setUsedInUI(bool used_in_ui);
bool getUsedInUI() const { return mUsedInUI; };
+
+ void setBackgroundColor(LLColor4 color);
F64 getCPUUsage() const;
@@ -368,6 +371,7 @@ private:
std::string mMediaEntryURL;
bool mInNearbyMediaList; // used by LLFloaterNearbyMedia::refreshList() for performance reasons
bool mClearCache;
+ LLColor4 mBackgroundColor;
private:
BOOL mIsUpdated ;
diff --git a/indra/newview/skins/default/xui/en/floater_help_browser.xml b/indra/newview/skins/default/xui/en/floater_help_browser.xml
index 446b7138c4..e83bc1555c 100644
--- a/indra/newview/skins/default/xui/en/floater_help_browser.xml
+++ b/indra/newview/skins/default/xui/en/floater_help_browser.xml
@@ -43,7 +43,6 @@
left="0"
name="browser"
top="0"
- start_url="data:text/html,%3Chtml%3E%3Cbody bgcolor=%22#2A2A2A%22%3E%3C/body%3E%3C/html%3E"
width="590" />
</layout_panel>
</layout_stack>
diff --git a/indra/newview/skins/default/xui/en/floater_search.xml b/indra/newview/skins/default/xui/en/floater_search.xml
index 5a9e2ebe6e..b0bb282abd 100644
--- a/indra/newview/skins/default/xui/en/floater_search.xml
+++ b/indra/newview/skins/default/xui/en/floater_search.xml
@@ -42,7 +42,6 @@
left="0"
name="browser"
top="0"
- start_url="data:text/html,%3Chtml%3E%3Cbody bgcolor=%22#2A2A2A%22%3E%3C/body%3E%3C/html%3E"
height="600"
width="650" />
<text
diff --git a/indra/newview/skins/default/xui/en/panel_login.xml b/indra/newview/skins/default/xui/en/panel_login.xml
index 6187b8f1e2..e5df37e366 100644
--- a/indra/newview/skins/default/xui/en/panel_login.xml
+++ b/indra/newview/skins/default/xui/en/panel_login.xml
@@ -24,6 +24,7 @@ top="600"
</panel.string>
<!-- *NOTE: Custom resize logic for login_html in llpanellogin.cpp -->
<web_browser
+bg_opaque_color="Black"
border_visible="false"
bottom="600"
follows="all"