slideshow/source/engine/OGLTrans/unx/OGLTrans_TransitionImpl.cxx | 5 slideshow/source/engine/OGLTrans/unx/OGLTrans_TransitionerImpl.cxx | 67 +++++++--- 2 files changed, 53 insertions(+), 19 deletions(-)
New commits: commit 60f6c7578b2ba9e78d1aa9589b315aec6b489a16 Author: David Tardon <[email protected]> Date: Wed Nov 28 11:58:46 2012 +0100 fix first run of shader-using 3D transitions The slideshow engine emits viewChanged() immediately after the transition has been initialized. Because the ShaderTransition data were not fully reset in finishTransition_, no transition texture would be generated on the re-initialization in viewChanged(), thus there would be no transition on the first slide. Change-Id: I04fef9a6c09537995d83889be2fe15569a1ddc2c diff --git a/slideshow/source/engine/OGLTrans/unx/OGLTrans_TransitionImpl.cxx b/slideshow/source/engine/OGLTrans/unx/OGLTrans_TransitionImpl.cxx index 491381c..efdf7be 100644 --- a/slideshow/source/engine/OGLTrans/unx/OGLTrans_TransitionImpl.cxx +++ b/slideshow/source/engine/OGLTrans/unx/OGLTrans_TransitionImpl.cxx @@ -1449,6 +1449,11 @@ void ShaderTransition::finishTransition_() OGLShaders::glDeleteProgram( m_nProgramObject ); m_nProgramObject = 0; } + if ( m_nHelperTexture ) + { + glDeleteTextures( 1, &m_nHelperTexture ); + m_nHelperTexture = 0; + } #endif } commit 5ff406634d41b16db2c238d284d7fd7cae66299e Author: David Tardon <[email protected]> Date: Wed Nov 28 11:58:18 2012 +0100 fix 3D slide trans. initialization Change-Id: Iafec5485d0a097f386070370b989d5e77f631d99 diff --git a/slideshow/source/engine/OGLTrans/unx/OGLTrans_TransitionerImpl.cxx b/slideshow/source/engine/OGLTrans/unx/OGLTrans_TransitionerImpl.cxx index 03e7c4c..2e3ae05 100644 --- a/slideshow/source/engine/OGLTrans/unx/OGLTrans_TransitionerImpl.cxx +++ b/slideshow/source/engine/OGLTrans/unx/OGLTrans_TransitionerImpl.cxx @@ -179,9 +179,10 @@ class OGLTransitionerImpl : private cppu::BaseMutex, private boost::noncopyable, { public: OGLTransitionerImpl(); - void setSlides( const Reference< rendering::XBitmap >& xLeavingSlide , const uno::Reference< rendering::XBitmap >& xEnteringSlide ); void setTransition( boost::shared_ptr<OGLTransitionImpl> pOGLTransition ); - bool initialize( const Reference< presentation::XSlideShowView >& xView ); + bool initialize( const Reference< presentation::XSlideShowView >& xView, + const Reference< rendering::XBitmap >& xLeavingSlide, + const Reference< rendering::XBitmap >& xEnteringSlide ); // XTransition virtual void SAL_CALL update( double nTime ) @@ -218,6 +219,9 @@ protected: private: static void impl_initializeOnce( bool const bGLXPresent ); + void setSlides( const Reference< rendering::XBitmap >& xLeavingSlide , const uno::Reference< rendering::XBitmap >& xEnteringSlide ); + void impl_prepareSlides(); + void impl_createTexture( bool useMipmap, uno::Sequence<sal_Int8>& data, const OGLFormat* pFormat ); bool initWindowFromSlideShowView( const uno::Reference< presentation::XSlideShowView >& xView ); @@ -225,6 +229,8 @@ private: */ void GLInitSlides(); + void impl_prepareTransition(); + void impl_finishTransition(); /// Holds the information of our new child window struct GLWindow @@ -351,12 +357,15 @@ float OGLTransitionerImpl::cnGLVersion; bool OGLTransitionerImpl::cbMesa; bool OGLTransitionerImpl::cbGLXPresent; -bool OGLTransitionerImpl::initialize( const Reference< presentation::XSlideShowView >& xView ) +bool OGLTransitionerImpl::initialize( const Reference< presentation::XSlideShowView >& xView, + const Reference< rendering::XBitmap >& xLeavingSlide, + const Reference< rendering::XBitmap >& xEnteringSlide ) { - bool const bGLXPresent( initWindowFromSlideShowView( xView ) ); impl_initializeOnce( bGLXPresent ); + setSlides( xLeavingSlide, xEnteringSlide ); + return cbGLXPresent; } @@ -749,20 +758,25 @@ void OGLTransitionerImpl::setSlides( const uno::Reference< rendering::XBitmap >& mxLeavingBitmap.set( xLeavingSlide , UNO_QUERY_THROW ); mxEnteringBitmap.set( xEnteringSlide , UNO_QUERY_THROW ); - Reference< XFastPropertySet > xLeavingSet( xLeavingSlide , UNO_QUERY ); - Reference< XFastPropertySet > xEnteringSet( xEnteringSlide , UNO_QUERY ); - geometry::IntegerRectangle2D SlideRect; SlideSize = mxLeavingBitmap->getSize(); + SAL_INFO("slideshow.opengl", "leaving bitmap area: " << SlideSize.Width << "x" << SlideSize.Height); + SlideSize = mxEnteringBitmap->getSize(); + SAL_INFO("slideshow.opengl", "entering bitmap area: " << SlideSize.Width << "x" << SlideSize.Height); +} + + +void OGLTransitionerImpl::impl_prepareSlides() +{ + Reference< XFastPropertySet > xLeavingSet( mxLeavingBitmap , UNO_QUERY ); + Reference< XFastPropertySet > xEnteringSet( mxEnteringBitmap , UNO_QUERY ); + + geometry::IntegerRectangle2D SlideRect; SlideRect.X1 = 0; SlideRect.X2 = SlideSize.Width; SlideRect.Y1 = 0; SlideRect.Y2 = SlideSize.Height; - SAL_INFO("slideshow.opengl", "leaving bitmap area: " << SlideSize.Width << "x" << SlideSize.Height); - SlideSize = mxEnteringBitmap->getSize(); - SAL_INFO("slideshow.opengl", "entering bitmap area: " << SlideSize.Width << "x" << SlideSize.Height); - #ifdef UNX unx::glXWaitGL(); XSync(GLWin.dpy, false); @@ -874,14 +888,29 @@ void OGLTransitionerImpl::setSlides( const uno::Reference< rendering::XBitmap >& #endif } -void OGLTransitionerImpl::setTransition( boost::shared_ptr<OGLTransitionImpl> const pNewTransition ) +void OGLTransitionerImpl::impl_prepareTransition() { - mpTransition = pNewTransition; - if( mpTransition && mpTransition->getSettings().mnRequiredGLVersion <= cnGLVersion ) mpTransition->prepare( GLleavingSlide, GLenteringSlide ); } +void OGLTransitionerImpl::impl_finishTransition() +{ + if( mpTransition && mpTransition->getSettings().mnRequiredGLVersion <= cnGLVersion ) + mpTransition->finish(); +} + +void OGLTransitionerImpl::setTransition( boost::shared_ptr<OGLTransitionImpl> const pTransition ) +{ + if ( mpTransition ) // already initialized + return; + + mpTransition = pTransition; + + impl_prepareSlides(); + impl_prepareTransition(); +} + void OGLTransitionerImpl::createTexture( unsigned int* texID, #if defined( GLX_VERSION_1_3 ) && defined( GLX_EXT_texture_from_pixmap ) unx::GLXPixmap pixmap, @@ -1570,11 +1599,14 @@ void SAL_CALL OGLTransitionerImpl::viewChanged( const Reference< presentation::X { SAL_INFO("slideshow.opengl", "transitioner: view changed"); + impl_finishTransition(); disposeTextures(); disposeContextAndWindow(); initWindowFromSlideShowView( rView ); setSlides( rLeavingBitmap, rEnteringBitmap ); + impl_prepareSlides(); + impl_prepareTransition(); } void OGLTransitionerImpl::disposeContextAndWindow() @@ -1674,11 +1706,9 @@ void OGLTransitionerImpl::disposing() #endif if( pWindow ) { + impl_finishTransition(); disposeTextures(); - if (mpTransition) - mpTransition->finish(); - #ifdef UNX if( mbRestoreSync ) { // try to reestablish synchronize state @@ -1781,7 +1811,7 @@ public: return uno::Reference< presentation::XTransition >(); rtl::Reference< OGLTransitionerImpl > xRes( new OGLTransitionerImpl() ); - if ( !xRes->initialize( view ) ) + if ( !xRes->initialize( view, leavingBitmap, enteringBitmap ) ) return uno::Reference< presentation::XTransition >(); if( OGLTransitionerImpl::cbMesa && ( @@ -1852,7 +1882,6 @@ public: return uno::Reference< presentation::XTransition >(); xRes->setTransition( pTransition ); - xRes->setSlides(leavingBitmap,enteringBitmap); return uno::Reference<presentation::XTransition>(xRes.get()); } _______________________________________________ Libreoffice-commits mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
