Commits

Monroe Linden committed 031275d

Fix for DEV-39258.

When the amount of the texture that's being drawn by the plugin shrinks in either width or height, reallocate the texture (which clears it).

Comments (0)

Files changed (2)

indra/newview/llviewermedia.cpp

 	mMediaAutoScale(media_auto_scale),
 	mMediaLoop(media_loop),
 	mNeedsNewTexture(true),
+	mTextureUsedWidth(0),
+	mTextureUsedHeight(0),
 	mSuspendUpdates(false),
 	mVisible(true),
 	mLastSetCursor( UI_CURSOR_ARROW ),
 	
 	if (mNeedsNewTexture 
 		|| placeholder_image->getUseMipMaps()
-		|| placeholder_image->getWidth() != mMediaSource->getTextureWidth()
-		|| placeholder_image->getHeight() != mMediaSource->getTextureHeight())
+		|| (placeholder_image->getWidth() != mMediaSource->getTextureWidth())
+		|| (placeholder_image->getHeight() != mMediaSource->getTextureHeight())
+		|| (mTextureUsedWidth > mMediaSource->getWidth())
+		|| (mTextureUsedHeight > mMediaSource->getHeight())
+		)
 	{
 		LL_DEBUGS("Media") << "initializing media placeholder" << LL_ENDL;
 		LL_DEBUGS("Media") << "movie image id " << mTextureId << LL_ENDL;
 		// FIXME
 //		placeholder_image->mIsMediaTexture = true;
 		mNeedsNewTexture = false;
+				
+		// If the amount of the texture being drawn by the media goes down in either width or height, 
+		// recreate the texture to avoid leaving parts of the old image behind.
+		mTextureUsedWidth = mMediaSource->getWidth();
+		mTextureUsedHeight = mMediaSource->getHeight();
 	}
 	
 	return placeholder_image;

indra/newview/llviewermedia.h

 	bool mMediaAutoScale;
 	bool mMediaLoop;
 	bool mNeedsNewTexture;
+	S32 mTextureUsedWidth;
+	S32 mTextureUsedHeight;
 	bool mSuspendUpdates;
 	bool mVisible;
 	ECursorType mLastSetCursor;