diff options
Diffstat (limited to 'slideshow/source/engine/OGLTrans/OGLTrans_TransitionerImpl.cxx')
-rw-r--r-- | slideshow/source/engine/OGLTrans/OGLTrans_TransitionerImpl.cxx | 170 |
1 files changed, 85 insertions, 85 deletions
diff --git a/slideshow/source/engine/OGLTrans/OGLTrans_TransitionerImpl.cxx b/slideshow/source/engine/OGLTrans/OGLTrans_TransitionerImpl.cxx index 2f0c6673ade9..33784088d3d5 100644 --- a/slideshow/source/engine/OGLTrans/OGLTrans_TransitionerImpl.cxx +++ b/slideshow/source/engine/OGLTrans/OGLTrans_TransitionerImpl.cxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -60,7 +60,7 @@ #include <GL/glu.h> -#if defined( WNT ) +#if defined( WNT ) #include <tools/prewin.h> #include <windows.h> #include <tools/postwin.h> @@ -116,7 +116,7 @@ namespace GLenum eType; }; - /* channel ordering: (0:rgba, 1:bgra, 2:argb, 3:abgr) + /* channel ordering: (0:rgba, 1:bgra, 2:argb, 3:abgr) */ int calcComponentOrderIndex(const uno::Sequence<sal_Int8>& rTags) { @@ -127,7 +127,7 @@ namespace RGB_RED, RGB_GREEN, RGB_BLUE, ALPHA, RGB_BLUE, RGB_GREEN, RGB_RED, ALPHA, ALPHA, RGB_RED, RGB_GREEN, RGB_BLUE, - ALPHA, RGB_BLUE, RGB_GREEN, RGB_RED, + ALPHA, RGB_BLUE, RGB_GREEN, RGB_RED, }; const sal_Int32 nNumComps(rTags.getLength()); @@ -177,14 +177,14 @@ public: const Reference< rendering::XBitmap >& rLeavingBitmap, const Reference< rendering::XBitmap >& rEnteringBitmap ) throw (uno::RuntimeException); - + protected: void disposeContextAndWindow(); void disposeTextures(); // WeakComponentImplHelperBase virtual void SAL_CALL disposing(); - + bool isDisposed() const { return (rBHelper.bDisposed || rBHelper.bInDispose); @@ -202,7 +202,7 @@ protected: void prepareEnvironment (); const OGLFormat* chooseFormats(); -private: +private: /** After the window has been created, and the slides have been set, we'll initialize the slides with OpenGL. */ void GLInitSlides(); @@ -211,10 +211,10 @@ private: /// Holds the information of our new child window struct GLWindow { -#if defined( WNT ) - HWND hWnd; - HDC hDC; - HGLRC hRC; +#if defined( WNT ) + HWND hWnd; + HDC hDC; + HGLRC hRC; #elif defined( OS2 ) #elif defined( QUARTZ ) #elif defined( UNX ) @@ -236,14 +236,14 @@ private: bool HasGLXExtension( const char* name ) { return gluCheckExtension( (const GLubyte*) name, (const GLubyte*) GLXExtensions ); } bool HasGLExtension( const char* name ) { return gluCheckExtension( (const GLubyte*) name, GLExtensions ); } } GLWin; - + /** OpenGL handle to the leaving slide's texture */ unsigned int GLleavingSlide; /** OpenGL handle to the entering slide's texture */ unsigned int GLenteringSlide; - + /** pointer to our window which we MIGHT create. */ class SystemChildWindow* pWindow; @@ -251,11 +251,11 @@ private: Reference< presentation::XSlideShowView > mxView; Reference< rendering::XIntegerBitmap > mxLeavingBitmap; Reference< rendering::XIntegerBitmap > mxEnteringBitmap; - + /** raw bytes of the entering bitmap */ uno::Sequence<sal_Int8> EnteringBytes; - + /** raw bytes of the leaving bitmap */ uno::Sequence<sal_Int8> LeavingBytes; @@ -271,17 +271,17 @@ private: bool mbFreeEnteringPixmap; unx::Pixmap maLeavingPixmap; unx::Pixmap maEnteringPixmap; - + /** the form the raw bytes are in for the bitmaps */ - rendering::IntegerBitmapLayout SlideBitmapLayout; - + rendering::IntegerBitmapLayout SlideBitmapLayout; + /** the size of the slides - */ + */ geometry::IntegerSize2D SlideSize; - + /** Our Transition to be used. - */ + */ OGLTransitionImpl* pTransition; public: @@ -376,7 +376,7 @@ bool OGLTransitionerImpl::initialize( const Reference< presentation::XSlideShowV bool OGLTransitionerImpl::createWindow( Window* pPWindow ) { const SystemEnvData* sysData(pPWindow->GetSystemData()); -#if defined( WNT ) +#if defined( WNT ) GLWin.hWnd = sysData->hWnd; #elif defined( UNX ) GLWin.dpy = reinterpret_cast<unx::Display*>(sysData->pDisplay); @@ -408,7 +408,7 @@ bool OGLTransitionerImpl::createWindow( Window* pPWindow ) GLX_DEPTH_SIZE,0,//no depth buffer None }; - static int attrList2[] = + static int attrList2[] = { GLX_RGBA,//only TrueColor or DirectColor /// single buffered @@ -437,8 +437,8 @@ bool OGLTransitionerImpl::createWindow( Window* pPWindow ) GLX_BLUE_SIZE,4,/// use the maximum blue bits, with a minimum of 4 bits GLX_DEPTH_SIZE,1,/// use the maximum depth bits, making sure there is a depth buffer None - }; - static int* attrTable[] = + }; + static int* attrTable[] = { attrList0, attrList1, @@ -534,13 +534,13 @@ bool OGLTransitionerImpl::createWindow( Window* pPWindow ) } #endif -#if defined( WNT ) +#if defined( WNT ) const SystemEnvData* pChildSysData = NULL; SystemWindowData winData; winData.nSize = sizeof(winData); pWindow=new SystemChildWindow(pPWindow, 0, &winData, FALSE); pChildSysData = pWindow->GetSystemData(); -#endif +#endif if( pWindow ) { @@ -550,7 +550,7 @@ bool OGLTransitionerImpl::createWindow( Window* pPWindow ) pWindow->SetControlForeground(); pWindow->SetControlBackground(); pWindow->EnablePaint(FALSE); -#if defined( WNT ) +#if defined( WNT ) GLWin.hWnd = sysData->hWnd; #elif defined( UNX ) GLWin.dpy = reinterpret_cast<unx::Display*>(pChildSysData->pDisplay); @@ -600,7 +600,7 @@ bool OGLTransitionerImpl::initWindowFromSlideShowView( const Reference< presenta GLWin.Height = aCanvasArea.Height; OSL_TRACE("canvas area: %d,%d - %dx%d", aCanvasArea.X, aCanvasArea.Y, aCanvasArea.Width, aCanvasArea.Height); -#if defined( WNT ) +#if defined( WNT ) GLWin.hDC = GetDC(GLWin.hWnd); #elif defined( UNX ) GLWin.ctx = glXCreateContext(GLWin.dpy, @@ -613,27 +613,27 @@ bool OGLTransitionerImpl::initWindowFromSlideShowView( const Reference< presenta } #endif -#if defined( WNT ) - PIXELFORMATDESCRIPTOR PixelFormatFront = // PixelFormat Tells Windows How We Want Things To Be +#if defined( WNT ) + PIXELFORMATDESCRIPTOR PixelFormatFront = // PixelFormat Tells Windows How We Want Things To Be { sizeof(PIXELFORMATDESCRIPTOR), - 1, // Version Number + 1, // Version Number PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER, - PFD_TYPE_RGBA, // Request An RGBA Format - (BYTE)32, // Select Our Color Depth - 0, 0, 0, 0, 0, 0, // Color Bits Ignored - 0, // No Alpha Buffer - 0, // Shift Bit Ignored - 0, // No Accumulation Buffer - 0, 0, 0, 0, // Accumulation Bits Ignored - 64, // 32 bit Z-BUFFER - 0, // 0 bit stencil buffer - 0, // No Auxiliary Buffer - 0, // now ignored - 0, // Reserved - 0, 0, 0 // Layer Masks Ignored + PFD_TYPE_RGBA, // Request An RGBA Format + (BYTE)32, // Select Our Color Depth + 0, 0, 0, 0, 0, 0, // Color Bits Ignored + 0, // No Alpha Buffer + 0, // Shift Bit Ignored + 0, // No Accumulation Buffer + 0, 0, 0, 0, // Accumulation Bits Ignored + 64, // 32 bit Z-BUFFER + 0, // 0 bit stencil buffer + 0, // No Auxiliary Buffer + 0, // now ignored + 0, // Reserved + 0, 0, 0 // Layer Masks Ignored }; int WindowPix = ChoosePixelFormat(GLWin.hDC,&PixelFormatFront); SetPixelFormat(GLWin.hDC,WindowPix,&PixelFormatFront); @@ -690,12 +690,12 @@ bool OGLTransitionerImpl::initWindowFromSlideShowView( const Reference< presenta glCullFace(GL_BACK); glClearColor (0, 0, 0, 0); glClear(GL_COLOR_BUFFER_BIT); -#if defined( WNT ) +#if defined( WNT ) SwapBuffers(GLWin.hDC); #elif defined( UNX ) unx::glXSwapBuffers(GLWin.dpy, GLWin.win); #endif - + glEnable(GL_LIGHTING); GLfloat light_direction[] = { 0.0 , 0.0 , 1.0 }; GLfloat materialDiffuse[] = { 1.0 , 1.0 , 1.0 , 1.0}; @@ -705,7 +705,7 @@ bool OGLTransitionerImpl::initWindowFromSlideShowView( const Reference< presenta glEnable(GL_NORMALIZE); if( LeavingBytes.hasElements() && EnteringBytes.hasElements()) - GLInitSlides();//we already have uninitialized slides, let's initialize + GLInitSlides();//we already have uninitialized slides, let's initialize if( pTransition && pTransition->mnRequiredGLVersion <= cnGLVersion ) pTransition->prepare( GLleavingSlide, GLenteringSlide ); @@ -713,14 +713,14 @@ bool OGLTransitionerImpl::initWindowFromSlideShowView( const Reference< presenta return true; } -void OGLTransitionerImpl::setSlides( const uno::Reference< rendering::XBitmap >& xLeavingSlide, +void OGLTransitionerImpl::setSlides( const uno::Reference< rendering::XBitmap >& xLeavingSlide, const uno::Reference< rendering::XBitmap >& xEnteringSlide ) { osl::MutexGuard const guard( m_aMutex ); if (isDisposed()) return; - + mxLeavingBitmap.set( xLeavingSlide , UNO_QUERY_THROW ); mxEnteringBitmap.set( xEnteringSlide , UNO_QUERY_THROW ); Reference< XFastPropertySet > xLeavingSet( xLeavingSlide , UNO_QUERY ); @@ -800,7 +800,7 @@ void OGLTransitionerImpl::setSlides( const uno::Reference< rendering::XBitmap >& } errorTriggered = false; } - + EnteringPixmap = glXCreatePixmap( GLWin.dpy, GLWin.fbc, maEnteringPixmap, pixmapAttribs ); // sync so that we possibly get an XError @@ -830,7 +830,7 @@ void OGLTransitionerImpl::setSlides( const uno::Reference< rendering::XBitmap >& if( !mbUseEnteringPixmap ) EnteringBytes = mxEnteringBitmap->getData(SlideBitmapLayout,SlideRect); -// TODO +// TODO #ifdef UNX if(GLWin.ctx)//if we have a rendering context, let's init the slides #endif @@ -885,16 +885,16 @@ void OGLTransitionerImpl::createTexture( unsigned int* texID, #endif if( !pFormat ) { - // force-convert color to ARGB8888 int color space + // force-convert color to ARGB8888 int color space uno::Sequence<sal_Int8> tempBytes( SlideBitmapLayout.ColorSpace->convertToIntegerColorSpace( data, canvas::tools::getStdColorSpace())); - gluBuild2DMipmaps(GL_TEXTURE_2D, - 4, - SlideSize.Width, - SlideSize.Height, - GL_RGBA, + gluBuild2DMipmaps(GL_TEXTURE_2D, + 4, + SlideSize.Width, + SlideSize.Height, + GL_RGBA, GL_UNSIGNED_BYTE, &tempBytes[0]); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR); @@ -967,7 +967,7 @@ const OGLFormat* OGLTransitionerImpl::chooseFormats() (0:16, 1:24, 2:32), then channel ordering: (0:rgba, 1:bgra, 2:argb, 3:abgr) */ - static const OGLFormat lcl_RGB24[] = + static const OGLFormat lcl_RGB24[] = { // 24 bit RGB {3, GL_BGR, GL_UNSIGNED_BYTE}, @@ -978,7 +978,7 @@ const OGLFormat* OGLTransitionerImpl::chooseFormats() #if defined(GL_VERSION_1_2) && defined(GLU_VERSION_1_3) // more format constants available - static const OGLFormat lcl_RGB16[] = + static const OGLFormat lcl_RGB16[] = { // 16 bit RGB {3, GL_RGB, GL_UNSIGNED_SHORT_5_6_5_REV}, @@ -987,7 +987,7 @@ const OGLFormat* OGLTransitionerImpl::chooseFormats() {3, GL_RGB, GL_UNSIGNED_SHORT_5_6_5} }; - static const OGLFormat lcl_ARGB16_4[] = + static const OGLFormat lcl_ARGB16_4[] = { // 16 bit ARGB {4, GL_RGBA, GL_UNSIGNED_SHORT_4_4_4_4_REV}, @@ -996,7 +996,7 @@ const OGLFormat* OGLTransitionerImpl::chooseFormats() {4, GL_RGBA, GL_UNSIGNED_SHORT_4_4_4_4} }; - static const OGLFormat lcl_ARGB16_5[] = + static const OGLFormat lcl_ARGB16_5[] = { // 16 bit ARGB {4, GL_RGBA, GL_UNSIGNED_SHORT_1_5_5_5_REV}, @@ -1005,7 +1005,7 @@ const OGLFormat* OGLTransitionerImpl::chooseFormats() {4, GL_RGBA, GL_UNSIGNED_SHORT_5_5_5_1} }; - static const OGLFormat lcl_ARGB32[] = + static const OGLFormat lcl_ARGB32[] = { // 32 bit ARGB {4, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8_REV}, @@ -1024,7 +1024,7 @@ const OGLFormat* OGLTransitionerImpl::chooseFormats() // supported component ordering? const int nComponentOrderIndex( calcComponentOrderIndex(aComponentTags)); - if( nComponentOrderIndex != -1 ) + if( nComponentOrderIndex != -1 ) { switch( nBitsPerPixel ) { @@ -1060,8 +1060,8 @@ const OGLFormat* OGLTransitionerImpl::chooseFormats() const uno::Sequence<sal_Int8> aComponentTags( xIntColorSpace->getComponentTags()); const int nComponentOrderIndex(calcComponentOrderIndex(aComponentTags)); - if( aComponentTags.getLength() == 3 && - nComponentOrderIndex != -1 && + if( aComponentTags.getLength() == 3 && + nComponentOrderIndex != -1 && xIntColorSpace->getBitsPerPixel() == 24 ) { pDetectedFormat = &lcl_RGB24[nComponentOrderIndex]; @@ -1140,12 +1140,12 @@ void SAL_CALL OGLTransitionerImpl::update( double nTime ) throw (uno::RuntimeExc glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); if(pTransition) - pTransition->display( nTime, GLleavingSlide, GLenteringSlide, + pTransition->display( nTime, GLleavingSlide, GLenteringSlide, SlideSize.Width, SlideSize.Height, static_cast<double>(GLWin.Width), static_cast<double>(GLWin.Height) ); -#if defined( WNT ) +#if defined( WNT ) SwapBuffers(GLWin.hDC); #elif defined( UNX ) unx::glXSwapBuffers(GLWin.dpy, GLWin.win); @@ -1187,8 +1187,8 @@ void OGLTransitionerImpl::disposeContextAndWindow() #if defined( WNT ) if (GLWin.hRC) { - wglMakeCurrent( GLWin.hDC, 0 ); // kill Device Context - wglDeleteContext( GLWin.hRC ); // Kill Render Context + wglMakeCurrent( GLWin.hDC, 0 ); // kill Device Context + wglDeleteContext( GLWin.hRC ); // Kill Render Context ReleaseDC( GLWin.hWnd, GLWin.hDC ); // Release Window } #elif defined( UNX ) @@ -1304,12 +1304,12 @@ void OGLTransitionerImpl::disposing() mxView.clear(); } -OGLTransitionerImpl::OGLTransitionerImpl(OGLTransitionImpl* pOGLTransition) : - OGLTransitionerImplBase(m_aMutex), +OGLTransitionerImpl::OGLTransitionerImpl(OGLTransitionImpl* pOGLTransition) : + OGLTransitionerImplBase(m_aMutex), GLWin(), - GLleavingSlide( 0 ), - GLenteringSlide( 0 ), - pWindow( NULL ), + GLleavingSlide( 0 ), + GLenteringSlide( 0 ), + pWindow( NULL ), mxView(), mxLeavingBitmap(), mxEnteringBitmap(), @@ -1358,7 +1358,7 @@ public: case animations::TransitionSubType::CORNERSOUT: case animations::TransitionSubType::CIRCLE: case animations::TransitionSubType::FANOUTHORIZONTAL: - case animations::TransitionSubType::CORNERSIN: + case animations::TransitionSubType::CORNERSIN: case animations::TransitionSubType::LEFTTORIGHT: case animations::TransitionSubType::TOPTOBOTTOM: case animations::TransitionSubType::TOPRIGHT: @@ -1385,11 +1385,11 @@ public: return sal_False; } - virtual uno::Reference< presentation::XTransition > SAL_CALL createTransition( - ::sal_Int16 transitionType, - ::sal_Int16 transitionSubType, - const uno::Reference< presentation::XSlideShowView >& view, - const uno::Reference< rendering::XBitmap >& leavingBitmap, + virtual uno::Reference< presentation::XTransition > SAL_CALL createTransition( + ::sal_Int16 transitionType, + ::sal_Int16 transitionSubType, + const uno::Reference< presentation::XSlideShowView >& view, + const uno::Reference< rendering::XBitmap >& leavingBitmap, const uno::Reference< rendering::XBitmap >& enteringBitmap ) throw (uno::RuntimeException) { @@ -1403,7 +1403,7 @@ public: ( transitionType == animations::TransitionType::FADE && transitionSubType == animations::TransitionSubType::FADEOVERCOLOR ) || ( transitionType == animations::TransitionType::IRISWIPE && transitionSubType == animations::TransitionSubType::DIAMOND ) ) ) return uno::Reference< presentation::XTransition >(); - + OGLTransitionImpl* pTransition = NULL; @@ -1413,17 +1413,17 @@ public: { case animations::TransitionSubType::ACROSS: pTransition->makeNByMTileFlip(8,6); - break; + break; case animations::TransitionSubType::CORNERSOUT: pTransition->makeOutsideCubeFaceToLeft(); - break; + break; case animations::TransitionSubType::CIRCLE: pTransition->makeRevolvingCircles(8,128); break; case animations::TransitionSubType::FANOUTHORIZONTAL: pTransition->makeHelix(20); break; - case animations::TransitionSubType::CORNERSIN: + case animations::TransitionSubType::CORNERSIN: pTransition->makeInsideCubeFaceToLeft(); break; case animations::TransitionSubType::LEFTTORIGHT: |