2 Index: source/engine/shapeattributelayer.cxx
3 ===================================================================
4 RCS file: /cvs/graphics/slideshow/source/engine/shapeattributelayer.cxx,v
5 retrieving revision 1.10
6 retrieving revision 1.10.16.1
7 diff -u -p -r1.10 -r1.10.16.1
8 --- slideshow/source/engine/shapeattributelayer.cxx 24 Jun 2008 12:02:30 -0000 1.10
9 +++ slideshow/source/engine/shapeattributelayer.cxx 20 Oct 2008 11:53:44 -0000 1.10.16.1
11 #include <com/sun/star/animations/AnimationAdditiveMode.hpp>
13 #include <basegfx/numeric/ftools.hxx>
14 +#include <basegfx/polygon/b2dpolygon.hxx>
15 #include <rtl/math.hxx>
18 @@ -76,6 +77,8 @@ namespace slideshow
20 if( mnContentState != mpChild->getContentState() )
22 + if( mnVisibilityState != mpChild->getVisibilityState() )
23 + ++mnVisibilityState;
27 @@ -172,6 +175,7 @@ namespace slideshow
28 mnAlphaState( rChildLayer ? rChildLayer->getAlphaState() : 0),
29 mnPositionState( rChildLayer ? rChildLayer->getPositionState() : 0 ),
30 mnContentState( rChildLayer ? rChildLayer->getContentState() : 0 ),
31 + mnVisibilityState( rChildLayer ? rChildLayer->getVisibilityState() : 0 ),
33 mnAdditiveMode( animations::AnimationAdditiveMode::BASE ),
35 @@ -205,7 +209,7 @@ namespace slideshow
36 mbUnderlineModeValid( false ),
37 mbCharPostureValid( false ),
38 mbVisibilityValid( false )
43 bool ShapeAttributeLayer::revokeChildLayer( const ShapeAttributeLayerSharedPtr& rChildLayer )
44 @@ -233,6 +237,7 @@ namespace slideshow
48 + ++mnVisibilityState;
52 @@ -267,6 +272,7 @@ namespace slideshow
56 + ++mnVisibilityState;
59 mnAdditiveMode = nMode;
60 @@ -633,7 +639,7 @@ namespace slideshow
62 mbVisibility = bVisible;
63 mbVisibilityValid = true;
65 + ++mnVisibilityState;
68 bool ShapeAttributeLayer::isCharColorValid() const
69 @@ -841,5 +847,13 @@ namespace slideshow
73 + State::StateId ShapeAttributeLayer::getVisibilityState() const
75 + return haveChild() ?
76 + ::std::max( mnVisibilityState,
77 + mpChild->getVisibilityState() ) :
83 Index: source/engine/slideshowimpl.cxx
84 ===================================================================
85 RCS file: /cvs/graphics/slideshow/source/engine/slideshowimpl.cxx,v
86 retrieving revision 1.10
87 retrieving revision 1.10.16.2
88 diff -u -p -r1.10 -r1.10.16.2
89 --- slideshow/source/engine/slideshowimpl.cxx 24 Jun 2008 12:03:06 -0000 1.10
90 +++ slideshow/source/engine/slideshowimpl.cxx 16 Oct 2008 14:48:04 -0000 1.10.16.2
92 #include "slidebitmap.hxx"
93 #include "rehearsetimingsactivity.hxx"
94 #include "waitsymbol.hxx"
95 +#include "framerate.hxx"
97 #include <boost/noncopyable.hpp>
98 #include <boost/bind.hpp>
99 @@ -1522,8 +1523,9 @@ sal_Bool SlideShowImpl::update( double &
100 // calc nNextTimeout value:
103 - // activities left: requires immediate updates
104 - nNextTimeout = 0.0; // come back ASAP
105 + // Activity queue is not empty. Tell caller that we would
106 + // like to render another frame.
107 + nNextTimeout = 1.0 / FrameRate::PreferredFramesPerSecond;
111 Index: source/engine/animationnodes/animationbasenode.cxx
112 ===================================================================
113 RCS file: /cvs/graphics/slideshow/source/engine/animationnodes/animationbasenode.cxx,v
114 retrieving revision 1.16
115 retrieving revision 1.16.16.2
116 diff -u -p -r1.16 -r1.16.16.2
117 --- slideshow/source/engine/animationnodes/animationbasenode.cxx 24 Jun 2008 12:06:45 -0000 1.16
118 +++ slideshow/source/engine/animationnodes/animationbasenode.cxx 16 Oct 2008 14:48:04 -0000 1.16.16.2
121 #include <canvas/debug.hxx>
122 #include <canvas/verbosetrace.hxx>
123 +#include <canvas/canvastools.hxx>
124 #include <cppuhelper/exc_hlp.hxx>
125 #include <comphelper/anytostring.hxx>
126 #include <com/sun/star/presentation/ParagraphTarget.hpp>
128 #include "doctreenode.hxx"
129 #include "animationbasenode.hxx"
130 #include "delayevent.hxx"
131 +#include "framerate.hxx"
133 #include <boost/bind.hpp>
134 #include <boost/optional.hpp>
135 @@ -457,19 +458,24 @@ AnimationBaseNode::fillCommonParameters(
136 pEndEvent = makeEvent(
137 boost::bind( &AnimationNode::deactivate, pSelf ) );
141 + // Calculate the minimum frame count that depends on the duration and
142 + // the minimum frame count.
143 + const sal_Int32 nMinFrameCount (basegfx::clamp<sal_Int32>(
144 + basegfx::fround(nDuration * FrameRate::MinimumFramesPerSecond), 1, 10));
146 return ActivitiesFactory::CommonParameters(
148 getContext().mrEventQueue,
149 getContext().mrActivitiesQueue,
151 - 10, // always display at least 10 frames
162 AttributableShapeSharedPtr AnimationBaseNode::getShape() const
163 Index: source/engine/shapes/drawshape.cxx
164 ===================================================================
165 RCS file: /cvs/graphics/slideshow/source/engine/shapes/drawshape.cxx,v
166 retrieving revision 1.7
167 retrieving revision 1.7.12.1
168 diff -u -p -r1.7 -r1.7.12.1
169 --- slideshow/source/engine/shapes/drawshape.cxx 11 Jul 2008 07:08:56 -0000 1.7
170 +++ slideshow/source/engine/shapes/drawshape.cxx 20 Oct 2008 11:55:33 -0000 1.7.12.1
171 @@ -270,6 +270,7 @@ namespace slideshow
172 mnAttributeAlphaState = mpAttributeLayer->getAlphaState();
173 mnAttributePositionState = mpAttributeLayer->getPositionState();
174 mnAttributeContentState = mpAttributeLayer->getContentState();
175 + mnAttributeVisibilityState = mpAttributeLayer->getVisibilityState();
179 @@ -383,27 +384,42 @@ namespace slideshow
180 // do we have an attribute layer?
181 if( mpAttributeLayer )
183 - // TODO(P1): This can be done without conditional branching.
185 - if( mpAttributeLayer->getPositionState() != mnAttributePositionState )
186 + // Prevent nUpdateFlags to be modified when the shape is not
187 + // visible, except when it just was hidden.
188 + if (mpAttributeLayer->getVisibility()
189 + || mpAttributeLayer->getVisibilityState() != mnAttributeVisibilityState )
191 - nUpdateFlags |= ViewShape::POSITION;
193 - if( mpAttributeLayer->getAlphaState() != mnAttributeAlphaState )
195 - nUpdateFlags |= ViewShape::ALPHA;
197 - if( mpAttributeLayer->getClipState() != mnAttributeClipState )
199 - nUpdateFlags |= ViewShape::CLIP;
201 - if( mpAttributeLayer->getTransformationState() != mnAttributeTransformationState )
203 - nUpdateFlags |= ViewShape::TRANSFORMATION;
205 - if( mpAttributeLayer->getContentState() != mnAttributeContentState )
207 - nUpdateFlags |= ViewShape::CONTENT;
208 + if (mpAttributeLayer->getVisibilityState() != mnAttributeVisibilityState )
210 + // Change of the visibility state is mapped to
211 + // content change because when the visibility
212 + // changes then usually a sprite is shown or hidden
213 + // and the background under has to be painted once.
214 + nUpdateFlags |= ViewShape::CONTENT;
217 + // TODO(P1): This can be done without conditional branching.
219 + if( mpAttributeLayer->getPositionState() != mnAttributePositionState )
221 + nUpdateFlags |= ViewShape::POSITION;
223 + if( mpAttributeLayer->getAlphaState() != mnAttributeAlphaState )
225 + nUpdateFlags |= ViewShape::ALPHA;
227 + if( mpAttributeLayer->getClipState() != mnAttributeClipState )
229 + nUpdateFlags |= ViewShape::CLIP;
231 + if( mpAttributeLayer->getTransformationState() != mnAttributeTransformationState )
233 + nUpdateFlags |= ViewShape::TRANSFORMATION;
235 + if( mpAttributeLayer->getContentState() != mnAttributeContentState )
237 + nUpdateFlags |= ViewShape::CONTENT;
242 @@ -543,6 +559,7 @@ namespace slideshow
243 mnAttributeAlphaState(0),
244 mnAttributePositionState(0),
245 mnAttributeContentState(0),
246 + mnAttributeVisibilityState(0),
248 mxComponentContext( rContext.mxComponentContext ),
249 maHyperlinkIndices(),
250 @@ -603,6 +620,7 @@ namespace slideshow
251 mnAttributeAlphaState(0),
252 mnAttributePositionState(0),
253 mnAttributeContentState(0),
254 + mnAttributeVisibilityState(0),
256 mxComponentContext( rContext.mxComponentContext ),
257 maHyperlinkIndices(),
258 @@ -654,6 +672,7 @@ namespace slideshow
259 mnAttributeAlphaState(0),
260 mnAttributePositionState(0),
261 mnAttributeContentState(0),
262 + mnAttributeVisibilityState(0),
264 mxComponentContext( rSrc.mxComponentContext ),
265 maHyperlinkIndices(),
266 Index: source/engine/shapes/drawshape.hxx
267 ===================================================================
268 RCS file: /cvs/graphics/slideshow/source/engine/shapes/drawshape.hxx,v
269 retrieving revision 1.4
270 retrieving revision 1.4.12.1
271 diff -u -p -r1.4 -r1.4.12.1
272 --- slideshow/source/engine/shapes/drawshape.hxx 11 Jul 2008 07:09:10 -0000 1.4
273 +++ slideshow/source/engine/shapes/drawshape.hxx 24 Oct 2008 13:24:21 -0000 1.4.12.1
274 @@ -338,6 +338,7 @@ namespace slideshow
275 mutable State::StateId mnAttributeAlphaState;
276 mutable State::StateId mnAttributePositionState;
277 mutable State::StateId mnAttributeContentState;
278 + mutable State::StateId mnAttributeVisibilityState;
280 /// the list of active view shapes (one for each registered view layer)
281 typedef ::std::vector< ViewShapeSharedPtr > ViewShapeVector;
282 Index: source/inc/framerate.hxx
283 ===================================================================
284 RCS file: source/inc/framerate.hxx
285 diff -N source/inc/framerate.hxx
286 --- /dev/null 1 Jan 1970 00:00:00 -0000
287 +++ slideshow/source/inc/framerate.hxx 16 Oct 2008 14:48:05 -0000 1.1.2.1
289 +/*************************************************************************
291 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
293 + * Copyright 2008 by Sun Microsystems, Inc.
295 + * OpenOffice.org - a multi-platform office productivity suite
300 + * This file is part of OpenOffice.org.
302 + * OpenOffice.org is free software: you can redistribute it and/or modify
303 + * it under the terms of the GNU Lesser General Public License version 3
304 + * only, as published by the Free Software Foundation.
306 + * OpenOffice.org is distributed in the hope that it will be useful,
307 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
308 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
309 + * GNU Lesser General Public License version 3 for more details
310 + * (a copy is included in the LICENSE file that accompanied this code).
312 + * You should have received a copy of the GNU Lesser General Public License
313 + * version 3 along with OpenOffice.org. If not, see
314 + * <http://www.openoffice.org/license.html>
315 + * for a copy of the LGPLv3 License.
317 + ************************************************************************/
319 +#ifndef INCLUDED_SLIDESHOW_FRAMERATE_HXX
320 +#define INCLUDED_SLIDESHOW_FRAMERATE_HXX
322 +#include <sal/types.h>
324 +namespace slideshow { namespace internal {
326 +/** Some frame rate related data.
331 + /** The minimum number of frames per second is used to calculate the
332 + minimum number of frames that is to be shown for active activities.
334 + static const sal_Int32 MinimumFramesPerSecond = 10;
336 + /** Aim high with the number of preferred number of frames per second.
337 + This number is the maximum as well and the true number will be lower.
339 + static const sal_Int32 PreferredFramesPerSecond = 50;
342 +} } // end of namespace slideshow::internal
345 Index: source/inc/shapeattributelayer.hxx
346 ===================================================================
347 RCS file: /cvs/graphics/slideshow/source/inc/shapeattributelayer.hxx,v
348 retrieving revision 1.8
349 retrieving revision 1.8.30.1
350 diff -u -p -r1.8 -r1.8.30.1
351 --- slideshow/source/inc/shapeattributelayer.hxx 11 Apr 2008 01:29:17 -0000 1.8
352 +++ slideshow/source/inc/shapeattributelayer.hxx 20 Oct 2008 11:52:16 -0000 1.8.30.1
353 @@ -471,6 +471,7 @@ namespace slideshow
354 State::StateId getAlphaState() const;
355 State::StateId getPositionState() const;
356 State::StateId getContentState() const;
357 + State::StateId getVisibilityState() const;
360 // default copy/assignment operator is okay
361 @@ -516,6 +517,7 @@ namespace slideshow
362 State::StateId mnAlphaState;
363 State::StateId mnPositionState;
364 State::StateId mnContentState;
365 + State::StateId mnVisibilityState;
367 sal_Int16 mnAdditiveMode;