diff options
author | Luboš Luňák <l.lunak@collabora.com> | 2020-05-07 17:46:01 +0200 |
---|---|---|
committer | Luboš Luňák <l.lunak@collabora.com> | 2020-05-08 17:37:26 +0200 |
commit | e3d7fdff5ce3089b24b755063da95a3462b0fc30 (patch) | |
tree | e15fc59e9af4439a6f22acea1401cc687c4b3237 /slideshow | |
parent | 320cba92847242cfaf34966c3fc32c4e76d45f03 (diff) |
implement PowerPoint 'flash' slide transition (API CHANGE)
It's like 'fade', but using white instead of black. It's a separate
type in the pptx file (although I actually cannot find it
in the spec OOXML, but PowerPoint 2013 generates it).
The API change in XTransitionFactory should be fine, I doubt
there's anything external using it.
Change-Id: I3479840f265ed8227b3b8301ecff56a63d57f493
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93668
Tested-by: Luboš Luňák <l.lunak@collabora.com>
Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
Diffstat (limited to 'slideshow')
5 files changed, 31 insertions, 15 deletions
diff --git a/slideshow/opengl/fadeBlackFragmentShader.glsl b/slideshow/opengl/fadeBlackFragmentShader.glsl index d45a736c8065..3d618a3b4b91 100644 --- a/slideshow/opengl/fadeBlackFragmentShader.glsl +++ b/slideshow/opengl/fadeBlackFragmentShader.glsl @@ -15,7 +15,11 @@ uniform float time; varying vec2 v_texturePosition; void main() { - vec4 black = vec4(0.0, 0.0, 0.0, 1.0); +#ifdef use_white + vec4 color = vec4(1.0, 1.0, 1.0, 1.0); +#else + vec4 color = vec4(0.0, 0.0, 0.0, 1.0); +#endif vec4 texel; float amount; if (time < 0.5) { @@ -25,7 +29,7 @@ void main() { texel = texture2D(enteringSlideTexture, v_texturePosition); amount = (1.0 - time) * 2; } - gl_FragColor = mix(texel, black, amount); + gl_FragColor = mix(texel, color, amount); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/slideshow/source/engine/opengl/TransitionImpl.cxx b/slideshow/source/engine/opengl/TransitionImpl.cxx index d1926ab854f9..98d6778fd197 100644 --- a/slideshow/source/engine/opengl/TransitionImpl.cxx +++ b/slideshow/source/engine/opengl/TransitionImpl.cxx @@ -1351,37 +1351,40 @@ std::shared_ptr<OGLTransitionImpl> makeFadeSmoothly() namespace { -class FadeThroughBlackTransition : public OGLTransitionImpl +class FadeThroughColorTransition : public OGLTransitionImpl { public: - FadeThroughBlackTransition(const TransitionScene& rScene, const TransitionSettings& rSettings) - : OGLTransitionImpl(rScene, rSettings) + FadeThroughColorTransition(const TransitionScene& rScene, const TransitionSettings& rSettings, bool white) + : OGLTransitionImpl(rScene, rSettings), useWhite( white ) {} private: virtual GLuint makeShader() const override; + bool useWhite; }; -GLuint FadeThroughBlackTransition::makeShader() const +GLuint FadeThroughColorTransition::makeShader() const { - return OpenGLHelper::LoadShaders( "basicVertexShader", "fadeBlackFragmentShader" ); + return OpenGLHelper::LoadShaders( "basicVertexShader", "fadeBlackFragmentShader", + useWhite ? "#define use_white" : "", "" ); } std::shared_ptr<OGLTransitionImpl> -makeFadeThroughBlackTransition( +makeFadeThroughColorTransition( const Primitives_t& rLeavingSlidePrimitives, const Primitives_t& rEnteringSlidePrimitives, - const TransitionSettings& rSettings) + const TransitionSettings& rSettings, + bool white) { - return std::make_shared<FadeThroughBlackTransition>( + return std::make_shared<FadeThroughColorTransition>( TransitionScene(rLeavingSlidePrimitives, rEnteringSlidePrimitives), - rSettings) + rSettings, white) ; } } -std::shared_ptr<OGLTransitionImpl> makeFadeThroughBlack() +std::shared_ptr<OGLTransitionImpl> makeFadeThroughColor( bool white ) { Primitive Slide; @@ -1395,7 +1398,7 @@ std::shared_ptr<OGLTransitionImpl> makeFadeThroughBlack() TransitionSettings aSettings; aSettings.mbUseMipMapLeaving = aSettings.mbUseMipMapEntering = false; - return makeFadeThroughBlackTransition(aLeavingSlide, aEnteringSlide, aSettings); + return makeFadeThroughColorTransition(aLeavingSlide, aEnteringSlide, aSettings, white); } namespace diff --git a/slideshow/source/engine/opengl/TransitionImpl.hxx b/slideshow/source/engine/opengl/TransitionImpl.hxx index 2831685cd3a7..ca1d36366a6c 100644 --- a/slideshow/source/engine/opengl/TransitionImpl.hxx +++ b/slideshow/source/engine/opengl/TransitionImpl.hxx @@ -271,7 +271,8 @@ std::shared_ptr<OGLTransitionImpl> makeNewsflash(); std::shared_ptr<OGLTransitionImpl> makeDiamond(); std::shared_ptr<OGLTransitionImpl> makeFadeSmoothly(); -std::shared_ptr<OGLTransitionImpl> makeFadeThroughBlack(); +// fade through black or white +std::shared_ptr<OGLTransitionImpl> makeFadeThroughColor( bool white = false ); class SceneObject { diff --git a/slideshow/source/engine/opengl/TransitionerImpl.cxx b/slideshow/source/engine/opengl/TransitionerImpl.cxx index 7403cad87425..c60be299752a 100644 --- a/slideshow/source/engine/opengl/TransitionerImpl.cxx +++ b/slideshow/source/engine/opengl/TransitionerImpl.cxx @@ -1214,6 +1214,7 @@ public: virtual uno::Reference< presentation::XTransition > SAL_CALL createTransition( sal_Int16 transitionType, sal_Int16 transitionSubType, + sal_Int32 transitionFadeColor, const uno::Reference< presentation::XSlideShowView >& view, const uno::Reference< rendering::XBitmap >& leavingBitmap, const uno::Reference< rendering::XBitmap >& enteringBitmap ) override @@ -1288,7 +1289,7 @@ public: } else if( transitionType == animations::TransitionType::FADE && transitionSubType == animations::TransitionSubType::CROSSFADE ) { pTransition = makeFadeSmoothly(); } else if( transitionType == animations::TransitionType::FADE && transitionSubType == animations::TransitionSubType::FADEOVERCOLOR ) { - pTransition = makeFadeThroughBlack(); + pTransition = makeFadeThroughColor( transitionFadeColor == 0xffffff ); } else if( transitionType == animations::TransitionType::IRISWIPE && transitionSubType == animations::TransitionSubType::DIAMOND ) { pTransition = makeDiamond(); } else if( transitionType == animations::TransitionType::ZOOM && transitionSubType == animations::TransitionSubType::ROTATEIN ) { diff --git a/slideshow/source/engine/transitions/slidetransitionfactory.cxx b/slideshow/source/engine/transitions/slidetransitionfactory.cxx index ec67e434cb7c..66faf10e09b3 100644 --- a/slideshow/source/engine/transitions/slidetransitionfactory.cxx +++ b/slideshow/source/engine/transitions/slidetransitionfactory.cxx @@ -108,6 +108,7 @@ public: */ PluginSlideChange( sal_Int16 nTransitionType, sal_Int16 nTransitionSubType, + const RGBColor& rTransitionFadeColor, std::optional<SlideSharedPtr> const& leavingSlide_, const SlideSharedPtr& pEnteringSlide, const UnoViewContainer& rViewContainer, @@ -126,6 +127,7 @@ public: mbSuccess( false ), mnTransitionType( nTransitionType ), mnTransitionSubType( nTransitionSubType ), + mnTransitionFadeColor( rTransitionFadeColor ), mxFactory( xFactory ) { // create one transition per view @@ -150,6 +152,7 @@ public: uno::Reference<presentation::XTransition> rTransition = mxFactory->createTransition( mnTransitionType, mnTransitionSubType, + RGBAColor2UnoColor( mnTransitionFadeColor.getIntegerColor()), rView->getUnoView(), getLeavingBitmap(ViewEntry(rView))->getXBitmap(), getEnteringBitmap(ViewEntry(rView))->getXBitmap() ); @@ -247,6 +250,7 @@ private: sal_Int16 mnTransitionType; sal_Int16 mnTransitionSubType; + RGBColor mnTransitionFadeColor; uno::Reference<presentation::XTransitionFactory> mxFactory; }; @@ -844,6 +848,7 @@ NumberAnimationSharedPtr createSlideWipeTransition( NumberAnimationSharedPtr createPluginTransition( sal_Int16 nTransitionType, sal_Int16 nTransitionSubType, + const RGBColor& rTransitionFadeColor, std::optional<SlideSharedPtr> const& pLeavingSlide, const SlideSharedPtr& pEnteringSlide, const UnoViewContainer& rViewContainer, @@ -857,6 +862,7 @@ NumberAnimationSharedPtr createPluginTransition( std::make_shared<PluginSlideChange>( nTransitionType, nTransitionSubType, + rTransitionFadeColor, pLeavingSlide, pEnteringSlide, rViewContainer, @@ -909,6 +915,7 @@ NumberAnimationSharedPtr TransitionFactory::createSlideTransition( createPluginTransition( nTransitionType, nTransitionSubType, + rTransitionFadeColor, std::make_optional(pLeavingSlide), pEnteringSlide, rViewContainer, |