From 7de41aa023408873c69d6d232ceee56a0f2f9aa5 Mon Sep 17 00:00:00 2001 From: Sarper Akdemir Date: Fri, 21 Aug 2020 10:12:25 +0300 Subject: box2dtools renaming some for clarity Change-Id: Idd872213ee3140e82fbd6e8e8bd1ebff78dfdc18 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101132 Tested-by: Jenkins Reviewed-by: Thorsten Behrens --- slideshow/source/engine/animationfactory.cxx | 2 +- slideshow/source/engine/box2dtools.cxx | 36 ++++++++++++++-------------- slideshow/source/inc/box2dtools.hxx | 13 +++++----- 3 files changed, 26 insertions(+), 25 deletions(-) (limited to 'slideshow/source') diff --git a/slideshow/source/engine/animationfactory.cxx b/slideshow/source/engine/animationfactory.cxx index 7f5910cfb992..efc4587356dd 100644 --- a/slideshow/source/engine/animationfactory.cxx +++ b/slideshow/source/engine/animationfactory.cxx @@ -323,7 +323,7 @@ namespace slideshow::internal { mpShapeManager->notifyShapeUpdate( mpShape ); if ( mpBox2DWorld->isInitialized() ) - mpBox2DWorld->queuePositionUpdate( mpShape->getXShape(), rOutPos ); + mpBox2DWorld->queueDynamicPositionUpdate( mpShape->getXShape(), rOutPos ); } return true; diff --git a/slideshow/source/engine/box2dtools.cxx b/slideshow/source/engine/box2dtools.cxx index 6fa427c15c9a..f99e03bcd893 100644 --- a/slideshow/source/engine/box2dtools.cxx +++ b/slideshow/source/engine/box2dtools.cxx @@ -205,7 +205,7 @@ box2DWorld::box2DWorld(const ::basegfx::B2DVector& rSlideSize) , mbShapesInitialized(false) , mbHasWorldStepper(false) , mpXShapeToBodyMap() - , maShapeUpdateQueue() + , maShapeParallelUpdateQueue() { } @@ -307,9 +307,9 @@ void box2DWorld::setShapeCollision( void box2DWorld::processUpdateQueue(const double fPassedTime) { - while (!maShapeUpdateQueue.empty()) + while (!maShapeParallelUpdateQueue.empty()) { - Box2DShapeUpdateInformation& aQueueElement = maShapeUpdateQueue.front(); + Box2DDynamicUpdateInformation& aQueueElement = maShapeParallelUpdateQueue.front(); if (aQueueElement.mnDelayForSteps > 0) { @@ -340,7 +340,7 @@ void box2DWorld::processUpdateQueue(const double fPassedTime) case BOX2D_UPDATE_ANGULAR_VELOCITY: setShapeAngularVelocity(aQueueElement.mxShape, aQueueElement.mfAngularVelocity); } - maShapeUpdateQueue.pop(); + maShapeParallelUpdateQueue.pop(); } } } @@ -378,47 +378,47 @@ void box2DWorld::setHasWorldStepper(const bool bHasWorldStepper) mbHasWorldStepper = bHasWorldStepper; } -void box2DWorld::queuePositionUpdate( +void box2DWorld::queueDynamicPositionUpdate( const css::uno::Reference& xShape, const basegfx::B2DPoint& rOutPos) { - Box2DShapeUpdateInformation aQueueElement = { xShape, {}, BOX2D_UPDATE_POSITION }; + Box2DDynamicUpdateInformation aQueueElement = { xShape, {}, BOX2D_UPDATE_POSITION }; aQueueElement.maPosition = rOutPos; - maShapeUpdateQueue.push(aQueueElement); + maShapeParallelUpdateQueue.push(aQueueElement); } void box2DWorld::queueLinearVelocityUpdate( const css::uno::Reference& xShape, const basegfx::B2DVector& rVelocity) { - Box2DShapeUpdateInformation aQueueElement = { xShape, {}, BOX2D_UPDATE_LINEAR_VELOCITY, 1 }; + Box2DDynamicUpdateInformation aQueueElement = { xShape, {}, BOX2D_UPDATE_LINEAR_VELOCITY, 1 }; aQueueElement.maVelocity = rVelocity; - maShapeUpdateQueue.push(aQueueElement); + maShapeParallelUpdateQueue.push(aQueueElement); } -void box2DWorld::queueRotationUpdate( +void box2DWorld::queueDynamicRotationUpdate( const css::uno::Reference& xShape, const double fAngle) { - Box2DShapeUpdateInformation aQueueElement = { xShape, {}, BOX2D_UPDATE_ANGLE }; + Box2DDynamicUpdateInformation aQueueElement = { xShape, {}, BOX2D_UPDATE_ANGLE }; aQueueElement.mfAngle = fAngle; - maShapeUpdateQueue.push(aQueueElement); + maShapeParallelUpdateQueue.push(aQueueElement); } void box2DWorld::queueAngularVelocityUpdate( const css::uno::Reference& xShape, const double fAngularVelocity) { - Box2DShapeUpdateInformation aQueueElement = { xShape, {}, BOX2D_UPDATE_ANGULAR_VELOCITY, 1 }; + Box2DDynamicUpdateInformation aQueueElement = { xShape, {}, BOX2D_UPDATE_ANGULAR_VELOCITY, 1 }; aQueueElement.mfAngularVelocity = fAngularVelocity; - maShapeUpdateQueue.push(aQueueElement); + maShapeParallelUpdateQueue.push(aQueueElement); } void box2DWorld::queueShapeVisibilityUpdate( const css::uno::Reference& xShape, const bool bVisibility) { - Box2DShapeUpdateInformation aQueueElement = { xShape, {}, BOX2D_UPDATE_VISIBILITY }; + Box2DDynamicUpdateInformation aQueueElement = { xShape, {}, BOX2D_UPDATE_VISIBILITY }; aQueueElement.mbVisibility = bVisibility; - maShapeUpdateQueue.push(aQueueElement); + maShapeParallelUpdateQueue.push(aQueueElement); } void box2DWorld::queueShapeAnimationUpdate( @@ -432,11 +432,11 @@ void box2DWorld::queueShapeAnimationUpdate( queueShapeVisibilityUpdate(xShape, pAttrLayer->getVisibility()); return; case slideshow::internal::AttributeType::Rotate: - queueRotationUpdate(xShape, pAttrLayer->getRotationAngle()); + queueDynamicRotationUpdate(xShape, pAttrLayer->getRotationAngle()); return; case slideshow::internal::AttributeType::PosX: case slideshow::internal::AttributeType::PosY: - queuePositionUpdate(xShape, { pAttrLayer->getPosX(), pAttrLayer->getPosY() }); + queueDynamicPositionUpdate(xShape, { pAttrLayer->getPosX(), pAttrLayer->getPosY() }); return; default: return; diff --git a/slideshow/source/inc/box2dtools.hxx b/slideshow/source/inc/box2dtools.hxx index 474f01c60a63..c4113b931173 100644 --- a/slideshow/source/inc/box2dtools.hxx +++ b/slideshow/source/inc/box2dtools.hxx @@ -50,7 +50,7 @@ enum box2DNonsimulatedShapeUpdateType /// Holds required information to perform an update to box2d /// body of a shape that was altered by an animation effect -struct Box2DShapeUpdateInformation +struct Box2DDynamicUpdateInformation { css::uno::Reference mxShape; union { @@ -82,7 +82,7 @@ private: std::unordered_map, Box2DBodySharedPtr> mpXShapeToBodyMap; /// Holds any information needed to keep LO animations and Box2D world in sync - std::queue maShapeUpdateQueue; + std::queue maShapeParallelUpdateQueue; /// Creates a static frame in Box2D world that corresponds to the slide borders void createStaticFrameAroundSlide(const ::basegfx::B2DVector& rSlideSize); @@ -157,8 +157,9 @@ private: const int nPositionIterations = 2); /// Queue a rotation update on the next step of the box2DWorld for the corresponding body - void queueRotationUpdate(const css::uno::Reference& xShape, - const double fAngle); + void + queueDynamicRotationUpdate(const css::uno::Reference& xShape, + const double fAngle); /// Queue an angular velocity update for the corresponding body /// to take place after the next step of the box2DWorld @@ -226,8 +227,8 @@ public: void setHasWorldStepper(const bool bHasWorldStepper); /// Queue a position update the next step of the box2DWorld for the corresponding body - void queuePositionUpdate(const css::uno::Reference& xShape, - const ::basegfx::B2DPoint& rOutPos); + void queueDynamicPositionUpdate(const css::uno::Reference& xShape, + const ::basegfx::B2DPoint& rOutPos); /// Queue a linear velocity update for the corresponding body /// to take place after the next step of the box2DWorld -- cgit v1.2.3