diff options
Diffstat (limited to 'slideshow/source/engine')
-rw-r--r-- | slideshow/source/engine/animationnodes/animationbasenode.cxx | 12 | ||||
-rw-r--r-- | slideshow/source/engine/shapeattributelayer.cxx | 18 | ||||
-rw-r--r-- | slideshow/source/engine/shapes/drawshape.cxx | 61 | ||||
-rw-r--r-- | slideshow/source/engine/shapes/drawshape.hxx | 3 | ||||
-rw-r--r-- | slideshow/source/engine/slideshowimpl.cxx | 8 |
5 files changed, 72 insertions, 30 deletions
diff --git a/slideshow/source/engine/animationnodes/animationbasenode.cxx b/slideshow/source/engine/animationnodes/animationbasenode.cxx index bc95d636aed5..82868063fefa 100644 --- a/slideshow/source/engine/animationnodes/animationbasenode.cxx +++ b/slideshow/source/engine/animationnodes/animationbasenode.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: animationbasenode.cxx,v $ - * $Revision: 1.16 $ + * $Revision: 1.16.16.2 $ * * This file is part of OpenOffice.org. * @@ -45,6 +45,7 @@ #include "doctreenode.hxx" #include "animationbasenode.hxx" #include "delayevent.hxx" +#include "framerate.hxx" #include <boost/bind.hpp> #include <boost/optional.hpp> @@ -458,18 +459,23 @@ AnimationBaseNode::fillCommonParameters() const boost::bind( &AnimationNode::deactivate, pSelf ) ); } + // Calculate the minimum frame count that depends on the duration and + // the minimum frame count. + const sal_Int32 nMinFrameCount (basegfx::clamp<sal_Int32>( + basegfx::fround(nDuration * FrameRate::MinimumFramesPerSecond), 1, 10)); + return ActivitiesFactory::CommonParameters( pEndEvent, getContext().mrEventQueue, getContext().mrActivitiesQueue, nDuration, - 10, // always display at least 10 frames + nMinFrameCount, bAutoReverse, aRepeats, nAcceleration, nDeceleration, getShape(), - getSlideSize() ); + getSlideSize()); } AttributableShapeSharedPtr AnimationBaseNode::getShape() const diff --git a/slideshow/source/engine/shapeattributelayer.cxx b/slideshow/source/engine/shapeattributelayer.cxx index fb0e0a796e2d..294503a71b77 100644 --- a/slideshow/source/engine/shapeattributelayer.cxx +++ b/slideshow/source/engine/shapeattributelayer.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: shapeattributelayer.cxx,v $ - * $Revision: 1.10 $ + * $Revision: 1.10.16.1 $ * * This file is part of OpenOffice.org. * @@ -46,6 +46,7 @@ #include <com/sun/star/animations/AnimationAdditiveMode.hpp> #include <basegfx/numeric/ftools.hxx> +#include <basegfx/polygon/b2dpolygon.hxx> #include <rtl/math.hxx> @@ -76,6 +77,8 @@ namespace slideshow ++mnPositionState; if( mnContentState != mpChild->getContentState() ) ++mnContentState; + if( mnVisibilityState != mpChild->getVisibilityState() ) + ++mnVisibilityState; } } @@ -172,6 +175,7 @@ namespace slideshow mnAlphaState( rChildLayer ? rChildLayer->getAlphaState() : 0), mnPositionState( rChildLayer ? rChildLayer->getPositionState() : 0 ), mnContentState( rChildLayer ? rChildLayer->getContentState() : 0 ), + mnVisibilityState( rChildLayer ? rChildLayer->getVisibilityState() : 0 ), mnAdditiveMode( animations::AnimationAdditiveMode::BASE ), @@ -233,6 +237,7 @@ namespace slideshow ++mnAlphaState; ++mnPositionState; ++mnContentState; + ++mnVisibilityState; } } else @@ -267,6 +272,7 @@ namespace slideshow ++mnAlphaState; ++mnPositionState; ++mnContentState; + ++mnVisibilityState; } mnAdditiveMode = nMode; @@ -633,7 +639,7 @@ namespace slideshow { mbVisibility = bVisible; mbVisibilityValid = true; - ++mnContentState; + ++mnVisibilityState; } bool ShapeAttributeLayer::isCharColorValid() const @@ -841,5 +847,13 @@ namespace slideshow mnContentState; } + State::StateId ShapeAttributeLayer::getVisibilityState() const + { + return haveChild() ? + ::std::max( mnVisibilityState, + mpChild->getVisibilityState() ) : + mnVisibilityState; + } + } } diff --git a/slideshow/source/engine/shapes/drawshape.cxx b/slideshow/source/engine/shapes/drawshape.cxx index a4c36cf2e6af..e588a8fb4e58 100644 --- a/slideshow/source/engine/shapes/drawshape.cxx +++ b/slideshow/source/engine/shapes/drawshape.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: drawshape.cxx,v $ - * $Revision: 1.7 $ + * $Revision: 1.7.12.1 $ * * This file is part of OpenOffice.org. * @@ -270,6 +270,7 @@ namespace slideshow mnAttributeAlphaState = mpAttributeLayer->getAlphaState(); mnAttributePositionState = mpAttributeLayer->getPositionState(); mnAttributeContentState = mpAttributeLayer->getContentState(); + mnAttributeVisibilityState = mpAttributeLayer->getVisibilityState(); } } @@ -383,27 +384,42 @@ namespace slideshow // do we have an attribute layer? if( mpAttributeLayer ) { - // TODO(P1): This can be done without conditional branching. - // See HAKMEM. - if( mpAttributeLayer->getPositionState() != mnAttributePositionState ) + // Prevent nUpdateFlags to be modified when the shape is not + // visible, except when it just was hidden. + if (mpAttributeLayer->getVisibility() + || mpAttributeLayer->getVisibilityState() != mnAttributeVisibilityState ) { - nUpdateFlags |= ViewShape::POSITION; - } - if( mpAttributeLayer->getAlphaState() != mnAttributeAlphaState ) - { - nUpdateFlags |= ViewShape::ALPHA; - } - if( mpAttributeLayer->getClipState() != mnAttributeClipState ) - { - nUpdateFlags |= ViewShape::CLIP; - } - if( mpAttributeLayer->getTransformationState() != mnAttributeTransformationState ) - { - nUpdateFlags |= ViewShape::TRANSFORMATION; - } - if( mpAttributeLayer->getContentState() != mnAttributeContentState ) - { - nUpdateFlags |= ViewShape::CONTENT; + if (mpAttributeLayer->getVisibilityState() != mnAttributeVisibilityState ) + { + // Change of the visibility state is mapped to + // content change because when the visibility + // changes then usually a sprite is shown or hidden + // and the background under has to be painted once. + nUpdateFlags |= ViewShape::CONTENT; + } + + // TODO(P1): This can be done without conditional branching. + // See HAKMEM. + if( mpAttributeLayer->getPositionState() != mnAttributePositionState ) + { + nUpdateFlags |= ViewShape::POSITION; + } + if( mpAttributeLayer->getAlphaState() != mnAttributeAlphaState ) + { + nUpdateFlags |= ViewShape::ALPHA; + } + if( mpAttributeLayer->getClipState() != mnAttributeClipState ) + { + nUpdateFlags |= ViewShape::CLIP; + } + if( mpAttributeLayer->getTransformationState() != mnAttributeTransformationState ) + { + nUpdateFlags |= ViewShape::TRANSFORMATION; + } + if( mpAttributeLayer->getContentState() != mnAttributeContentState ) + { + nUpdateFlags |= ViewShape::CONTENT; + } } } @@ -543,6 +559,7 @@ namespace slideshow mnAttributeAlphaState(0), mnAttributePositionState(0), mnAttributeContentState(0), + mnAttributeVisibilityState(0), maViewShapes(), mxComponentContext( rContext.mxComponentContext ), maHyperlinkIndices(), @@ -603,6 +620,7 @@ namespace slideshow mnAttributeAlphaState(0), mnAttributePositionState(0), mnAttributeContentState(0), + mnAttributeVisibilityState(0), maViewShapes(), mxComponentContext( rContext.mxComponentContext ), maHyperlinkIndices(), @@ -654,6 +672,7 @@ namespace slideshow mnAttributeAlphaState(0), mnAttributePositionState(0), mnAttributeContentState(0), + mnAttributeVisibilityState(0), maViewShapes(), mxComponentContext( rSrc.mxComponentContext ), maHyperlinkIndices(), diff --git a/slideshow/source/engine/shapes/drawshape.hxx b/slideshow/source/engine/shapes/drawshape.hxx index 91d0914ff323..1788fb1855f6 100644 --- a/slideshow/source/engine/shapes/drawshape.hxx +++ b/slideshow/source/engine/shapes/drawshape.hxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: drawshape.hxx,v $ - * $Revision: 1.4 $ + * $Revision: 1.4.12.1 $ * * This file is part of OpenOffice.org. * @@ -338,6 +338,7 @@ namespace slideshow mutable State::StateId mnAttributeAlphaState; mutable State::StateId mnAttributePositionState; mutable State::StateId mnAttributeContentState; + mutable State::StateId mnAttributeVisibilityState; /// the list of active view shapes (one for each registered view layer) typedef ::std::vector< ViewShapeSharedPtr > ViewShapeVector; diff --git a/slideshow/source/engine/slideshowimpl.cxx b/slideshow/source/engine/slideshowimpl.cxx index d89d57d2d7f8..ac0f256324d7 100644 --- a/slideshow/source/engine/slideshowimpl.cxx +++ b/slideshow/source/engine/slideshowimpl.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: slideshowimpl.cxx,v $ - * $Revision: 1.10 $ + * $Revision: 1.10.16.2 $ * * This file is part of OpenOffice.org. * @@ -93,6 +93,7 @@ #include "slidebitmap.hxx" #include "rehearsetimingsactivity.hxx" #include "waitsymbol.hxx" +#include "framerate.hxx" #include <boost/noncopyable.hpp> #include <boost/bind.hpp> @@ -1530,8 +1531,9 @@ sal_Bool SlideShowImpl::update( double & nNextTimeout ) // calc nNextTimeout value: if (bActivitiesLeft) { - // activities left: requires immediate updates - nNextTimeout = 0.0; // come back ASAP + // Activity queue is not empty. Tell caller that we would + // like to render another frame. + nNextTimeout = 1.0 / FrameRate::PreferredFramesPerSecond; } else { |