From ce28e056c20bf2723f565bbf464b87781ec248a2 Mon Sep 17 00:00:00 2001 From: Jacek Antonelli Date: Fri, 15 Aug 2008 23:45:42 -0500 Subject: Second Life viewer sources 1.20.2 --- linden/indra/llmedia/llmediaimplllmozlib.cpp | 2 +- linden/indra/llmedia/llmediaimplquicktime.cpp | 35 +++++++++++++++------------ linden/indra/llmedia/llmediaobserver.h | 11 +++++++++ 3 files changed, 31 insertions(+), 17 deletions(-) (limited to 'linden/indra/llmedia') diff --git a/linden/indra/llmedia/llmediaimplllmozlib.cpp b/linden/indra/llmedia/llmediaimplllmozlib.cpp index 5efaa59..53cb344 100644 --- a/linden/indra/llmedia/llmediaimplllmozlib.cpp +++ b/linden/indra/llmedia/llmediaimplllmozlib.cpp @@ -289,7 +289,7 @@ void LLMediaImplLLMozLib::onPageChanged( const EventType& eventIn ) // virtual void LLMediaImplLLMozLib::onClickLinkHref( const EventType& eventIn ) { - LLMediaEvent event( this, eventIn.getStringValue() ); + LLMediaEvent event( this, eventIn.getStringValue(), eventIn.getStringValue2() ); mEventEmitter.update( &LLMediaObserver::onClickLinkHref, event ); } diff --git a/linden/indra/llmedia/llmediaimplquicktime.cpp b/linden/indra/llmedia/llmediaimplquicktime.cpp index f9a3b05..b126e2f 100644 --- a/linden/indra/llmedia/llmediaimplquicktime.cpp +++ b/linden/indra/llmedia/llmediaimplquicktime.cpp @@ -256,17 +256,6 @@ bool LLMediaImplQuickTime::sizeChanged() SetMovieGWorld( mMovieHandle, mGWorldHandle, GetGWorldDevice ( mGWorldHandle ) ); } - // flip movie to match the way the client expects textures (sigh!) - MatrixRecord transform; - SetIdentityMatrix( &transform ); // transforms are additive so start from identify matrix - double scaleX = 1.0 / (double)LLMediaManager::textureWidthFromMediaWidth( width ); - double scaleY = -1.0 / (double)LLMediaManager::textureHeightFromMediaHeight( height ); - double centerX = width / 2.0; - double centerY = height / 2.0; - ScaleMatrix( &transform, X2Fix ( scaleX ), X2Fix ( scaleY ), X2Fix ( centerX ), X2Fix ( centerY ) ); - SetMovieMatrix( mMovieHandle, &transform ); - std::cout << "LLMEDIA> Flipping stream to match expected OpenGL orientation size=" << width << " x " << height << std::endl; - // update movie controller if ( mMovieController ) { @@ -454,10 +443,14 @@ bool LLMediaImplQuickTime::processState() bool LLMediaImplQuickTime::setMovieBoxEnhanced( Rect* rect ) { // get movie rect - GetMovieBox( mMovieHandle, rect ); - int width = ( rect->right - rect->left ); - int height = ( rect->bottom - rect->top ); + GetMovieNaturalBoundsRect( mMovieHandle, rect ); + + int natural_width = ( rect->right - rect->left ); + int natural_height = ( rect->bottom - rect->top ); + int width = natural_width; + int height = natural_height; + // if the user has requested a specific size, use it: if ((mMediaRequestedWidth != 0) && (mMediaRequestedHeight != 0)) { @@ -485,12 +478,22 @@ bool LLMediaImplQuickTime::setMovieBoxEnhanced( Rect* rect ) if ( height > mMaxHeight ) height = mMaxHeight; - // tell quicktime about new size + + // scale movie to fit rect and invert vertically to match opengl image format + MatrixRecord transform; + SetIdentityMatrix( &transform ); // transforms are additive so start from identify matrix + double scaleX = (double) width / natural_width; + double scaleY = -1.0 * (double) height / natural_height; + double centerX = width / 2.0; + double centerY = height / 2.0; + ScaleMatrix( &transform, X2Fix ( scaleX ), X2Fix ( scaleY ), X2Fix ( centerX ), X2Fix ( centerY ) ); + SetMovieMatrix( mMovieHandle, &transform ); + + // return the new rect rect->right = width; rect->bottom = height; rect->left = 0; rect->top = 0; - SetMovieBox( mMovieHandle, rect ); return true; } diff --git a/linden/indra/llmedia/llmediaobserver.h b/linden/indra/llmedia/llmediaobserver.h index aeb2c39..ec9f881 100644 --- a/linden/indra/llmedia/llmediaobserver.h +++ b/linden/indra/llmedia/llmediaobserver.h @@ -47,6 +47,11 @@ class LLMediaEvent { }; + LLMediaEvent( LLMediaBase* subject, std::string string_in, std::string string_ex_in ) : + mSubject( subject ), mStringValue(string_in), mStringValueEx(string_ex_in) + { + }; + LLMediaEvent( LLMediaBase* subject, std::string string_in, int int_in ) : mSubject( subject ), mStringValue(string_in), mIntValue(int_in) { @@ -74,10 +79,16 @@ class LLMediaEvent return mStringValue; } + std::string getStringValueEx() const + { + return mStringValueEx; + } + private: LLMediaBase* mSubject; int mIntValue; std::string mStringValue; + std::string mStringValueEx; }; class LLMediaObserver -- cgit v1.1