From d29c27af4aff3f5268bd4a07647fd7435603ba11 Mon Sep 17 00:00:00 2001 From: Sarper Akdemir Date: Tue, 25 Aug 2020 11:24:22 +0300 Subject: tdf#136097: make physics animation effects handle skips and rewinds Making box2d world only stay populated when there's an animation effect going on. This makes it possible to get rid of big chunk of sequential update implementation. Change-Id: Iaf50d4871b2355035495618354f0ae09abe94164 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101304 Tested-by: Jenkins Reviewed-by: Thorsten Behrens --- slideshow/source/inc/box2dtools.hxx | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) (limited to 'slideshow/source/inc/box2dtools.hxx') diff --git a/slideshow/source/inc/box2dtools.hxx b/slideshow/source/inc/box2dtools.hxx index 0debf1da4ef0..6bfc9dfd1b7c 100644 --- a/slideshow/source/inc/box2dtools.hxx +++ b/slideshow/source/inc/box2dtools.hxx @@ -65,13 +65,6 @@ struct Box2DDynamicUpdateInformation int mnDelayForSteps = 0; }; -union Box2DStaticUpdateInformation { - ::basegfx::B2DPoint maPosition; - bool mbVisibility; - double mfAngle; - Box2DStaticUpdateInformation() {} -}; - /** Class that manages the Box2D World This class is used when there's a simulated animation going on, @@ -89,16 +82,12 @@ private: /// Holds whether or not there is a Physics Animation node that /// is stepping the Box2D World bool mbHasWorldStepper; + int mnPhysicsAnimationCounter; std::unordered_map, Box2DBodySharedPtr> mpXShapeToBodyMap; /// Holds any information needed to keep LO animations and Box2D world in sync /// if they are going in parallel std::queue maShapeParallelUpdateQueue; - /// Holds necessary information to update a shape's body that was altered by an - /// animation effect while there was no Physics Animation going in parallel - std::map, box2DNonsimulatedShapeUpdateType>, - Box2DStaticUpdateInformation> - maShapeSequentialUpdate; /// Creates a static frame in Box2D world that corresponds to the slide borders void createStaticFrameAroundSlide(const ::basegfx::B2DVector& rSlideSize); @@ -270,7 +259,11 @@ public: void queueShapeAnimationEndUpdate(const css::uno::Reference& xShape, const slideshow::internal::AttributeType eAttrType); - void alertAnimationEndForShape(const slideshow::internal::ShapeSharedPtr& pShape); + void alertPhysicsAnimationEnd(const slideshow::internal::ShapeSharedPtr& pShape); + + void + alertPhysicsAnimationStart(const ::basegfx::B2DVector& rSlideSize, + const slideshow::internal::ShapeManagerSharedPtr& pShapeManager); }; /// Class that manages a single box2D Body -- cgit