1 --- slideshow/source/engine/OGLTrans/OGLTrans_TransitionerImpl.cxx.old 2009-04-06 16:42:09.000000000 +0000
2 +++ slideshow/source/engine/OGLTrans/OGLTrans_TransitionerImpl.cxx 2009-04-06 16:42:09.000000000 +0000
3 @@ -93,7 +93,7 @@ public:
4 explicit OGLTransitionerImpl(OGLTransitionImpl* pOGLTransition);
5 bool initWindowFromSlideShowView( const uno::Reference< presentation::XSlideShowView >& xView, double, double);
6 void setSlides( const uno::Reference< rendering::XBitmap >& xLeavingSlide , const uno::Reference< rendering::XBitmap >& xEnteringSlide );
7 - static void initialize( const uno::Reference< presentation::XSlideShowView >& xView );
8 + static bool initialize( const uno::Reference< presentation::XSlideShowView >& xView );
11 virtual void SAL_CALL update( double nTime ) throw (uno::RuntimeException);
12 @@ -179,14 +179,20 @@ public:
13 /** Whether Mesa is the OpenGL vendor
18 + whether the display has GLX extension
20 + static bool cbGLXPresent;
23 // declare the static variables as some gcc versions have problems declaring them automaticaly
24 bool OGLTransitionerImpl::cbBrokenTexturesATI;
25 float OGLTransitionerImpl::cnGLVersion;
26 bool OGLTransitionerImpl::cbMesa;
27 +bool OGLTransitionerImpl::cbGLXPresent;
29 -void OGLTransitionerImpl::initialize( const uno::Reference< presentation::XSlideShowView >& xView )
30 +bool OGLTransitionerImpl::initialize( const uno::Reference< presentation::XSlideShowView >& xView )
33 static bool initialized = false;
34 @@ -195,28 +201,34 @@ void OGLTransitionerImpl::initialize( co
35 OGLTransitionerImpl *instance;
37 instance = new OGLTransitionerImpl( NULL );
38 - instance->initWindowFromSlideShowView( xView, 0, 0 );
39 + if( instance->initWindowFromSlideShowView( xView, 0, 0 ) ) {
41 - const GLubyte* version = glGetString( GL_VERSION );
42 - if( version && version[0] ) {
43 - cnGLVersion = version[0] - '0';
44 - if( version[1] == '.' && version[2] )
45 - cnGLVersion += (version[2] - '0')/10.0;
48 - OSL_TRACE("GL version: %s parsed: %f", version, cnGLVersion );
49 + const GLubyte* version = glGetString( GL_VERSION );
50 + if( version && version[0] ) {
51 + cnGLVersion = version[0] - '0';
52 + if( version[1] == '.' && version[2] )
53 + cnGLVersion += (version[2] - '0')/10.0;
56 + OSL_TRACE("GL version: %s parsed: %f", version, cnGLVersion );
58 + const GLubyte* vendor = glGetString( GL_VENDOR );
59 + cbMesa = ( vendor && strstr( (const char *) vendor, "Mesa" ) );
60 + OSL_TRACE("GL vendor: %s identified as Mesa: %d", vendor, cbMesa );
62 - const GLubyte* vendor = glGetString( GL_VENDOR );
63 - cbMesa = ( vendor && strstr( (const char *) vendor, "Mesa" ) );
64 - OSL_TRACE("GL vendor: %s identified as Mesa: %d", vendor, cbMesa );
65 + /* TODO: check for version once the bug in fglrx driver is fixed */
66 + cbBrokenTexturesATI = (vendor && strcmp( (const char *) vendor, "ATI Technologies Inc." ) == 0 );
68 - /* TODO: check for version once the bug in fglrx driver is fixed */
69 - cbBrokenTexturesATI = (strcmp( (const char *) glGetString( GL_VENDOR ), "ATI Technologies Inc." ) == 0 );
70 + instance->disposing();
71 + cbGLXPresent = true;
73 + cbGLXPresent = false;
75 - instance->disposing();
80 + return cbGLXPresent;
83 bool OGLTransitionerImpl::initWindowFromSlideShowView( const uno::Reference< presentation::XSlideShowView >& xView, double, double)
84 @@ -243,6 +255,10 @@ bool OGLTransitionerImpl::initWindowFrom
85 GLWin.hWnd = sysData->hWnd;
87 GLWin.dpy = reinterpret_cast<unx::Display*>(sysData->pDisplay);
89 + if( unx::glXQueryExtension( GLWin.dpy, NULL, NULL ) == false )
92 GLWin.win = sysData->aWindow;
93 GLWin.screen = unx::XDefaultScreen(GLWin.dpy);
94 unx::XVisualInfo* vi( NULL );
95 @@ -770,7 +786,7 @@ void SAL_CALL OGLTransitionerImpl::updat
97 osl::MutexGuard const guard( m_aMutex );
99 - if (isDisposed() || pTransition->mnRequiredGLVersion > cnGLVersion)
100 + if (isDisposed() || !cbGLXPresent || pTransition->mnRequiredGLVersion > cnGLVersion)
103 glEnable(GL_DEPTH_TEST);
104 @@ -904,7 +920,7 @@ public:
105 if( !hasTransition( transitionType, transitionSubType ) )
106 return uno::Reference< presentation::XTransition >();
108 - OGLTransitionerImpl::initialize( view );
109 + bool bGLXPresent = OGLTransitionerImpl::initialize( view );
111 if( OGLTransitionerImpl::cbMesa && (
112 ( transitionType == animations::TransitionType::FADE && transitionSubType == animations::TransitionSubType::CROSSFADE ) ||
113 @@ -974,9 +990,11 @@ public:
115 rtl::Reference<OGLTransitionerImpl> xRes(
116 new OGLTransitionerImpl(pTransition) );
117 - if(!xRes->initWindowFromSlideShowView(view,slideOffset.X,slideOffset.Y))
118 - return uno::Reference< presentation::XTransition >();
119 - xRes->setSlides(leavingBitmap,enteringBitmap);
120 + if( bGLXPresent ) {
121 + if( !xRes->initWindowFromSlideShowView(view,slideOffset.X,slideOffset.Y))
122 + return uno::Reference< presentation::XTransition >();
123 + xRes->setSlides(leavingBitmap,enteringBitmap);
126 return uno::Reference<presentation::XTransition>(xRes.get());