1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * Copyright 2008 by Sun Microsystems, Inc.
8 * OpenOffice.org - a multi-platform office productivity suite
10 * This file is part of OpenOffice.org.
12 * OpenOffice.org is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License version 3
14 * only, as published by the Free Software Foundation.
16 * OpenOffice.org is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License version 3 for more details
20 * (a copy is included in the LICENSE file that accompanied this code).
22 * You should have received a copy of the GNU Lesser General Public License
23 * version 3 along with OpenOffice.org. If not, see
24 * <http://www.openoffice.org/license.html>
25 * for a copy of the LGPLv3 License.
27 ************************************************************************/
29 #include <sal/types.h>
33 #include <com/sun/star/beans/XFastPropertySet.hpp>
34 #include <com/sun/star/rendering/IntegerBitmapLayout.hpp>
35 #include <com/sun/star/rendering/ColorComponentTag.hpp>
36 #include <com/sun/star/rendering/ColorSpaceType.hpp>
37 #include <com/sun/star/rendering/RenderingIntent.hpp>
38 #include <com/sun/star/util/Endianness.hpp>
39 #include <com/sun/star/animations/TransitionType.hpp>
42 #include <com/sun/star/animations/TransitionSubType.hpp>
43 #include <com/sun/star/presentation/XTransitionFactory.hpp>
44 #include <com/sun/star/presentation/XTransition.hpp>
45 #include <com/sun/star/presentation/XSlideShowView.hpp>
46 #include <com/sun/star/uno/XComponentContext.hpp>
47 #include <com/sun/star/rendering/XIntegerBitmap.hpp>
48 #include <com/sun/star/geometry/IntegerSize2D.hpp>
49 #include <com/sun/star/lang/XServiceInfo.hpp>
51 #include <cppuhelper/compbase.hxx>
52 #include <cppuhelper/basemutex.hxx>
53 #include <cppuhelper/supportsservice.hxx>
54 #include <rtl/ref.hxx>
55 #include <sal/log.hxx>
57 #include <canvas/canvastools.hxx>
59 #include <comphelper/diagnose_ex.hxx>
62 #include <vcl/canvastools.hxx>
63 #include <vcl/opengl/OpenGLContext.hxx>
64 #include <vcl/opengl/OpenGLHelper.hxx>
65 #include <vcl/syschild.hxx>
66 #include <vcl/window.hxx>
68 #include "TransitionImpl.hxx"
70 #if OSL_DEBUG_LEVEL > 0
74 using namespace ::com::sun::star
;
75 using ::com::sun::star::beans::XFastPropertySet
;
76 using ::com::sun::star::uno::Any
;
77 using ::com::sun::star::uno::Reference
;
78 using ::com::sun::star::uno::Sequence
;
79 using ::com::sun::star::uno::UNO_QUERY
;
80 using ::com::sun::star::uno::UNO_QUERY_THROW
;
85 typedef cppu::WeakComponentImplHelper
<presentation::XTransition
> OGLTransitionerImplBase
;
87 #if OSL_DEBUG_LEVEL > 0
91 explicit TimerContext(OUString aWhat
)
92 : m_aWhat(std::move(aWhat
))
93 , m_StartTime(std::chrono::steady_clock::now())
98 auto const aDuration(std::chrono::steady_clock::now() - m_StartTime
);
99 SAL_INFO("slideshow.opengl", m_aWhat
<< " took: " << std::chrono::duration_cast
<std::chrono::microseconds
>(aDuration
).count());
102 OUString
const m_aWhat
;
103 std::chrono::steady_clock::time_point
const m_StartTime
;
109 GLint nInternalFormat
;
114 /* channel ordering: (0:rgba, 1:bgra, 2:argb, 3:abgr)
116 int calcComponentOrderIndex(const uno::Sequence
<sal_Int8
>& rTags
)
118 using namespace rendering::ColorComponentTag
;
120 static const sal_Int8 aOrderTable
[] =
122 RGB_RED
, RGB_GREEN
, RGB_BLUE
, ALPHA
,
123 RGB_BLUE
, RGB_GREEN
, RGB_RED
, ALPHA
,
124 ALPHA
, RGB_RED
, RGB_GREEN
, RGB_BLUE
,
125 ALPHA
, RGB_BLUE
, RGB_GREEN
, RGB_RED
,
128 const sal_Int32
nNumComps(rTags
.getLength());
129 const sal_Int8
* pLine
=aOrderTable
;
130 for(int i
=0; i
<4; ++i
)
133 while( j
<4 && j
<nNumComps
&& pLine
[j
] == rTags
[j
] )
136 // all of the line passed, this is a match!
146 /** This is the Transitioner class for OpenGL 3D transitions in
147 * slideshow. This class is implicitly
148 * constructed from XTransitionFactory.
150 class OGLTransitionerImpl
: private cppu::BaseMutex
, public OGLTransitionerImplBase
153 OGLTransitionerImpl();
154 OGLTransitionerImpl(const OGLTransitionerImpl
&) = delete;
155 OGLTransitionerImpl
& operator=(const OGLTransitionerImpl
&) = delete;
156 bool setTransition( const std::shared_ptr
<OGLTransitionImpl
>& pOGLTransition
);
157 bool initialize( const Reference
< presentation::XSlideShowView
>& xView
,
158 const Reference
< rendering::XBitmap
>& xLeavingSlide
,
159 const Reference
< rendering::XBitmap
>& xEnteringSlide
);
162 virtual void SAL_CALL
update( double nTime
) override
;
163 virtual void SAL_CALL
viewChanged( const Reference
< presentation::XSlideShowView
>& rView
,
164 const Reference
< rendering::XBitmap
>& rLeavingBitmap
,
165 const Reference
< rendering::XBitmap
>& rEnteringBitmap
) override
;
168 void disposeTextures();
170 // WeakComponentImplHelperBase
171 virtual void SAL_CALL
disposing() override
;
173 bool isDisposed() const
175 return (rBHelper
.bDisposed
|| rBHelper
.bInDispose
);
178 void createTexture( GLuint
* texID
,
180 const uno::Sequence
<sal_Int8
>& data
,
181 const OGLFormat
* pFormat
);
182 const OGLFormat
* chooseFormats();
185 void impl_initializeFlags( bool const bGLXPresent
);
189 void setSlides( const Reference
< rendering::XBitmap
>& xLeavingSlide
, const uno::Reference
< rendering::XBitmap
>& xEnteringSlide
);
190 void impl_prepareSlides();
192 void impl_createTexture( bool useMipmap
, const uno::Sequence
<sal_Int8
>& data
, const OGLFormat
* pFormat
);
194 bool initWindowFromSlideShowView( const uno::Reference
< presentation::XSlideShowView
>& xView
);
195 /** After the window has been created, and the slides have been set, we'll initialize the slides with OpenGL.
199 bool impl_prepareTransition();
202 rtl::Reference
<OpenGLContext
> mpContext
;
204 /** OpenGL handle to the leaving slide's texture
206 GLuint maLeavingSlideGL
;
207 /** OpenGL handle to the entering slide's texture
209 GLuint maEnteringSlideGL
;
211 Reference
< presentation::XSlideShowView
> mxView
;
212 Reference
< rendering::XIntegerBitmap
> mxLeavingBitmap
;
213 Reference
< rendering::XIntegerBitmap
> mxEnteringBitmap
;
215 /** raw bytes of the entering bitmap
217 uno::Sequence
<sal_Int8
> maEnteringBytes
;
219 /** raw bytes of the leaving bitmap
221 uno::Sequence
<sal_Int8
> maLeavingBytes
;
225 /** the form the raw bytes are in for the bitmaps
227 rendering::IntegerBitmapLayout maSlideBitmapLayout
;
229 /** the size of the slides
231 geometry::IntegerSize2D maSlideSize
;
233 /** Our Transition to be used.
235 std::shared_ptr
<OGLTransitionImpl
> mpTransition
;
238 /** whether we are running on ATI fglrx with bug related to textures
240 bool mbBrokenTexturesATI
;
247 Whether the display has GLX extension on X11, always true otherwise (?)
249 bool mbValidOpenGLContext
;
251 #if OSL_DEBUG_LEVEL > 0
252 std::chrono::steady_clock::time_point m_UpdateStartTime
;
253 std::chrono::steady_clock::time_point m_UpdateEndTime
;
254 std::chrono::steady_clock::time_point m_StartTime
;
255 std::chrono::steady_clock::time_point m_EndTime
;
256 std::chrono::steady_clock::duration m_TotalUpdateDuration
;
261 bool OGLTransitionerImpl::initialize( const Reference
< presentation::XSlideShowView
>& xView
,
262 const Reference
< rendering::XBitmap
>& xLeavingSlide
,
263 const Reference
< rendering::XBitmap
>& xEnteringSlide
)
265 bool const bValidContext( initWindowFromSlideShowView( xView
) );
266 impl_initializeFlags( bValidContext
);
268 setSlides( xLeavingSlide
, xEnteringSlide
);
270 return mbValidOpenGLContext
;
273 void OGLTransitionerImpl::impl_initializeFlags( bool const bValidContext
)
275 mbValidOpenGLContext
= bValidContext
;
276 if ( bValidContext
) {
279 mnGLVersion
= OpenGLHelper::getGLVersion();
280 SAL_INFO("slideshow.opengl", "GL version: " << mnGLVersion
<< "" );
282 #if defined( UNX ) && !defined( MACOSX )
283 const GLubyte
* vendor
= glGetString( GL_VENDOR
);
284 /* TODO: check for version once the bug in fglrx driver is fixed */
285 mbBrokenTexturesATI
= (vendor
&& strcmp( reinterpret_cast<const char *>(vendor
), "ATI Technologies Inc." ) == 0 );
292 bool OGLTransitionerImpl::initWindowFromSlideShowView( const Reference
< presentation::XSlideShowView
>& xView
)
294 osl::MutexGuard
const guard( m_aMutex
);
303 #if OSL_DEBUG_LEVEL > 0
304 TimerContext
aTimerContext("initWindowFromSlideShowView");
307 /// take the XSlideShowView and extract the parent window from it. see viewmediashape.cxx
308 uno::Reference
< rendering::XCanvas
> xCanvas(mxView
->getCanvas(), uno::UNO_QUERY_THROW
);
309 uno::Sequence
< uno::Any
> aDeviceParams
;
310 ::canvas::tools::getDeviceInfo( xCanvas
, aDeviceParams
);
313 aDeviceParams
[ 0 ] >>= aImplName
;
316 aDeviceParams
[1] >>= aVal
;
318 mpContext
= OpenGLContext::Create();
320 OutputDevice
* pDevice
= reinterpret_cast<OutputDevice
*>(aVal
);
321 vcl::Window
* pWindow
= pDevice
? pDevice
->GetOwnerWindow() : nullptr;
323 if( !mpContext
->init( pWindow
) ) {
324 mpContext
->requestLegacyContext();
325 if( !mpContext
->init( pWindow
) )
328 SAL_INFO("slideshow.opengl", "created the context");
330 mpContext
->makeCurrent();
333 awt::Rectangle aCanvasArea
= mxView
->getCanvasArea();
334 mpContext
->setWinPosAndSize(Point(aCanvasArea
.X
, aCanvasArea
.Y
), Size(aCanvasArea
.Width
, aCanvasArea
.Height
));
335 SAL_INFO("slideshow.opengl", "canvas area: " << aCanvasArea
.X
<< "," << aCanvasArea
.Y
<< " - " << aCanvasArea
.Width
<< "x" << aCanvasArea
.Height
);
338 glEnable(GL_CULL_FACE
);
342 glClearColor (0, 0, 0, 0);
344 glClear(GL_COLOR_BUFFER_BIT
);
347 mpContext
->swapBuffers();
354 void OGLTransitionerImpl::setSlides( const uno::Reference
< rendering::XBitmap
>& xLeavingSlide
,
355 const uno::Reference
< rendering::XBitmap
>& xEnteringSlide
)
357 osl::MutexGuard
const guard( m_aMutex
);
362 mxLeavingBitmap
.set( xLeavingSlide
, UNO_QUERY_THROW
);
363 mxEnteringBitmap
.set( xEnteringSlide
, UNO_QUERY_THROW
);
365 maSlideSize
= mxLeavingBitmap
->getSize();
366 SAL_INFO("slideshow.opengl", "leaving bitmap area: " << maSlideSize
.Width
<< "x" << maSlideSize
.Height
);
367 maSlideSize
= mxEnteringBitmap
->getSize();
368 SAL_INFO("slideshow.opengl", "entering bitmap area: " << maSlideSize
.Width
<< "x" << maSlideSize
.Height
);
370 //to avoid annoying flashing under X entering and leaving slides with opengl effects set the leaving
371 //bitmap as the background pixmap of the opengl child window and the entering bitmap as the background
372 //pixmap of the non-opengl parent window. If any expose events occur around the start and end of
373 //the transition then those windows are default filled by X with the desired start/end image so there's
375 SystemChildWindow
* pChildWindow
= mpContext
->getChildWindow();
379 css::uno::Reference
<css::beans::XFastPropertySet
> xEnteringFastPropertySet(mxEnteringBitmap
, css::uno::UNO_QUERY
);
380 css::uno::Reference
<css::beans::XFastPropertySet
> xLeavingFastPropertySet(mxLeavingBitmap
, css::uno::UNO_QUERY
);
381 css::uno::Sequence
<css::uno::Any
> aEnteringBitmap
;
382 css::uno::Sequence
<css::uno::Any
> aLeavingBitmap
;
383 if (xEnteringFastPropertySet
&& xLeavingFastPropertySet
)
385 xEnteringFastPropertySet
->getFastPropertyValue(1) >>= aEnteringBitmap
;
386 xLeavingFastPropertySet
->getFastPropertyValue(1) >>= aLeavingBitmap
;
388 if (aEnteringBitmap
.getLength() == 2 && aLeavingBitmap
.getLength() == 2)
389 pChildWindow
->SetLeaveEnterBackgrounds(aLeavingBitmap
, aEnteringBitmap
);
393 void OGLTransitionerImpl::impl_prepareSlides()
395 geometry::IntegerRectangle2D aSlideRect
;
397 aSlideRect
.X2
= maSlideSize
.Width
;
399 aSlideRect
.Y2
= maSlideSize
.Height
;
405 maLeavingBytes
= mxLeavingBitmap
->getData(maSlideBitmapLayout
, aSlideRect
);
406 maEnteringBytes
= mxEnteringBitmap
->getData(maSlideBitmapLayout
, aSlideRect
);
411 SAL_WARN_IF(maSlideBitmapLayout
.PlaneStride
!= 0, "slideshow.opengl","only handle no plane stride now");
417 // synchronized X still gives us much smoother play
418 // I suspect some issues in above code in slideshow
419 // synchronize whole transition for now
420 const GLWindow
& rGLWindow(mpContext
->getOpenGLWindow());
421 mbRestoreSync
= rGLWindow
.Synchronize(true);
424 bool OGLTransitionerImpl::impl_prepareTransition()
426 if( mpTransition
&& mpTransition
->getSettings().mnRequiredGLVersion
<= mnGLVersion
)
427 return mpTransition
->prepare( maLeavingSlideGL
, maEnteringSlideGL
, mpContext
.get() );
431 bool OGLTransitionerImpl::setTransition( const std::shared_ptr
<OGLTransitionImpl
>& pTransition
)
433 if ( mpTransition
) // already initialized
436 mpTransition
= pTransition
;
438 mpContext
->makeCurrent();
441 bool succeeded
= impl_prepareTransition();
443 mpTransition
= nullptr;
447 impl_prepareSlides();
449 // tdf#91456: When the OpenGL context is initialized but nothing has been rendered on it
450 // it can happen, that an "empty" screen is drawn. Therefore, drawing the content of time 0
457 void OGLTransitionerImpl::createTexture( GLuint
* texID
,
459 const uno::Sequence
<sal_Int8
>& data
,
460 const OGLFormat
* pFormat
)
463 glDeleteTextures( 1, texID
);
464 glGenTextures( 1, texID
);
465 glBindTexture( GL_TEXTURE_2D
, *texID
);
466 glTexParameteri( GL_TEXTURE_2D
, GL_TEXTURE_WRAP_S
, GL_CLAMP_TO_BORDER
);
467 glTexParameteri( GL_TEXTURE_2D
, GL_TEXTURE_WRAP_T
, GL_CLAMP_TO_BORDER
);
470 impl_createTexture( useMipmap
, data
, pFormat
);
472 SAL_WARN_IF(!glIsTexture(*texID
), "slideshow.opengl", "Can't generate Leaving slide textures in OpenGL");
476 class OGLColorSpace
: public cppu::WeakImplHelper
< css::rendering::XIntegerBitmapColorSpace
>
479 uno::Sequence
< sal_Int8
> maComponentTags
;
480 uno::Sequence
< sal_Int32
> maBitCounts
;
482 virtual sal_Int8 SAL_CALL
getType( ) override
484 return rendering::ColorSpaceType::RGB
;
486 virtual uno::Sequence
< sal_Int8
> SAL_CALL
getComponentTags( ) override
488 return maComponentTags
;
490 virtual sal_Int8 SAL_CALL
getRenderingIntent( ) override
492 return rendering::RenderingIntent::PERCEPTUAL
;
494 virtual uno::Sequence
< beans::PropertyValue
> SAL_CALL
getProperties( ) override
496 return uno::Sequence
< beans::PropertyValue
>();
498 virtual uno::Sequence
< double > SAL_CALL
convertColorSpace( const uno::Sequence
< double >& deviceColor
,
499 const uno::Reference
< rendering::XColorSpace
>& targetColorSpace
) override
501 // TODO(P3): if we know anything about target
502 // colorspace, this can be greatly sped up
503 uno::Sequence
<rendering::ARGBColor
> aIntermediate(
504 convertToARGB(deviceColor
));
505 return targetColorSpace
->convertFromARGB(aIntermediate
);
507 virtual uno::Sequence
< rendering::RGBColor
> SAL_CALL
convertToRGB( const uno::Sequence
< double >& deviceColor
) override
509 const double* pIn( deviceColor
.getConstArray() );
510 const std::size_t nLen( deviceColor
.getLength() );
511 ENSURE_ARG_OR_THROW2(nLen
%4==0,
512 "number of channels no multiple of 4",
513 static_cast<rendering::XColorSpace
*>(this), 0);
515 uno::Sequence
< rendering::RGBColor
> aRes(nLen
/4);
516 rendering::RGBColor
* pOut( aRes
.getArray() );
517 for( std::size_t i
=0; i
<nLen
; i
+=4 )
519 *pOut
++ = rendering::RGBColor(pIn
[0],pIn
[1],pIn
[2]);
524 virtual uno::Sequence
< rendering::ARGBColor
> SAL_CALL
convertToARGB( const uno::Sequence
< double >& deviceColor
) override
526 const double* pIn( deviceColor
.getConstArray() );
527 const std::size_t nLen( deviceColor
.getLength() );
528 ENSURE_ARG_OR_THROW2(nLen
%4==0,
529 "number of channels no multiple of 4",
530 static_cast<rendering::XColorSpace
*>(this), 0);
532 uno::Sequence
< rendering::ARGBColor
> aRes(nLen
/4);
533 rendering::ARGBColor
* pOut( aRes
.getArray() );
534 for( std::size_t i
=0; i
<nLen
; i
+=4 )
536 *pOut
++ = rendering::ARGBColor(pIn
[3],pIn
[0],pIn
[1],pIn
[2]);
541 virtual uno::Sequence
< rendering::ARGBColor
> SAL_CALL
convertToPARGB( const uno::Sequence
< double >& deviceColor
) override
543 const double* pIn( deviceColor
.getConstArray() );
544 const std::size_t nLen( deviceColor
.getLength() );
545 ENSURE_ARG_OR_THROW2(nLen
%4==0,
546 "number of channels no multiple of 4",
547 static_cast<rendering::XColorSpace
*>(this), 0);
549 uno::Sequence
< rendering::ARGBColor
> aRes(nLen
/4);
550 rendering::ARGBColor
* pOut( aRes
.getArray() );
551 for( std::size_t i
=0; i
<nLen
; i
+=4 )
553 *pOut
++ = rendering::ARGBColor(pIn
[3],pIn
[3]*pIn
[0],pIn
[3]*pIn
[1],pIn
[3]*pIn
[2]);
558 virtual uno::Sequence
< double > SAL_CALL
convertFromRGB( const uno::Sequence
< rendering::RGBColor
>& rgbColor
) override
560 const sal_Int32
nLen( rgbColor
.getLength() );
562 uno::Sequence
< double > aRes(nLen
*4);
563 double* pColors
=aRes
.getArray();
564 for( const rendering::RGBColor
& rIn
: rgbColor
)
566 *pColors
++ = rIn
.Red
;
567 *pColors
++ = rIn
.Green
;
568 *pColors
++ = rIn
.Blue
;
573 virtual uno::Sequence
< double > SAL_CALL
convertFromARGB( const uno::Sequence
< rendering::ARGBColor
>& rgbColor
) override
575 const sal_Int32
nLen( rgbColor
.getLength() );
577 uno::Sequence
< double > aRes(nLen
*4);
578 double* pColors
=aRes
.getArray();
579 for( const rendering::ARGBColor
& rIn
: rgbColor
)
581 *pColors
++ = rIn
.Red
;
582 *pColors
++ = rIn
.Green
;
583 *pColors
++ = rIn
.Blue
;
584 *pColors
++ = rIn
.Alpha
;
588 virtual uno::Sequence
< double > SAL_CALL
convertFromPARGB( const uno::Sequence
< rendering::ARGBColor
>& rgbColor
) override
590 const sal_Int32
nLen( rgbColor
.getLength() );
592 uno::Sequence
< double > aRes(nLen
*4);
593 double* pColors
=aRes
.getArray();
594 for( const rendering::ARGBColor
& rIn
: rgbColor
)
596 *pColors
++ = rIn
.Red
/rIn
.Alpha
;
597 *pColors
++ = rIn
.Green
/rIn
.Alpha
;
598 *pColors
++ = rIn
.Blue
/rIn
.Alpha
;
599 *pColors
++ = rIn
.Alpha
;
604 // XIntegerBitmapColorSpace
605 virtual sal_Int32 SAL_CALL
getBitsPerPixel( ) override
609 virtual uno::Sequence
< sal_Int32
> SAL_CALL
getComponentBitCounts( ) override
613 virtual sal_Int8 SAL_CALL
getEndianness( ) override
615 return util::Endianness::LITTLE
;
617 virtual uno::Sequence
<double> SAL_CALL
convertFromIntegerColorSpace( const uno::Sequence
< sal_Int8
>& deviceColor
,
618 const uno::Reference
< rendering::XColorSpace
>& targetColorSpace
) override
620 if( dynamic_cast<OGLColorSpace
*>(targetColorSpace
.get()) )
622 const sal_Int32
nLen( deviceColor
.getLength() );
623 ENSURE_ARG_OR_THROW2(nLen
%4==0,
624 "number of channels no multiple of 4",
625 static_cast<rendering::XColorSpace
*>(this), 0);
627 uno::Sequence
<double> aRes(nLen
);
628 std::transform(deviceColor
.begin(), deviceColor
.end(), aRes
.getArray(),
629 vcl::unotools::toDoubleColor
);
634 // TODO(P3): if we know anything about target
635 // colorspace, this can be greatly sped up
636 uno::Sequence
<rendering::ARGBColor
> aIntermediate(
637 convertIntegerToARGB(deviceColor
));
638 return targetColorSpace
->convertFromARGB(aIntermediate
);
641 virtual uno::Sequence
< sal_Int8
> SAL_CALL
convertToIntegerColorSpace( const uno::Sequence
< sal_Int8
>& deviceColor
,
642 const uno::Reference
< rendering::XIntegerBitmapColorSpace
>& targetColorSpace
) override
644 if( dynamic_cast<OGLColorSpace
*>(targetColorSpace
.get()) )
646 // it's us, so simply pass-through the data
651 // TODO(P3): if we know anything about target
652 // colorspace, this can be greatly sped up
653 uno::Sequence
<rendering::ARGBColor
> aIntermediate(
654 convertIntegerToARGB(deviceColor
));
655 return targetColorSpace
->convertIntegerFromARGB(aIntermediate
);
658 virtual uno::Sequence
< rendering::RGBColor
> SAL_CALL
convertIntegerToRGB( const uno::Sequence
< sal_Int8
>& deviceColor
) override
660 const sal_Int8
* pIn( deviceColor
.getConstArray() );
661 const std::size_t nLen( deviceColor
.getLength() );
662 ENSURE_ARG_OR_THROW2(nLen
%4==0,
663 "number of channels no multiple of 4",
664 static_cast<rendering::XColorSpace
*>(this), 0);
666 uno::Sequence
< rendering::RGBColor
> aRes(nLen
/4);
667 rendering::RGBColor
* pOut( aRes
.getArray() );
668 for( std::size_t i
=0; i
<nLen
; i
+=4 )
670 *pOut
++ = rendering::RGBColor(
671 vcl::unotools::toDoubleColor(pIn
[0]),
672 vcl::unotools::toDoubleColor(pIn
[1]),
673 vcl::unotools::toDoubleColor(pIn
[2]));
679 virtual uno::Sequence
< rendering::ARGBColor
> SAL_CALL
convertIntegerToARGB( const uno::Sequence
< sal_Int8
>& deviceColor
) override
681 const sal_Int8
* pIn( deviceColor
.getConstArray() );
682 const std::size_t nLen( deviceColor
.getLength() );
683 ENSURE_ARG_OR_THROW2(nLen
%4==0,
684 "number of channels no multiple of 4",
685 static_cast<rendering::XColorSpace
*>(this), 0);
687 uno::Sequence
< rendering::ARGBColor
> aRes(nLen
/4);
688 rendering::ARGBColor
* pOut( aRes
.getArray() );
689 for( std::size_t i
=0; i
<nLen
; i
+=4 )
691 *pOut
++ = rendering::ARGBColor(
692 vcl::unotools::toDoubleColor(pIn
[3]),
693 vcl::unotools::toDoubleColor(pIn
[0]),
694 vcl::unotools::toDoubleColor(pIn
[1]),
695 vcl::unotools::toDoubleColor(pIn
[2]));
701 virtual uno::Sequence
< rendering::ARGBColor
> SAL_CALL
convertIntegerToPARGB( const uno::Sequence
< sal_Int8
>& deviceColor
) override
703 const sal_Int8
* pIn( deviceColor
.getConstArray() );
704 const std::size_t nLen( deviceColor
.getLength() );
705 ENSURE_ARG_OR_THROW2(nLen
%4==0,
706 "number of channels no multiple of 4",
707 static_cast<rendering::XColorSpace
*>(this), 0);
709 uno::Sequence
< rendering::ARGBColor
> aRes(nLen
/4);
710 rendering::ARGBColor
* pOut( aRes
.getArray() );
711 for( std::size_t i
=0; i
<nLen
; i
+=4 )
713 const sal_Int8
nAlpha( pIn
[3] );
714 *pOut
++ = rendering::ARGBColor(
715 vcl::unotools::toDoubleColor(nAlpha
),
716 vcl::unotools::toDoubleColor(nAlpha
*pIn
[0]),
717 vcl::unotools::toDoubleColor(nAlpha
*pIn
[1]),
718 vcl::unotools::toDoubleColor(nAlpha
*pIn
[2]));
724 virtual uno::Sequence
< sal_Int8
> SAL_CALL
convertIntegerFromRGB( const uno::Sequence
< rendering::RGBColor
>& rgbColor
) override
726 const sal_Int32
nLen( rgbColor
.getLength() );
728 uno::Sequence
< sal_Int8
> aRes(nLen
*4);
729 sal_Int8
* pColors
=aRes
.getArray();
730 for( const rendering::RGBColor
& rIn
: rgbColor
)
732 *pColors
++ = vcl::unotools::toByteColor(rIn
.Red
);
733 *pColors
++ = vcl::unotools::toByteColor(rIn
.Green
);
734 *pColors
++ = vcl::unotools::toByteColor(rIn
.Blue
);
740 virtual uno::Sequence
< sal_Int8
> SAL_CALL
convertIntegerFromARGB( const uno::Sequence
< rendering::ARGBColor
>& rgbColor
) override
742 const sal_Int32
nLen( rgbColor
.getLength() );
744 uno::Sequence
< sal_Int8
> aRes(nLen
*4);
745 sal_Int8
* pColors
=aRes
.getArray();
746 for( const rendering::ARGBColor
& rIn
: rgbColor
)
748 *pColors
++ = vcl::unotools::toByteColor(rIn
.Red
);
749 *pColors
++ = vcl::unotools::toByteColor(rIn
.Green
);
750 *pColors
++ = vcl::unotools::toByteColor(rIn
.Blue
);
751 *pColors
++ = vcl::unotools::toByteColor(rIn
.Alpha
);
756 virtual uno::Sequence
< sal_Int8
> SAL_CALL
convertIntegerFromPARGB( const uno::Sequence
< rendering::ARGBColor
>& rgbColor
) override
758 const sal_Int32
nLen( rgbColor
.getLength() );
760 uno::Sequence
< sal_Int8
> aRes(nLen
*4);
761 sal_Int8
* pColors
=aRes
.getArray();
762 for( const rendering::ARGBColor
& rIn
: rgbColor
)
764 *pColors
++ = vcl::unotools::toByteColor(rIn
.Red
/rIn
.Alpha
);
765 *pColors
++ = vcl::unotools::toByteColor(rIn
.Green
/rIn
.Alpha
);
766 *pColors
++ = vcl::unotools::toByteColor(rIn
.Blue
/rIn
.Alpha
);
767 *pColors
++ = vcl::unotools::toByteColor(rIn
.Alpha
);
777 sal_Int8
* pTags
= maComponentTags
.getArray();
778 sal_Int32
* pBitCounts
= maBitCounts
.getArray();
779 pTags
[0] = rendering::ColorComponentTag::RGB_RED
;
780 pTags
[1] = rendering::ColorComponentTag::RGB_GREEN
;
781 pTags
[2] = rendering::ColorComponentTag::RGB_BLUE
;
782 pTags
[3] = rendering::ColorComponentTag::ALPHA
;
791 uno::Reference
<rendering::XIntegerBitmapColorSpace
> const &
794 static uno::Reference
<rendering::XIntegerBitmapColorSpace
> theSpace
= new OGLColorSpace();
799 GLint internalFormat
, GLsizei width
, GLsizei height
, GLenum format
,
800 GLenum type
, const void * data
)
802 if (epoxy_has_gl_extension("GL_ARB_framebuffer_object")) {
804 GL_TEXTURE_2D
, 0, internalFormat
, width
, height
, 0, format
, type
,
806 glGenerateMipmap(GL_TEXTURE_2D
);
808 glTexParameteri(GL_TEXTURE_2D
, GL_GENERATE_MIPMAP
, GL_TRUE
);
810 GL_TEXTURE_2D
, 0, internalFormat
, width
, height
, 0, format
, type
,
812 glTexParameteri(GL_TEXTURE_2D
, GL_GENERATE_MIPMAP
, GL_FALSE
);
814 glTexParameteri(GL_TEXTURE_2D
, GL_TEXTURE_MAG_FILTER
, GL_LINEAR
);
816 GL_TEXTURE_2D
, GL_TEXTURE_MIN_FILTER
, GL_LINEAR_MIPMAP_LINEAR
);
819 void OGLTransitionerImpl::impl_createTexture(
821 const uno::Sequence
<sal_Int8
>& data
,
822 const OGLFormat
* pFormat
)
827 // force-convert color to ARGB8888 int color space
828 uno::Sequence
<sal_Int8
> tempBytes(
829 maSlideBitmapLayout
.ColorSpace
->convertToIntegerColorSpace(
831 getOGLColorSpace()));
832 buildMipmaps( GL_RGBA
,
839 if (epoxy_has_gl_extension("GL_EXT_texture_filter_anisotropic"))
841 //anistropic filtering (to make texturing not suck when looking at polygons from oblique angles)
842 GLfloat largest_supported_anisotropy
;
843 glGetFloatv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT
, &largest_supported_anisotropy
);
844 glTexParameterf(GL_TEXTURE_2D
, GL_TEXTURE_MAX_ANISOTROPY_EXT
, largest_supported_anisotropy
);
847 if( mpTransition
&& !mbBrokenTexturesATI
&& !useMipmap
) {
848 glTexImage2D( GL_TEXTURE_2D
, 0, pFormat
->nInternalFormat
, maSlideSize
.Width
, maSlideSize
.Height
, 0, pFormat
->eFormat
, pFormat
->eType
, &data
[0] );
849 glTexParameteri(GL_TEXTURE_2D
,GL_TEXTURE_MAG_FILTER
,GL_NEAREST
);
850 glTexParameteri(GL_TEXTURE_2D
,GL_TEXTURE_MIN_FILTER
,GL_NEAREST
);
852 buildMipmaps( pFormat
->nInternalFormat
, maSlideSize
.Width
, maSlideSize
.Height
, pFormat
->eFormat
, pFormat
->eType
, &data
[0] );
854 if (epoxy_has_gl_extension("GL_EXT_texture_filter_anisotropic"))
856 //anistropic filtering (to make texturing not suck when looking at polygons from oblique angles)
857 GLfloat largest_supported_anisotropy
;
858 glGetFloatv( GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT
, &largest_supported_anisotropy
);
859 glTexParameterf( GL_TEXTURE_2D
, GL_TEXTURE_MAX_ANISOTROPY_EXT
, largest_supported_anisotropy
);
866 const OGLFormat
* OGLTransitionerImpl::chooseFormats()
868 const OGLFormat
* pDetectedFormat
=nullptr;
869 uno::Reference
<rendering::XIntegerBitmapColorSpace
> xIntColorSpace(
870 maSlideBitmapLayout
.ColorSpace
);
872 if( xIntColorSpace
->getType() == rendering::ColorSpaceType::RGB
||
873 xIntColorSpace
->getType() == rendering::ColorSpaceType::SRGB
)
875 /* table for canvas->OGL format mapping. outer index is number
876 of color components (0:3, 1:4), then comes bits per pixel
877 (0:16, 1:24, 2:32), then channel ordering: (0:rgba, 1:bgra,
880 static const OGLFormat lcl_RGB24
[] =
883 {3, GL_BGR
, GL_UNSIGNED_BYTE
},
884 {3, GL_RGB
, GL_UNSIGNED_BYTE
},
885 {3, GL_BGR
, GL_UNSIGNED_BYTE
},
886 {3, GL_RGB
, GL_UNSIGNED_BYTE
}
889 #if defined(GL_VERSION_1_2) && defined(GLU_VERSION_1_3)
890 // more format constants available
891 static const OGLFormat lcl_RGB16
[] =
894 {3, GL_RGB
, GL_UNSIGNED_SHORT_5_6_5_REV
},
895 {3, GL_RGB
, GL_UNSIGNED_SHORT_5_6_5
},
896 {3, GL_RGB
, GL_UNSIGNED_SHORT_5_6_5_REV
},
897 {3, GL_RGB
, GL_UNSIGNED_SHORT_5_6_5
}
900 static const OGLFormat lcl_ARGB16_4
[] =
903 {4, GL_RGBA
, GL_UNSIGNED_SHORT_4_4_4_4_REV
},
904 {4, GL_BGRA
, GL_UNSIGNED_SHORT_4_4_4_4_REV
},
905 {4, GL_BGRA
, GL_UNSIGNED_SHORT_4_4_4_4
},
906 {4, GL_RGBA
, GL_UNSIGNED_SHORT_4_4_4_4
}
909 static const OGLFormat lcl_ARGB16_5
[] =
912 {4, GL_RGBA
, GL_UNSIGNED_SHORT_1_5_5_5_REV
},
913 {4, GL_BGRA
, GL_UNSIGNED_SHORT_1_5_5_5_REV
},
914 {4, GL_BGRA
, GL_UNSIGNED_SHORT_5_5_5_1
},
915 {4, GL_RGBA
, GL_UNSIGNED_SHORT_5_5_5_1
}
918 static const OGLFormat lcl_ARGB32
[] =
921 {4, GL_RGBA
, GL_UNSIGNED_INT_8_8_8_8_REV
},
922 {4, GL_BGRA
, GL_UNSIGNED_INT_8_8_8_8_REV
},
923 {4, GL_BGRA
, GL_UNSIGNED_INT_8_8_8_8
},
924 {4, GL_RGBA
, GL_UNSIGNED_INT_8_8_8_8
}
927 const uno::Sequence
<sal_Int8
> aComponentTags(
928 xIntColorSpace
->getComponentTags());
929 const uno::Sequence
<sal_Int32
> aComponentBitcounts(
930 xIntColorSpace
->getComponentBitCounts());
931 const sal_Int32
nNumComponents( aComponentBitcounts
.getLength() );
932 const sal_Int32
nBitsPerPixel( xIntColorSpace
->getBitsPerPixel() );
934 // supported component ordering?
935 const int nComponentOrderIndex(
936 calcComponentOrderIndex(aComponentTags
));
937 if( nComponentOrderIndex
!= -1 )
939 switch( nBitsPerPixel
)
942 if( nNumComponents
== 3 )
944 pDetectedFormat
= &lcl_RGB16
[nComponentOrderIndex
];
946 else if( nNumComponents
== 4 )
948 if( aComponentBitcounts
[1] == 4 )
950 pDetectedFormat
= &lcl_ARGB16_4
[nComponentOrderIndex
];
952 else if( aComponentBitcounts
[1] == 5 )
954 pDetectedFormat
= &lcl_ARGB16_5
[nComponentOrderIndex
];
959 if( nNumComponents
== 3 )
961 pDetectedFormat
= &lcl_RGB24
[nComponentOrderIndex
];
965 if ( nNumComponents
== 4 )
967 pDetectedFormat
= &lcl_ARGB32
[nComponentOrderIndex
];
973 const uno::Sequence
<sal_Int8
> aComponentTags(
974 xIntColorSpace
->getComponentTags());
975 const int nComponentOrderIndex(calcComponentOrderIndex(aComponentTags
));
976 if( aComponentTags
.getLength() == 3 &&
977 nComponentOrderIndex
!= -1 &&
978 xIntColorSpace
->getBitsPerPixel() == 24 )
980 pDetectedFormat
= &lcl_RGB24
[nComponentOrderIndex
];
985 return pDetectedFormat
;
988 void OGLTransitionerImpl::GLInitSlides()
990 osl::MutexGuard
const guard( m_aMutex
);
992 if (isDisposed() || !mpTransition
|| mpTransition
->getSettings().mnRequiredGLVersion
> mnGLVersion
)
995 #if OSL_DEBUG_LEVEL > 0
996 TimerContext
aTimerContext("texture creation");
999 mpContext
->makeCurrent();
1001 const OGLFormat
* pFormat
= chooseFormats();
1004 createTexture( &maLeavingSlideGL
,
1005 mpTransition
->getSettings().mbUseMipMapLeaving
,
1009 createTexture( &maEnteringSlideGL
,
1010 mpTransition
->getSettings().mbUseMipMapEntering
,
1019 void SAL_CALL
OGLTransitionerImpl::update( double nTime
)
1021 #if OSL_DEBUG_LEVEL > 0
1023 m_UpdateStartTime
= std::chrono::steady_clock::now();
1024 if( mnFrameCount
== 1 ) {
1025 m_StartTime
= m_UpdateStartTime
;
1026 m_TotalUpdateDuration
= std::chrono::seconds(0);
1029 osl::MutexGuard
const guard( m_aMutex
);
1031 if (isDisposed() || !mbValidOpenGLContext
|| !mpTransition
|| mpTransition
->getSettings().mnRequiredGLVersion
> mnGLVersion
)
1034 mpContext
->makeCurrent();
1037 glEnable(GL_DEPTH_TEST
);
1038 glClear(GL_COLOR_BUFFER_BIT
| GL_DEPTH_BUFFER_BIT
);
1041 const GLWindow
& rGLWindow(mpContext
->getOpenGLWindow());
1042 mpTransition
->display(nTime
, maLeavingSlideGL
, maEnteringSlideGL
,
1043 maSlideSize
.Width
, maSlideSize
.Height
,
1044 static_cast<double>(rGLWindow
.Width
),
1045 static_cast<double>(rGLWindow
.Height
),
1048 mpContext
->swapBuffers();
1054 #if OSL_DEBUG_LEVEL > 0
1055 m_UpdateEndTime
= std::chrono::steady_clock::now();
1057 SAL_INFO("slideshow.opengl", "update time: " << nTime
);
1058 SAL_INFO("slideshow.opengl", "update took: " << std::chrono::duration_cast
<std::chrono::milliseconds
>(m_UpdateEndTime
- m_UpdateStartTime
).count());
1059 m_TotalUpdateDuration
+= m_UpdateEndTime
- m_UpdateStartTime
;
1063 void SAL_CALL
OGLTransitionerImpl::viewChanged( const Reference
< presentation::XSlideShowView
>& rView
,
1064 const Reference
< rendering::XBitmap
>& rLeavingBitmap
,
1065 const Reference
< rendering::XBitmap
>& rEnteringBitmap
)
1067 SAL_INFO("slideshow.opengl", "transitioner: view changed");
1071 initWindowFromSlideShowView( rView
);
1072 setSlides( rLeavingBitmap
, rEnteringBitmap
);
1073 impl_prepareSlides();
1074 impl_prepareTransition();
1077 void OGLTransitionerImpl::disposeTextures()
1079 if (!mbValidOpenGLContext
)
1082 mpContext
->makeCurrent();
1085 glDeleteTextures(1,&maLeavingSlideGL
);
1086 maLeavingSlideGL
= 0;
1087 glDeleteTextures(1,&maEnteringSlideGL
);
1088 maEnteringSlideGL
= 0;
1093 void OGLTransitionerImpl::impl_dispose()
1095 if (mbValidOpenGLContext
)
1097 mpContext
->makeCurrent();
1101 if( mpTransition
&& mpTransition
->getSettings().mnRequiredGLVersion
<= mnGLVersion
)
1102 mpTransition
->finish();
1104 if( mpContext
.is() )
1105 mpContext
->dispose();
1109 // we are about to be disposed (someone call dispose() on us)
1110 void OGLTransitionerImpl::disposing()
1112 osl::MutexGuard
const guard( m_aMutex
);
1114 #if OSL_DEBUG_LEVEL > 0
1115 SAL_INFO("slideshow.opengl", "dispose " << this);
1116 if( mnFrameCount
) {
1117 m_EndTime
= std::chrono::steady_clock::now();
1118 auto const duration
= m_EndTime
- m_StartTime
;
1119 SAL_INFO("slideshow.opengl",
1120 "whole transition (frames: " << mnFrameCount
1121 << ") took: " << std::chrono::duration_cast
<std::chrono::microseconds
>(duration
).count()
1123 << ((static_cast<double>(mnFrameCount
)*1000000000.0)/std::chrono::duration_cast
<std::chrono::nanoseconds
>(duration
).count())
1124 << " time spent in updates: " << std::chrono::duration_cast
<std::chrono::microseconds
>(m_TotalUpdateDuration
).count()
1125 << " percentage of transition time: "
1126 << (100*((static_cast<double>(std::chrono::duration_cast
<std::chrono::nanoseconds
>(m_TotalUpdateDuration
).count()))/(static_cast<double>(std::chrono::duration_cast
<std::chrono::nanoseconds
>(duration
).count()))))
1132 if (mbRestoreSync
&& mpContext
.is()) {
1133 // try to reestablish synchronize state
1134 const char* sal_synchronize
= getenv("SAL_SYNCHRONIZE");
1135 mpContext
->getOpenGLWindow().Synchronize(sal_synchronize
&& *sal_synchronize
== '1' );
1140 mpTransition
.reset();
1142 mxLeavingBitmap
.clear();
1143 mxEnteringBitmap
.clear();
1147 OGLTransitionerImpl::OGLTransitionerImpl()
1148 : OGLTransitionerImplBase(m_aMutex
)
1150 , maLeavingSlideGL(0)
1151 , maEnteringSlideGL(0)
1155 , mbRestoreSync(false)
1156 , maSlideBitmapLayout()
1158 , mbBrokenTexturesATI(false)
1160 , mbValidOpenGLContext(false)
1161 #if OSL_DEBUG_LEVEL > 0
1167 typedef cppu::WeakComponentImplHelper
<presentation::XTransitionFactory
, lang::XServiceInfo
> OGLTransitionFactoryImplBase
;
1169 class OGLTransitionFactoryImpl
: private cppu::BaseMutex
, public OGLTransitionFactoryImplBase
1172 explicit OGLTransitionFactoryImpl() :
1173 OGLTransitionFactoryImplBase(m_aMutex
)
1177 virtual Sequence
< OUString
> SAL_CALL
getSupportedServiceNames() override
1179 return { "com.sun.star.presentation.TransitionFactory" };
1181 virtual OUString SAL_CALL
getImplementationName() override
1183 return "com.sun.star.comp.presentation.OGLTransitionFactory";
1185 virtual sal_Bool SAL_CALL
supportsService(const OUString
& aServiceName
) override
1187 return cppu::supportsService(this, aServiceName
);
1190 // XTransitionFactory
1191 virtual sal_Bool SAL_CALL
hasTransition( sal_Int16 transitionType
, sal_Int16 transitionSubType
) override
1193 if( !OpenGLHelper::supportsOpenGL())
1195 // A set of css::animation::TransitionSubType that don't have any meaning (in the SMIL 2.0
1196 // standard) for MISCSHAPEWIPE have been chosen to refer to some of these "fancy" optional
1197 // transitions. (The only subtypes of 'miscShapeWipe' defined in the standard are 'heart'
1198 // and 'keyhole'.) The set of subtypes used seems to be a bit random; it starts from the
1199 // beginning of the list (in the order (numeric) in our TransitionSubType set of constants)
1200 // but then jumps a bit randomly. The numeric values as such have no meaning, but still.
1202 if( transitionType
== animations::TransitionType::MISCSHAPEWIPE
) {
1203 switch( transitionSubType
)
1205 case animations::TransitionSubType::LEFTTORIGHT
: // 1
1206 case animations::TransitionSubType::TOPTOBOTTOM
: // 2
1207 case animations::TransitionSubType::TOPLEFT
: // 3
1208 case animations::TransitionSubType::TOPRIGHT
: // 4
1209 case animations::TransitionSubType::BOTTOMRIGHT
: // 5
1210 case animations::TransitionSubType::BOTTOMLEFT
: // 6
1211 case animations::TransitionSubType::TOPCENTER
: // 7
1212 case animations::TransitionSubType::RIGHTCENTER
: // 8
1213 case animations::TransitionSubType::BOTTOMCENTER
: // 9
1214 case animations::TransitionSubType::CORNERSIN
: // 11
1215 case animations::TransitionSubType::CORNERSOUT
: // 12
1216 case animations::TransitionSubType::VERTICAL
: // 13
1217 case animations::TransitionSubType::HORIZONTAL
: // 14
1218 case animations::TransitionSubType::DIAMOND
: // 26
1219 case animations::TransitionSubType::CIRCLE
: // 27
1220 case animations::TransitionSubType::HEART
: // 31
1221 case animations::TransitionSubType::FANOUTHORIZONTAL
: // 55
1222 case animations::TransitionSubType::ACROSS
: // 108
1228 } else if( transitionType
== animations::TransitionType::FADE
&& transitionSubType
== animations::TransitionSubType::CROSSFADE
) {
1230 } else if( transitionType
== animations::TransitionType::FADE
&& transitionSubType
== animations::TransitionSubType::FADEOVERCOLOR
) {
1232 } else if( transitionType
== animations::TransitionType::IRISWIPE
&& transitionSubType
== animations::TransitionSubType::DIAMOND
) {
1234 } else if( transitionType
== animations::TransitionType::ZOOM
&& transitionSubType
== animations::TransitionSubType::ROTATEIN
) {
1240 virtual uno::Reference
< presentation::XTransition
> SAL_CALL
createTransition(
1241 sal_Int16 transitionType
,
1242 sal_Int16 transitionSubType
,
1243 sal_Int32 transitionFadeColor
,
1244 const uno::Reference
< presentation::XSlideShowView
>& view
,
1245 const uno::Reference
< rendering::XBitmap
>& leavingBitmap
,
1246 const uno::Reference
< rendering::XBitmap
>& enteringBitmap
) override
1248 if( !hasTransition( transitionType
, transitionSubType
) )
1249 return uno::Reference
< presentation::XTransition
>();
1251 rtl::Reference
< OGLTransitionerImpl
> xRes( new OGLTransitionerImpl() );
1252 if ( !xRes
->initialize( view
, leavingBitmap
, enteringBitmap
) )
1253 return uno::Reference
< presentation::XTransition
>();
1255 std::shared_ptr
<OGLTransitionImpl
> pTransition
;
1257 if( transitionType
== animations::TransitionType::MISCSHAPEWIPE
) {
1258 switch( transitionSubType
)
1260 case animations::TransitionSubType::LEFTTORIGHT
:
1261 pTransition
= makeFallLeaving();
1263 case animations::TransitionSubType::TOPTOBOTTOM
:
1264 pTransition
= makeTurnAround();
1266 case animations::TransitionSubType::TOPLEFT
:
1267 pTransition
= makeIris();
1269 case animations::TransitionSubType::TOPRIGHT
:
1270 pTransition
= makeTurnDown();
1272 case animations::TransitionSubType::BOTTOMRIGHT
:
1273 pTransition
= makeRochade();
1275 case animations::TransitionSubType::BOTTOMLEFT
:
1276 pTransition
= makeVenetianBlinds( true, 8 );
1278 case animations::TransitionSubType::TOPCENTER
:
1279 pTransition
= makeVenetianBlinds( false, 6 );
1281 case animations::TransitionSubType::RIGHTCENTER
:
1282 pTransition
= makeStatic();
1284 case animations::TransitionSubType::BOTTOMCENTER
:
1285 pTransition
= makeDissolve();
1287 case animations::TransitionSubType::CORNERSIN
:
1288 pTransition
= makeInsideCubeFaceToLeft();
1290 case animations::TransitionSubType::CORNERSOUT
:
1291 pTransition
= makeOutsideCubeFaceToLeft();
1293 case animations::TransitionSubType::VERTICAL
:
1294 pTransition
= makeVortex();
1296 case animations::TransitionSubType::HORIZONTAL
:
1297 pTransition
= makeRipple();
1299 case animations::TransitionSubType::CIRCLE
:
1300 pTransition
= makeRevolvingCircles(8,128);
1302 case animations::TransitionSubType::FANOUTHORIZONTAL
:
1303 pTransition
= makeHelix(20);
1305 case animations::TransitionSubType::ACROSS
:
1306 pTransition
= makeNByMTileFlip(8,6);
1308 case animations::TransitionSubType::DIAMOND
:
1309 pTransition
= makeGlitter();
1311 case animations::TransitionSubType::HEART
:
1312 pTransition
= makeHoneycomb();
1315 } else if( transitionType
== animations::TransitionType::FADE
&& transitionSubType
== animations::TransitionSubType::CROSSFADE
) {
1316 pTransition
= makeFadeSmoothly();
1317 } else if( transitionType
== animations::TransitionType::FADE
&& transitionSubType
== animations::TransitionSubType::FADEOVERCOLOR
) {
1318 pTransition
= makeFadeThroughColor( transitionFadeColor
== 0xffffff );
1319 } else if( transitionType
== animations::TransitionType::IRISWIPE
&& transitionSubType
== animations::TransitionSubType::DIAMOND
) {
1320 pTransition
= makeDiamond();
1321 } else if( transitionType
== animations::TransitionType::ZOOM
&& transitionSubType
== animations::TransitionSubType::ROTATEIN
) {
1322 pTransition
= makeNewsflash();
1325 if ( !pTransition
|| !xRes
->setTransition(pTransition
) )
1326 return uno::Reference
< presentation::XTransition
>();
1334 extern "C" SAL_DLLPUBLIC_EXPORT
css::uno::XInterface
*
1335 slideshow_OGLTransitionFactoryImpl_get_implementation(
1336 css::uno::XComponentContext
* , css::uno::Sequence
<css::uno::Any
> const&)
1338 return cppu::acquire(new OGLTransitionFactoryImpl());
1340 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */