From 4c3a73658cd66522920add8cb49e83f8493856c0 Mon Sep 17 00:00:00 2001 From: Shyotl Date: Thu, 10 Mar 2011 22:57:48 -0600 Subject: [PATCH] Browser window less likely to display garbage when resized. (Initialized gl texture to black) Could improve even further by padding area around copied plugin texture with black. Doesn't seem too necessary tho. --- indra/newview/lldynamictexture.cpp | 4 +++- indra/newview/lldynamictexture.h | 2 +- indra/newview/llmediactrl.cpp | 6 ++++-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/indra/newview/lldynamictexture.cpp b/indra/newview/lldynamictexture.cpp index 61f5a8905..960d6cdf2 100644 --- a/indra/newview/lldynamictexture.cpp +++ b/indra/newview/lldynamictexture.cpp @@ -97,7 +97,7 @@ void LLDynamicTexture::generateGLTexture() generateGLTexture(-1, 0, 0, FALSE); } -void LLDynamicTexture::generateGLTexture(LLGLint internal_format, LLGLenum primary_format, LLGLenum type_format, BOOL swap_bytes) +void LLDynamicTexture::generateGLTexture(LLGLint internal_format, LLGLenum primary_format, LLGLenum type_format, BOOL swap_bytes, const LLColor4U *fill_color/* = NULL*/) { if (mComponents < 1 || mComponents > 4) { @@ -105,6 +105,8 @@ void LLDynamicTexture::generateGLTexture(LLGLint internal_format, LLGLenum prima } releaseGLTexture(); LLPointer raw_image = new LLImageRaw(mWidth, mHeight, mComponents); + if(fill_color) + raw_image->fill(*fill_color); mTexture = new LLViewerImage(mWidth, mHeight, mComponents, FALSE); if (internal_format >= 0) { diff --git a/indra/newview/lldynamictexture.h b/indra/newview/lldynamictexture.h index 5a20eaef9..db24000e7 100644 --- a/indra/newview/lldynamictexture.h +++ b/indra/newview/lldynamictexture.h @@ -74,7 +74,7 @@ public: protected: void releaseGLTexture(); void generateGLTexture(); - void generateGLTexture(LLGLint internal_format, LLGLenum primary_format, LLGLenum type_format, BOOL swap_bytes = FALSE); + void generateGLTexture(LLGLint internal_format, LLGLenum primary_format, LLGLenum type_format, BOOL swap_bytes = FALSE, const LLColor4U *fill_color = NULL); protected: S32 mWidth; diff --git a/indra/newview/llmediactrl.cpp b/indra/newview/llmediactrl.cpp index 153059897..db6d29cfc 100644 --- a/indra/newview/llmediactrl.cpp +++ b/indra/newview/llmediactrl.cpp @@ -550,7 +550,7 @@ LLPluginClassMedia* LLMediaCtrl::getMediaPlugin() // void LLMediaCtrl::draw() { - if ( ! mWebBrowserImage ) + if ( ! mWebBrowserImage || mWebBrowserImage->getNeedsUpdate()) return; if ( gRestoreGL == 1 ) @@ -1129,12 +1129,14 @@ bool LLWebBrowserTexture::updateBrowserTexture() mHeight = media->getTextureHeight(); mTextureCoordsOpenGL = media->getTextureCoordsOpenGL(); + const LLColor4U fill_color(0,0,0,255); // will create mWidth * mHeight sized texture, using the texture params specified by the media. LLDynamicTexture::generateGLTexture( media->getTextureFormatInternal(), media->getTextureFormatPrimary(), media->getTextureFormatType(), - media->getTextureFormatSwapBytes()); + media->getTextureFormatSwapBytes(), + &fill_color); //Initialize the texture to black. mMediaSource->mNeedsNewTexture = false;