ooo-build r11877 - in trunk: . patches/src680
- From: rodo svn gnome org
- To: svn-commits-list gnome org
- Subject: ooo-build r11877 - in trunk: . patches/src680
- Date: Tue, 11 Mar 2008 19:28:23 +0000 (GMT)
Author: rodo
Date: Tue Mar 11 19:28:23 2008
New Revision: 11877
URL: http://svn.gnome.org/viewvc/ooo-build?rev=11877&view=rev
Log:
2008-03-11 Radek Doulik <rodo novell com>
* patches/src680/apply: added transogl-mesa-fallback.diff with the
changes described below
* build/ooh680-m9/slideshow/source/engine/transitions/slidetransitionfactory.cxx:
fallback to original transitions when plugin factory doesn't
create the transition we wanted - works as fallback on Mesa/2D
replacements transitions
* build/ooh680-m9/slideshow/source/engine/OGLTrans/OGLTrans_TransitionerImpl.cxx
(initialize): added static initialization method, which sets
various flags of OpenGL environment, added Mesa vendor
detection. Disable 2D replacements when running with Mesa
Added:
trunk/patches/src680/transogl-mesa-fallback.diff
Modified:
trunk/ChangeLog
trunk/patches/src680/apply
Modified: trunk/patches/src680/apply
==============================================================================
--- trunk/patches/src680/apply (original)
+++ trunk/patches/src680/apply Tue Mar 11 19:28:23 2008
@@ -1797,6 +1797,7 @@
transogl-more-transitions.diff
transogl-vsync.diff
transogl-shader-transitions.diff
+transogl-mesa-fallback.diff
[ Experimental ]
# sal_uInt32 -> sal_uIntPtr for events on some places
Added: trunk/patches/src680/transogl-mesa-fallback.diff
==============================================================================
--- (empty file)
+++ trunk/patches/src680/transogl-mesa-fallback.diff Tue Mar 11 19:28:23 2008
@@ -0,0 +1,271 @@
+diff -rup slideshow/source/engine/OGLTrans-orig/OGLTrans_TransitionerImpl.cxx slideshow/source/engine/OGLTrans/OGLTrans_TransitionerImpl.cxx
+--- slideshow/source/engine/OGLTrans-orig/OGLTrans_TransitionerImpl.cxx 2008-03-11 18:02:16.000000000 +0100
++++ slideshow/source/engine/OGLTrans/OGLTrans_TransitionerImpl.cxx 2008-03-11 18:36:35.000000000 +0100
+@@ -88,6 +88,7 @@ public:
+ explicit OGLTransitionerImpl(OGLTransitionImpl* pOGLTransition);
+ bool initWindowFromSlideShowView( const uno::Reference< presentation::XSlideShowView >& xView, double, double);
+ void setSlides( const uno::Reference< rendering::XBitmap >& xLeavingSlide , const uno::Reference< rendering::XBitmap >& xEnteringSlide );
++ static void initialize( const uno::Reference< presentation::XSlideShowView >& xView );
+
+ // XTransition
+ virtual SAL_CALL void update( double nTime ) throw (uno::RuntimeException);
+@@ -152,14 +153,62 @@ private:
+ */
+ OGLTransitionImpl* pTransition;
+
++public:
+ /** whether we are running on ATI fglrx with bug related to textures
+ */
+- bool mbBrokenTexturesATI;
++ static bool cbBrokenTexturesATI;
++
++ /** GL version
++ */
++ static float cnGLVersion;
+
+- /* GL version */
+- float mnGLVersion;
++ /** Whether Mesa is the OpenGL vendor
++ */
++ static bool cbMesa;
+ };
+
++void OGLTransitionerImpl::initialize( const uno::Reference< presentation::XSlideShowView >& xView )
++{
++ // not thread safe
++ static bool initialized = false;
++
++ if( !initialized ) {
++ OGLTransitionerImpl *instance;
++
++ instance = new OGLTransitionerImpl( NULL );
++ instance->initWindowFromSlideShowView( xView, 0, 0 );
++
++ if( instance->GLWin.HasGLXExtension("GLX_SGI_swap_control" ) ) {
++ // enable vsync
++ typedef GLint (*glXSwapIntervalProc)(GLint);
++ glXSwapIntervalProc glXSwapInterval = (glXSwapIntervalProc) unx::glXGetProcAddress( (const GLubyte*) "glXSwapIntervalSGI" );
++ if( glXSwapInterval ) {
++ glXSwapInterval( 1 );
++ OSL_TRACE("set swap interval to 1 (enable vsync)");
++ }
++ }
++
++ const GLubyte* version = glGetString( GL_VERSION );
++ if( version && version[0] ) {
++ cnGLVersion = version[0] - '0';
++ if( version[1] == '.' && version[2] )
++ cnGLVersion += (version[2] - '0')/10.0;
++ } else
++ cnGLVersion = 1.0;
++ OSL_TRACE("GL version: %s parsed: %f", version, cnGLVersion );
++
++ const GLubyte* vendor = glGetString( GL_VENDOR );
++ cbMesa = ( vendor && strstr( (const char *) vendor, "Mesa" ) );
++ OSL_TRACE("GL vendor: %s identified as Mesa: %d", vendor, cbMesa );
++
++ /* TODO: check for version once the bug in fglrx driver is fixed */
++ cbBrokenTexturesATI = (strcmp( (const char *) glGetString( GL_VENDOR ), "ATI Technologies Inc." ) == 0 );
++
++ delete instance;
++ initialized = true;
++ }
++}
++
+ bool OGLTransitionerImpl::initWindowFromSlideShowView( const uno::Reference< presentation::XSlideShowView >& xView, double, double)
+ {
+ osl::MutexGuard const guard( m_aMutex );
+@@ -290,30 +339,6 @@ bool OGLTransitionerImpl::initWindowFrom
+ }
+ glXMakeCurrent( GLWin.dpy, GLWin.win, GLWin.ctx );
+
+- if(GLWin.HasGLXExtension("GLX_SGI_swap_control")) {
+- // enable vsync
+- typedef GLint (*glXSwapIntervalProc)(GLint);
+- glXSwapIntervalProc glXSwapInterval = (glXSwapIntervalProc) unx::glXGetProcAddress( (const GLubyte*) "glXSwapIntervalSGI" );
+- if( glXSwapInterval ) {
+- glXSwapInterval( 1 );
+- OSL_TRACE("set swap interval to 1 (enable vsync)");
+- }
+- }
+-
+- const GLubyte* version = glGetString( GL_VERSION );
+- if( version && version[0] ) {
+- mnGLVersion = version[0] - '0';
+- if( version[1] == '.' && version[2] )
+- mnGLVersion += (version[2] - '0')/10.0;
+- } else
+- mnGLVersion = 1.0;
+- OSL_TRACE("GL version: %s parsed: %f", version, mnGLVersion );
+-
+- /* TODO: check for version once the bug in fglrx driver is fixed */
+- mbBrokenTexturesATI = (strcmp( (const char *) glGetString( GL_VENDOR ), "ATI Technologies Inc." ) == 0 );
+-
+-
+-
+ glEnable(GL_CULL_FACE);
+ glCullFace(GL_BACK);
+ glClearColor (0, 0, 0, 0);
+@@ -331,7 +356,7 @@ bool OGLTransitionerImpl::initWindowFrom
+ if( LeavingBytes.hasElements() && EnteringBytes.hasElements())
+ GLInitSlides();//we already have uninitialized slides, let's initialize
+
+- if( pTransition && pTransition->mnRequiredGLVersion <= mnGLVersion )
++ if( pTransition && pTransition->mnRequiredGLVersion <= cnGLVersion )
+ pTransition->prepare( GLleavingSlide, GLenteringSlide );
+
+ return true;
+@@ -369,7 +394,7 @@ void OGLTransitionerImpl::GLInitSlides()
+ {
+ osl::MutexGuard const guard( m_aMutex );
+
+- if (isDisposed() || pTransition->mnRequiredGLVersion > mnGLVersion)
++ if (isDisposed() || pTransition->mnRequiredGLVersion > cnGLVersion)
+ return;
+
+ glMatrixMode(GL_PROJECTION);
+@@ -459,7 +484,7 @@ void OGLTransitionerImpl::GLInitSlides()
+
+ glGenTextures(1, &GLleavingSlide);
+ glBindTexture(GL_TEXTURE_2D, GLleavingSlide);
+- if( pTransition && !mbBrokenTexturesATI && !pTransition->mbUseMipMapLeaving) {
++ if( pTransition && !cbBrokenTexturesATI && !pTransition->mbUseMipMapLeaving) {
+ glTexImage2D(GL_TEXTURE_2D, 0, internalFormat, SlideSize.Width, SlideSize.Height, 0, Format, GL_UNSIGNED_BYTE, &LeavingBytes[0]);
+ glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S,GL_REPEAT);
+ glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_T,GL_REPEAT);
+@@ -483,7 +508,7 @@ void OGLTransitionerImpl::GLInitSlides()
+
+ glGenTextures(1, &GLenteringSlide);
+ glBindTexture(GL_TEXTURE_2D, GLenteringSlide);
+- if( pTransition && !mbBrokenTexturesATI && !pTransition->mbUseMipMapEntering ) {
++ if( pTransition && !cbBrokenTexturesATI && !pTransition->mbUseMipMapEntering ) {
+ glTexImage2D(GL_TEXTURE_2D, 0, internalFormat, SlideSize.Width, SlideSize.Height, 0, Format, GL_UNSIGNED_BYTE, &EnteringBytes[0]);
+ glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S,GL_REPEAT);
+ glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_T,GL_REPEAT);
+@@ -508,7 +533,7 @@ void SAL_CALL OGLTransitionerImpl::updat
+ {
+ osl::MutexGuard const guard( m_aMutex );
+
+- if (isDisposed() || pTransition->mnRequiredGLVersion > mnGLVersion)
++ if (isDisposed() || pTransition->mnRequiredGLVersion > cnGLVersion)
+ return;
+
+ glEnable(GL_DEPTH_TEST);
+@@ -612,6 +637,14 @@ public:
+ if( !hasTransition( transitionType, transitionSubType ) )
+ return uno::Reference< presentation::XTransition >();
+
++ OGLTransitionerImpl::initialize( view );
++
++ if( OGLTransitionerImpl::cbMesa && (
++ ( transitionType == animations::TransitionType::FADE && transitionSubType == animations::TransitionSubType::CROSSFADE ) ||
++ ( transitionType == animations::TransitionType::IRISWIPE && transitionSubType == animations::TransitionSubType::DIAMOND ) ) )
++ return uno::Reference< presentation::XTransition >();
++
++
+ OGLTransitionImpl* pTransition;
+
+ if( transitionType == animations::TransitionType::MISCSHAPEWIPE ) {
+--- /home/rodo/svn/ooo-build-1/build/ooh680-m9-mesa/slideshow/source/engine/transitions/slidetransitionfactory.cxx 2008-03-10 18:45:01.000000000 +0100
++++ slideshow/source/engine/transitions/slidetransitionfactory.cxx 2008-03-11 18:33:23.000000000 +0100
+@@ -131,7 +131,8 @@ public:
+ rViewContainer,
+ rScreenUpdater,
+ rEventMultiplexer ),
+- maTransitions()
++ maTransitions(),
++ mbSuccess( false )
+ {
+ // create one transition per view
+ UnoViewVector::const_iterator aCurrView (rViewContainer.begin());
+@@ -143,19 +144,25 @@ public:
+ const ::basegfx::B2DPoint aOffsetPixel(
+ aViewTransform * ::basegfx::B2DPoint() );
+
+- maTransitions.push_back(
+- xFactory->createTransition(
++ uno::Reference<presentation::XTransition> rTransition = xFactory->createTransition(
+ nTransitionType,
+ nTransitionSubType,
+ (*aCurrView)->getUnoView(),
+ getLeavingBitmap(ViewEntry(*aCurrView))->getXBitmap(),
+ getEnteringBitmap(ViewEntry(*aCurrView))->getXBitmap(),
+- basegfx::unotools::point2DFromB2DPoint(aOffsetPixel) ) );
++ basegfx::unotools::point2DFromB2DPoint(aOffsetPixel) );
++
++ if( rTransition.is() )
++ maTransitions.push_back( rTransition );
++ else
++ return;
+
+ ENSURE_AND_THROW(maTransitions.back().is(),
+ "Failed to create plugin transition");
+ ++aCurrView;
+ }
++
++ mbSuccess = true;
+ }
+
+ virtual bool operator()( double t )
+@@ -167,9 +174,17 @@ public:
+ return true;
+ }
+
++ bool Success()
++ {
++ return mbSuccess;
++ }
++
+ private:
+ // One transition object per view
+ std::vector< uno::Reference<presentation::XTransition> > maTransitions;
++
++ // bool
++ bool mbSuccess;
+ };
+
+
+@@ -692,7 +707,7 @@ NumberAnimationSharedPtr createPluginTra
+ const SoundPlayerSharedPtr& pSoundPlayer,
+ EventMultiplexer& rEventMultiplexer)
+ {
+- return NumberAnimationSharedPtr(
++ PluginSlideChange* pTransition =
+ new PluginSlideChange(
+ nTransitionType,
+ nTransitionSubType,
+@@ -702,7 +717,14 @@ NumberAnimationSharedPtr createPluginTra
+ rScreenUpdater,
+ xFactory,
+ pSoundPlayer,
+- rEventMultiplexer ));
++ rEventMultiplexer );
++
++ if( pTransition->Success() )
++ return NumberAnimationSharedPtr( pTransition );
++ else {
++ delete pTransition;
++ return NumberAnimationSharedPtr();
++ }
+ }
+
+ } // anon namespace
+@@ -740,7 +762,7 @@ NumberAnimationSharedPtr TransitionFacto
+ xOptionalFactory->hasTransition(nTransitionType, nTransitionSubType) )
+ {
+ // #i82460# - optional plugin factory claims this transition. delegate.
+- return NumberAnimationSharedPtr(
++ NumberAnimationSharedPtr pTransition(
+ createPluginTransition(
+ nTransitionType,
+ nTransitionSubType,
+@@ -751,6 +773,9 @@ NumberAnimationSharedPtr TransitionFacto
+ xOptionalFactory,
+ pSoundPlayer,
+ rEventMultiplexer ));
++
++ if( pTransition.get() )
++ return pTransition;
+ }
+
+ const TransitionInfo* pTransitionInfo(
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]