summaryrefslogtreecommitdiff
path: root/slideshow
diff options
context:
space:
mode:
authorOliver Bolte <obo@openoffice.org>2009-02-27 08:11:53 +0000
committerOliver Bolte <obo@openoffice.org>2009-02-27 08:11:53 +0000
commit9ae35d4e8d783b08025575426badc2783aa773c9 (patch)
treebe00108f1cc7668e374e5e507fb5b3f77c07c57b /slideshow
parent57060ba91a91f6c4fe0afef90fa366a17034a9a1 (diff)
CWS-TOOLING: integrate CWS impress162
2009-02-19 13:02:17 +0100 af r268275 : #i93945# Stop forcing long into sal_Int32. 2009-01-16 15:24:01 +0100 af r266424 : CWS-TOOLING: rebase CWS impress162 to trunk@265758 (milestone: DEV300:m38) 2008-11-21 15:17:22 +0100 af r264143 : CWS-TOOLING: rebase CWS impress162 to trunk@263288 (milestone: DEV300:m35) 2008-11-20 16:29:33 +0100 af r264067 : Merge in latest fixes to the cws command. 2008-11-20 16:25:36 +0100 af r264066 : Merge in latest fixes to the cws command. 2008-11-20 14:37:15 +0100 af r264054 : Merge in latest fixes to the cws command. 2008-11-20 14:01:36 +0100 af r264051 : Resolved merge conflicts. 2008-11-20 14:01:16 +0100 af r264050 : Resolved merge conflicts. 2008-11-19 15:45:05 +0100 af r263998 : Migrate CWS impress162 to SVN.
Diffstat (limited to 'slideshow')
-rw-r--r--slideshow/source/engine/animationnodes/animationbasenode.cxx12
-rw-r--r--slideshow/source/engine/shapeattributelayer.cxx18
-rw-r--r--slideshow/source/engine/shapes/drawshape.cxx61
-rw-r--r--slideshow/source/engine/shapes/drawshape.hxx3
-rw-r--r--slideshow/source/engine/slideshowimpl.cxx8
-rw-r--r--slideshow/source/inc/framerate.hxx56
-rw-r--r--slideshow/source/inc/shapeattributelayer.hxx4
7 files changed, 131 insertions, 31 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
{
diff --git a/slideshow/source/inc/framerate.hxx b/slideshow/source/inc/framerate.hxx
new file mode 100644
index 000000000000..d1656b98f5c2
--- /dev/null
+++ b/slideshow/source/inc/framerate.hxx
@@ -0,0 +1,56 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: framerate.hxx,v $
+ * $Revision: 1.1.2.1 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef INCLUDED_SLIDESHOW_FRAMERATE_HXX
+#define INCLUDED_SLIDESHOW_FRAMERATE_HXX
+
+#include <sal/types.h>
+
+namespace slideshow { namespace internal {
+
+/** Some frame rate related data.
+*/
+class FrameRate
+{
+public:
+ /** The minimum number of frames per second is used to calculate the
+ minimum number of frames that is to be shown for active activities.
+ */
+ static const sal_Int32 MinimumFramesPerSecond = 10;
+
+ /** Aim high with the number of preferred number of frames per second.
+ This number is the maximum as well and the true number will be lower.
+ */
+ static const sal_Int32 PreferredFramesPerSecond = 50;
+};
+
+} } // end of namespace slideshow::internal
+
+#endif
diff --git a/slideshow/source/inc/shapeattributelayer.hxx b/slideshow/source/inc/shapeattributelayer.hxx
index ca0392ed1b5f..6a06eca4ecda 100644
--- a/slideshow/source/inc/shapeattributelayer.hxx
+++ b/slideshow/source/inc/shapeattributelayer.hxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: shapeattributelayer.hxx,v $
- * $Revision: 1.8 $
+ * $Revision: 1.8.30.1 $
*
* This file is part of OpenOffice.org.
*
@@ -471,6 +471,7 @@ namespace slideshow
State::StateId getAlphaState() const;
State::StateId getPositionState() const;
State::StateId getContentState() const;
+ State::StateId getVisibilityState() const;
private:
// default copy/assignment operator is okay
@@ -516,6 +517,7 @@ namespace slideshow
State::StateId mnAlphaState;
State::StateId mnPositionState;
State::StateId mnContentState;
+ State::StateId mnVisibilityState;
sal_Int16 mnAdditiveMode;