diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-02-05 14:16:28 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-02-05 14:43:11 +0100 |
commit | 5509d639d0b245415f647690619de5a5163ca620 (patch) | |
tree | e0374f0997f2155249ec0c6fca60caf40077d59a /slideshow | |
parent | ab99c08defad5431bbd0b456e3854d749ec0173e (diff) |
loplugin:flatten in slideshow
Change-Id: I826a43b36e35f9145c971b3608b6f56d27ff5f81
Reviewed-on: https://gerrit.libreoffice.org/67405
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'slideshow')
17 files changed, 575 insertions, 574 deletions
diff --git a/slideshow/source/engine/animatedsprite.cxx b/slideshow/source/engine/animatedsprite.cxx index 46379897168a..481a625afe7a 100644 --- a/slideshow/source/engine/animatedsprite.cxx +++ b/slideshow/source/engine/animatedsprite.cxx @@ -119,34 +119,34 @@ namespace slideshow bNeedResize = true; } - if( bNeedResize ) + if( !bNeedResize ) + return; + + // as the old sprite might have already been altered + // (and therefore been placed in the update list of + // the spritecanvas for this frame), must hide it + // here, to ensure it's not visible on screen any + // longer. + mpSprite->hide(); + + maEffectiveSpriteSizePixel = aNewSize; + mpSprite = mpViewLayer->createSprite( maEffectiveSpriteSizePixel, + mnSpritePrio ); + + ENSURE_OR_THROW( mpSprite, + "AnimatedSprite::resize(): Could not create new sprite" ); + + // set attributes similar to previous sprite + if (mbSpriteVisible) { - // as the old sprite might have already been altered - // (and therefore been placed in the update list of - // the spritecanvas for this frame), must hide it - // here, to ensure it's not visible on screen any - // longer. - mpSprite->hide(); - - maEffectiveSpriteSizePixel = aNewSize; - mpSprite = mpViewLayer->createSprite( maEffectiveSpriteSizePixel, - mnSpritePrio ); - - ENSURE_OR_THROW( mpSprite, - "AnimatedSprite::resize(): Could not create new sprite" ); - - // set attributes similar to previous sprite - if (mbSpriteVisible) - { - mpSprite->show(); - mpSprite->setAlpha( mnAlpha ); - - if( maPosPixel ) - mpSprite->movePixel( *maPosPixel ); - - if( maClip ) - mpSprite->setClip( *maClip ); - } + mpSprite->show(); + mpSprite->setAlpha( mnAlpha ); + + if( maPosPixel ) + mpSprite->movePixel( *maPosPixel ); + + if( maClip ) + mpSprite->setClip( *maClip ); } } diff --git a/slideshow/source/engine/animationfactory.cxx b/slideshow/source/engine/animationfactory.cxx index 38f3eb0825f8..4967bdc9c519 100644 --- a/slideshow/source/engine/animationfactory.cxx +++ b/slideshow/source/engine/animationfactory.cxx @@ -478,38 +478,38 @@ namespace slideshow // only stop animation once per repeated end() call, // and only if sprites are used for display - if( mbAnimationStarted ) - { - mbAnimationStarted = false; - - if( !(mnFlags & AnimationFactory::FLAG_NO_SPRITE) ) - mpShapeManager->leaveAnimationMode( mpShape ); - - // Attention, this notifyShapeUpdate() is - // somewhat delicate here. Calling it - // unconditional (i.e. not guarded by - // mbAnimationStarted) will lead to shapes - // snapping back to their original state just - // before the slide ends. Not calling it at - // all might swallow final animation - // states. The current implementation relies - // on the fact that end() is either called by - // the Activity (then, the last animation - // state has been set, and corresponds to the - // shape's hold state), or by the animation - // node (then, it's a forced end, and we - // _have_ to snap back). - - // To reiterate: normally, we're called from - // the Activity first, thus the - // notifyShapeUpdate() below will update to - // the last activity value. - - // force shape update, activity might have changed - // state in the last round. - if( mpShape->isContentChanged() ) - mpShapeManager->notifyShapeUpdate( mpShape ); - } + if( !mbAnimationStarted ) + return; + + mbAnimationStarted = false; + + if( !(mnFlags & AnimationFactory::FLAG_NO_SPRITE) ) + mpShapeManager->leaveAnimationMode( mpShape ); + + // Attention, this notifyShapeUpdate() is + // somewhat delicate here. Calling it + // unconditional (i.e. not guarded by + // mbAnimationStarted) will lead to shapes + // snapping back to their original state just + // before the slide ends. Not calling it at + // all might swallow final animation + // states. The current implementation relies + // on the fact that end() is either called by + // the Activity (then, the last animation + // state has been set, and corresponds to the + // shape's hold state), or by the animation + // node (then, it's a forced end, and we + // _have_ to snap back). + + // To reiterate: normally, we're called from + // the Activity first, thus the + // notifyShapeUpdate() below will update to + // the last activity value. + + // force shape update, activity might have changed + // state in the last round. + if( mpShape->isContentChanged() ) + mpShapeManager->notifyShapeUpdate( mpShape ); } // Derived Animation interface diff --git a/slideshow/source/engine/animationnodes/animationbasenode.cxx b/slideshow/source/engine/animationnodes/animationbasenode.cxx index a1b92517e549..c600be9830e6 100644 --- a/slideshow/source/engine/animationnodes/animationbasenode.cxx +++ b/slideshow/source/engine/animationnodes/animationbasenode.cxx @@ -327,30 +327,30 @@ void AnimationBaseNode::deactivate_st( NodeState eDestState ) } } - if (eDestState == ENDED) { + if (eDestState != ENDED) + return; - // no shape anymore, no layer needed: - maAttributeLayerHolder.reset(); + // no shape anymore, no layer needed: + maAttributeLayerHolder.reset(); - if (! isDependentSubsettedShape()) { + if (! isDependentSubsettedShape()) { - // for all other shapes, removing the - // attribute layer quite possibly changes - // shape display. Thus, force update - AttributableShapeSharedPtr const pShape( getShape() ); + // for all other shapes, removing the + // attribute layer quite possibly changes + // shape display. Thus, force update + AttributableShapeSharedPtr const pShape( getShape() ); - // don't anybody dare to check against - // pShape->isVisible() here, removing the - // attribute layer might actually make the - // shape invisible! - getContext().mpSubsettableShapeManager->notifyShapeUpdate( pShape ); - } + // don't anybody dare to check against + // pShape->isVisible() here, removing the + // attribute layer might actually make the + // shape invisible! + getContext().mpSubsettableShapeManager->notifyShapeUpdate( pShape ); + } - if (mpActivity) { - // kill activity, if still running - mpActivity->dispose(); - mpActivity.reset(); - } + if (mpActivity) { + // kill activity, if still running + mpActivity->dispose(); + mpActivity.reset(); } } diff --git a/slideshow/source/engine/animationnodes/basenode.cxx b/slideshow/source/engine/animationnodes/basenode.cxx index 2bd65ef7eef1..f47076e57ae1 100644 --- a/slideshow/source/engine/animationnodes/basenode.cxx +++ b/slideshow/source/engine/animationnodes/basenode.cxx @@ -593,21 +593,21 @@ void BaseNode::end() "end state not reachable in transition table" ); StateTransition st(this); - if (st.enter( ENDED, StateTransition::FORCE )) { + if (!st.enter( ENDED, StateTransition::FORCE )) + return; - deactivate_st( ENDED ); - st.commit(); // changing state + deactivate_st( ENDED ); + st.commit(); // changing state - // if is FROZEN or is to be FROZEN, then - // will/already notified deactivating listeners - if (!bIsFrozenOrInTransitionToFrozen) - notifyEndListeners(); + // if is FROZEN or is to be FROZEN, then + // will/already notified deactivating listeners + if (!bIsFrozenOrInTransitionToFrozen) + notifyEndListeners(); - // discharge a loaded event, before going on: - if (mpCurrentEvent) { - mpCurrentEvent->dispose(); - mpCurrentEvent.reset(); - } + // discharge a loaded event, before going on: + if (mpCurrentEvent) { + mpCurrentEvent->dispose(); + mpCurrentEvent.reset(); } } @@ -694,36 +694,36 @@ void BaseNode::showState() const // determine additional node information uno::Reference<animations::XAnimate> const xAnimate( mxAnimationNode, uno::UNO_QUERY ); - if( xAnimate.is() ) + if( !xAnimate.is() ) + return; + + uno::Reference< drawing::XShape > xTargetShape( xAnimate->getTarget(), + uno::UNO_QUERY ); + + if( !xTargetShape.is() ) { - uno::Reference< drawing::XShape > xTargetShape( xAnimate->getTarget(), - uno::UNO_QUERY ); + css::presentation::ParagraphTarget aTarget; - if( !xTargetShape.is() ) - { - css::presentation::ParagraphTarget aTarget; + // no shape provided. Maybe a ParagraphTarget? + if( xAnimate->getTarget() >>= aTarget ) + xTargetShape = aTarget.Shape; + } - // no shape provided. Maybe a ParagraphTarget? - if( xAnimate->getTarget() >>= aTarget ) - xTargetShape = aTarget.Shape; - } + if( !xTargetShape.is() ) + return; - if( xTargetShape.is() ) - { - uno::Reference< beans::XPropertySet > xPropSet( xTargetShape, - uno::UNO_QUERY ); - - // read shape name - OUString aName; - if( xPropSet->getPropertyValue("Name") >>= aName ) - { - SAL_INFO("slideshow.verbose", "Node info: n" << - debugGetNodeName(this) << - ", name \"" << - aName << - "\""); - } - } + uno::Reference< beans::XPropertySet > xPropSet( xTargetShape, + uno::UNO_QUERY ); + + // read shape name + OUString aName; + if( xPropSet->getPropertyValue("Name") >>= aName ) + { + SAL_INFO("slideshow.verbose", "Node info: n" << + debugGetNodeName(this) << + ", name \"" << + aName << + "\""); } } diff --git a/slideshow/source/engine/eventmultiplexer.cxx b/slideshow/source/engine/eventmultiplexer.cxx index fc0ff25803c0..07f7ddaa8af7 100644 --- a/slideshow/source/engine/eventmultiplexer.cxx +++ b/slideshow/source/engine/eventmultiplexer.cxx @@ -398,21 +398,21 @@ bool EventMultiplexerImpl::notifyAllAnimationHandlers( ImplAnimationHandlers con template <typename XSlideShowViewFunc> void EventMultiplexerImpl::forEachView( XSlideShowViewFunc pViewMethod ) { - if( pViewMethod ) + if( !pViewMethod ) + return; + + // (un)register mouse listener on all views + for( UnoViewVector::const_iterator aIter( mrViewContainer.begin() ), + aEnd( mrViewContainer.end() ); aIter != aEnd; ++aIter ) { - // (un)register mouse listener on all views - for( UnoViewVector::const_iterator aIter( mrViewContainer.begin() ), - aEnd( mrViewContainer.end() ); aIter != aEnd; ++aIter ) + uno::Reference<presentation::XSlideShowView> xView ((*aIter)->getUnoView()); + if (xView.is()) + { + (xView.get()->*pViewMethod)( mxListener.get() ); + } + else { - uno::Reference<presentation::XSlideShowView> xView ((*aIter)->getUnoView()); - if (xView.is()) - { - (xView.get()->*pViewMethod)( mxListener.get() ); - } - else - { - OSL_ASSERT(xView.is()); - } + OSL_ASSERT(xView.is()); } } } diff --git a/slideshow/source/engine/opengl/TransitionerImpl.cxx b/slideshow/source/engine/opengl/TransitionerImpl.cxx index f8af810f813b..461b00c0053f 100644 --- a/slideshow/source/engine/opengl/TransitionerImpl.cxx +++ b/slideshow/source/engine/opengl/TransitionerImpl.cxx @@ -371,20 +371,21 @@ void OGLTransitionerImpl::setSlides( const uno::Reference< rendering::XBitmap >& //pixmap of the non-opengl parent window. If any expose events occur around the start and end of //the transition then those windows are default filled by X with the desired start/end image so there's //no visible flash - if (SystemChildWindow* pChildWindow = mpContext->getChildWindow()) + SystemChildWindow* pChildWindow = mpContext->getChildWindow(); + if (!pChildWindow) + return; + + css::uno::Reference<css::beans::XFastPropertySet> xEnteringFastPropertySet(mxEnteringBitmap, css::uno::UNO_QUERY); + css::uno::Reference<css::beans::XFastPropertySet> xLeavingFastPropertySet(mxLeavingBitmap, css::uno::UNO_QUERY); + css::uno::Sequence<css::uno::Any> aEnteringBitmap; + css::uno::Sequence<css::uno::Any> aLeavingBitmap; + if (xEnteringFastPropertySet.get() && xLeavingFastPropertySet.get()) { - css::uno::Reference<css::beans::XFastPropertySet> xEnteringFastPropertySet(mxEnteringBitmap, css::uno::UNO_QUERY); - css::uno::Reference<css::beans::XFastPropertySet> xLeavingFastPropertySet(mxLeavingBitmap, css::uno::UNO_QUERY); - css::uno::Sequence<css::uno::Any> aEnteringBitmap; - css::uno::Sequence<css::uno::Any> aLeavingBitmap; - if (xEnteringFastPropertySet.get() && xLeavingFastPropertySet.get()) - { - xEnteringFastPropertySet->getFastPropertyValue(1) >>= aEnteringBitmap; - xLeavingFastPropertySet->getFastPropertyValue(1) >>= aLeavingBitmap; - } - if (aEnteringBitmap.getLength() == 3 && aLeavingBitmap.getLength() == 3) - pChildWindow->SetLeaveEnterBackgrounds(aLeavingBitmap, aEnteringBitmap); + xEnteringFastPropertySet->getFastPropertyValue(1) >>= aEnteringBitmap; + xLeavingFastPropertySet->getFastPropertyValue(1) >>= aLeavingBitmap; } + if (aEnteringBitmap.getLength() == 3 && aLeavingBitmap.getLength() == 3) + pChildWindow->SetLeaveEnterBackgrounds(aLeavingBitmap, aEnteringBitmap); } diff --git a/slideshow/source/engine/pointersymbol.cxx b/slideshow/source/engine/pointersymbol.cxx index 52c453e3eea6..7ba9a8b20c22 100644 --- a/slideshow/source/engine/pointersymbol.cxx +++ b/slideshow/source/engine/pointersymbol.cxx @@ -71,24 +71,24 @@ PointerSymbol::PointerSymbol( uno::Reference<rendering::XBitmap> const & xBitm void PointerSymbol::setVisible( const bool bVisible ) { - if( mbVisible != bVisible ) - { - mbVisible = bVisible; + if( mbVisible == bVisible ) + return; + + mbVisible = bVisible; - for( const auto& rView : maViews ) + for( const auto& rView : maViews ) + { + if( rView.second ) { - if( rView.second ) - { - if( bVisible ) - rView.second->show(); - else - rView.second->hide(); - } + if( bVisible ) + rView.second->show(); + else + rView.second->hide(); } - - // sprites changed, need a screen update for this frame. - mrScreenUpdater.requestImmediateUpdate(); } + + // sprites changed, need a screen update for this frame. + mrScreenUpdater.requestImmediateUpdate(); } basegfx::B2DPoint PointerSymbol::calcSpritePos(UnoViewSharedPtr const & rView) const @@ -176,20 +176,20 @@ void PointerSymbol::viewsChanged() void PointerSymbol::viewsChanged(const geometry::RealPoint2D pos) { - if( pos.X != maPos.X || pos.Y != maPos.Y ) - { - maPos = pos; + if( pos.X == maPos.X && pos.Y == maPos.Y ) + return; + + maPos = pos; - // reposition sprites on all views - for( const auto& rView : maViews ) + // reposition sprites on all views + for( const auto& rView : maViews ) + { + if( rView.second ) { - if( rView.second ) - { - rView.second->movePixel( - calcSpritePos( rView.first ) ); - mrScreenUpdater.notifyUpdate(); - mrScreenUpdater.commitUpdates(); - } + rView.second->movePixel( + calcSpritePos( rView.first ) ); + mrScreenUpdater.notifyUpdate(); + mrScreenUpdater.commitUpdates(); } } } diff --git a/slideshow/source/engine/rehearsetimingsactivity.cxx b/slideshow/source/engine/rehearsetimingsactivity.cxx index c1682a628ed4..42476891a567 100644 --- a/slideshow/source/engine/rehearsetimingsactivity.cxx +++ b/slideshow/source/engine/rehearsetimingsactivity.cxx @@ -387,19 +387,19 @@ void RehearseTimingsActivity::viewChanged( const UnoViewSharedPtr& rView ) void RehearseTimingsActivity::viewsChanged() { - if( !maViews.empty() ) - { - // new sprite pos, transformation might have changed: - maSpriteRectangle = calcSpriteRectangle( maViews.front().first ); + if( maViews.empty() ) + return; + + // new sprite pos, transformation might have changed: + maSpriteRectangle = calcSpriteRectangle( maViews.front().first ); - ::basegfx::B2DPoint nMin = maSpriteRectangle.getMinimum(); - // reposition sprites - for_each_sprite( [nMin]( const ::cppcanvas::CustomSpriteSharedPtr& pSprite ) - { return pSprite->move( nMin ); } ); + ::basegfx::B2DPoint nMin = maSpriteRectangle.getMinimum(); + // reposition sprites + for_each_sprite( [nMin]( const ::cppcanvas::CustomSpriteSharedPtr& pSprite ) + { return pSprite->move( nMin ); } ); - // sprites changed, need screen update - mrScreenUpdater.notifyUpdate(); - } + // sprites changed, need screen update + mrScreenUpdater.notifyUpdate(); } void RehearseTimingsActivity::paintAllSprites() const diff --git a/slideshow/source/engine/shapeattributelayer.cxx b/slideshow/source/engine/shapeattributelayer.cxx index 19817c01c10a..2816d33983a7 100644 --- a/slideshow/source/engine/shapeattributelayer.cxx +++ b/slideshow/source/engine/shapeattributelayer.cxx @@ -48,21 +48,21 @@ namespace slideshow */ void ShapeAttributeLayer::updateStateIds() { - if( haveChild() ) - { - if( mnTransformationState != mpChild->getTransformationState() ) - ++mnTransformationState; - if( mnClipState != mpChild->getClipState() ) - ++mnClipState; - if( mnAlphaState != mpChild->getAlphaState() ) - ++mnAlphaState; - if( mnPositionState != mpChild->getPositionState() ) - ++mnPositionState; - if( mnContentState != mpChild->getContentState() ) - ++mnContentState; - if( mnVisibilityState != mpChild->getVisibilityState() ) - ++mnVisibilityState; - } + if( !haveChild() ) + return; + + if( mnTransformationState != mpChild->getTransformationState() ) + ++mnTransformationState; + if( mnClipState != mpChild->getClipState() ) + ++mnClipState; + if( mnAlphaState != mpChild->getAlphaState() ) + ++mnAlphaState; + if( mnPositionState != mpChild->getPositionState() ) + ++mnPositionState; + if( mnContentState != mpChild->getContentState() ) + ++mnContentState; + if( mnVisibilityState != mpChild->getVisibilityState() ) + ++mnVisibilityState; } /** Calc attribute value. diff --git a/slideshow/source/engine/shapes/drawinglayeranimation.cxx b/slideshow/source/engine/shapes/drawinglayeranimation.cxx index c2aa3a695765..0ddbfc70b414 100644 --- a/slideshow/source/engine/shapes/drawinglayeranimation.cxx +++ b/slideshow/source/engine/shapes/drawinglayeranimation.cxx @@ -347,178 +347,178 @@ sal_uInt32 ActivityImpl::GetStepWidthLogic() const void ActivityImpl::ImpForceScrollTextAnimNodes() { - if(maVector.empty()) - { - // prepare values - sal_uInt32 nLoopTime; - double fZeroLogic, fOneLogic, fInitLogic, fDistanceLogic; - double fZeroLogicAlternate = 0.0, fOneLogicAlternate = 0.0; - double fZeroRelative, fOneRelative, fInitRelative; + if(!maVector.empty()) + return; - if(ScrollHorizontal()) + // prepare values + sal_uInt32 nLoopTime; + double fZeroLogic, fOneLogic, fInitLogic, fDistanceLogic; + double fZeroLogicAlternate = 0.0, fOneLogicAlternate = 0.0; + double fZeroRelative, fOneRelative, fInitRelative; + + if(ScrollHorizontal()) + { + if(DoAlternate()) { - if(DoAlternate()) + if(maPaintRectangleLogic.GetWidth() > + maScrollRectangleLogic.GetWidth()) { - if(maPaintRectangleLogic.GetWidth() > - maScrollRectangleLogic.GetWidth()) - { - fZeroLogicAlternate = maScrollRectangleLogic.Right() - maPaintRectangleLogic.GetWidth(); - fOneLogicAlternate = maScrollRectangleLogic.Left(); - } - else - { - fZeroLogicAlternate = maScrollRectangleLogic.Left(); - fOneLogicAlternate = maScrollRectangleLogic.Right() - maPaintRectangleLogic.GetWidth(); - } + fZeroLogicAlternate = maScrollRectangleLogic.Right() - maPaintRectangleLogic.GetWidth(); + fOneLogicAlternate = maScrollRectangleLogic.Left(); + } + else + { + fZeroLogicAlternate = maScrollRectangleLogic.Left(); + fOneLogicAlternate = maScrollRectangleLogic.Right() - maPaintRectangleLogic.GetWidth(); } - - fZeroLogic = maScrollRectangleLogic.Left() - maPaintRectangleLogic.GetWidth(); - fOneLogic = maScrollRectangleLogic.Right(); - fInitLogic = maPaintRectangleLogic.Left(); } - else + + fZeroLogic = maScrollRectangleLogic.Left() - maPaintRectangleLogic.GetWidth(); + fOneLogic = maScrollRectangleLogic.Right(); + fInitLogic = maPaintRectangleLogic.Left(); + } + else + { + if(DoAlternate()) { - if(DoAlternate()) + if(maPaintRectangleLogic.GetHeight() > maScrollRectangleLogic.GetHeight()) { - if(maPaintRectangleLogic.GetHeight() > maScrollRectangleLogic.GetHeight()) - { - fZeroLogicAlternate = maScrollRectangleLogic.Bottom() - maPaintRectangleLogic.GetHeight(); - fOneLogicAlternate = maScrollRectangleLogic.Top(); - } - else - { - fZeroLogicAlternate = maScrollRectangleLogic.Top(); - fOneLogicAlternate = maScrollRectangleLogic.Bottom() - maPaintRectangleLogic.GetHeight(); - } + fZeroLogicAlternate = maScrollRectangleLogic.Bottom() - maPaintRectangleLogic.GetHeight(); + fOneLogicAlternate = maScrollRectangleLogic.Top(); + } + else + { + fZeroLogicAlternate = maScrollRectangleLogic.Top(); + fOneLogicAlternate = maScrollRectangleLogic.Bottom() - maPaintRectangleLogic.GetHeight(); } - - fZeroLogic = maScrollRectangleLogic.Top() - maPaintRectangleLogic.GetHeight(); - fOneLogic = maScrollRectangleLogic.Bottom(); - fInitLogic = maPaintRectangleLogic.Top(); } - fDistanceLogic = fOneLogic - fZeroLogic; - fInitRelative = (fInitLogic - fZeroLogic) / fDistanceLogic; + fZeroLogic = maScrollRectangleLogic.Top() - maPaintRectangleLogic.GetHeight(); + fOneLogic = maScrollRectangleLogic.Bottom(); + fInitLogic = maPaintRectangleLogic.Top(); + } - if(DoAlternate()) + fDistanceLogic = fOneLogic - fZeroLogic; + fInitRelative = (fInitLogic - fZeroLogic) / fDistanceLogic; + + if(DoAlternate()) + { + fZeroRelative = + (fZeroLogicAlternate - fZeroLogic) / fDistanceLogic; + fOneRelative = + (fOneLogicAlternate - fZeroLogic) / fDistanceLogic; + } + else + { + fZeroRelative = 0.0; + fOneRelative = 1.0; + } + + if(mbVisibleWhenStarted) + { + double fRelativeStartValue, fRelativeEndValue,fRelativeDistance; + + if(DoScrollForward()) { - fZeroRelative = - (fZeroLogicAlternate - fZeroLogic) / fDistanceLogic; - fOneRelative = - (fOneLogicAlternate - fZeroLogic) / fDistanceLogic; + fRelativeStartValue = fInitRelative; + fRelativeEndValue = fOneRelative; + fRelativeDistance = fRelativeEndValue - fRelativeStartValue; } else { - fZeroRelative = 0.0; - fOneRelative = 1.0; + fRelativeStartValue = fInitRelative; + fRelativeEndValue = fZeroRelative; + fRelativeDistance = fRelativeStartValue - fRelativeEndValue; } - if(mbVisibleWhenStarted) - { - double fRelativeStartValue, fRelativeEndValue,fRelativeDistance; + const double fNumberSteps = + (fRelativeDistance * fDistanceLogic) / GetStepWidthLogic(); + nLoopTime = FRound(fNumberSteps * mnFrequency); - if(DoScrollForward()) - { - fRelativeStartValue = fInitRelative; - fRelativeEndValue = fOneRelative; - fRelativeDistance = fRelativeEndValue - fRelativeStartValue; - } - else - { - fRelativeStartValue = fInitRelative; - fRelativeEndValue = fZeroRelative; - fRelativeDistance = fRelativeStartValue - fRelativeEndValue; - } + // init loop + ScrollTextAnimNode aInitNode( + nLoopTime, 1, + fRelativeStartValue, fRelativeEndValue, + mnFrequency, false); + maVector.push_back(aInitNode); + } - const double fNumberSteps = - (fRelativeDistance * fDistanceLogic) / GetStepWidthLogic(); - nLoopTime = FRound(fNumberSteps * mnFrequency); + // prepare main loop values + { + double fRelativeStartValue, fRelativeEndValue, fRelativeDistance; - // init loop - ScrollTextAnimNode aInitNode( - nLoopTime, 1, - fRelativeStartValue, fRelativeEndValue, - mnFrequency, false); - maVector.push_back(aInitNode); + if(DoScrollForward()) + { + fRelativeStartValue = fZeroRelative; + fRelativeEndValue = fOneRelative; + fRelativeDistance = fRelativeEndValue - fRelativeStartValue; } - - // prepare main loop values + else { - double fRelativeStartValue, fRelativeEndValue, fRelativeDistance; - - if(DoScrollForward()) - { - fRelativeStartValue = fZeroRelative; - fRelativeEndValue = fOneRelative; - fRelativeDistance = fRelativeEndValue - fRelativeStartValue; - } - else - { - fRelativeStartValue = fOneRelative; - fRelativeEndValue = fZeroRelative; - fRelativeDistance = fRelativeStartValue - fRelativeEndValue; - } + fRelativeStartValue = fOneRelative; + fRelativeEndValue = fZeroRelative; + fRelativeDistance = fRelativeStartValue - fRelativeEndValue; + } - const double fNumberSteps = - (fRelativeDistance * fDistanceLogic) / GetStepWidthLogic(); - nLoopTime = FRound(fNumberSteps * mnFrequency); + const double fNumberSteps = + (fRelativeDistance * fDistanceLogic) / GetStepWidthLogic(); + nLoopTime = FRound(fNumberSteps * mnFrequency); - if(0 == mnRepeat) - { - if(!DoScrollIn()) - { - // endless main loop - ScrollTextAnimNode aMainNode( - nLoopTime, 0, - fRelativeStartValue, fRelativeEndValue, - mnFrequency, DoAlternate()); - maVector.push_back(aMainNode); - } - } - else + if(0 == mnRepeat) + { + if(!DoScrollIn()) { - sal_uInt32 nNumRepeat(mnRepeat); - - if(DoAlternate() && (nNumRepeat + 1) % 2L) - nNumRepeat += 1; - - // ending main loop + // endless main loop ScrollTextAnimNode aMainNode( - nLoopTime, nNumRepeat, + nLoopTime, 0, fRelativeStartValue, fRelativeEndValue, mnFrequency, DoAlternate()); maVector.push_back(aMainNode); } } - - if(mbVisibleWhenStopped) + else { - double fRelativeStartValue, fRelativeEndValue, fRelativeDistance; - - if(DoScrollForward()) - { - fRelativeStartValue = fZeroRelative; - fRelativeEndValue = fInitRelative; - fRelativeDistance = fRelativeEndValue - fRelativeStartValue; - } - else - { - fRelativeStartValue = fOneRelative; - fRelativeEndValue = fInitRelative; - fRelativeDistance = fRelativeStartValue - fRelativeEndValue; - } + sal_uInt32 nNumRepeat(mnRepeat); - const double fNumberSteps = - (fRelativeDistance * fDistanceLogic) / GetStepWidthLogic(); - nLoopTime = FRound(fNumberSteps * mnFrequency); + if(DoAlternate() && (nNumRepeat + 1) % 2L) + nNumRepeat += 1; - // exit loop - ScrollTextAnimNode aExitNode( - nLoopTime, 1, - fRelativeStartValue, fRelativeEndValue, mnFrequency, false); - maVector.push_back(aExitNode); + // ending main loop + ScrollTextAnimNode aMainNode( + nLoopTime, nNumRepeat, + fRelativeStartValue, fRelativeEndValue, + mnFrequency, DoAlternate()); + maVector.push_back(aMainNode); } } + + if(!mbVisibleWhenStopped) + return; + + double fRelativeStartValue, fRelativeEndValue, fRelativeDistance; + + if(DoScrollForward()) + { + fRelativeStartValue = fZeroRelative; + fRelativeEndValue = fInitRelative; + fRelativeDistance = fRelativeEndValue - fRelativeStartValue; + } + else + { + fRelativeStartValue = fOneRelative; + fRelativeEndValue = fInitRelative; + fRelativeDistance = fRelativeStartValue - fRelativeEndValue; + } + + const double fNumberSteps = + (fRelativeDistance * fDistanceLogic) / GetStepWidthLogic(); + nLoopTime = FRound(fNumberSteps * mnFrequency); + + // exit loop + ScrollTextAnimNode aExitNode( + nLoopTime, 1, + fRelativeStartValue, fRelativeEndValue, mnFrequency, false); + maVector.push_back(aExitNode); } ScrollTextAnimNode* ActivityImpl::ImpGetScrollTextAnimNode( @@ -849,37 +849,37 @@ bool ActivityImpl::enableAnimations() void ActivityImpl::dispose() { - if( !mbIsDisposed ) - { - end(); - - // only remove subset here, since end() is called on slide end - // (and we must not spoil the slide preview bitmap with scroll - // text) - maShapeAttrLayer.reset(); - if( mpDrawShape ) - { - // TODO(Q3): Doing this manually, instead of using - // ShapeSubset. This is because of lifetime issues - // (ShapeSubset generates circular references to parent - // shape) - DrawShapeSharedPtr pParent( mpParentDrawShape.lock() ); - if( pParent ) - maContext.mpSubsettableShapeManager->revokeSubset( - pParent, - mpDrawShape ); - } + if( mbIsDisposed ) + return; - mpMetaFile.reset(); - mpDrawShape.reset(); - mpParentDrawShape.reset(); - mpWakeupEvent.reset(); - maContext.dispose(); - mbIsDisposed = true; + end(); - maContext.mpSubsettableShapeManager->removeIntrinsicAnimationHandler( - mpListener ); + // only remove subset here, since end() is called on slide end + // (and we must not spoil the slide preview bitmap with scroll + // text) + maShapeAttrLayer.reset(); + if( mpDrawShape ) + { + // TODO(Q3): Doing this manually, instead of using + // ShapeSubset. This is because of lifetime issues + // (ShapeSubset generates circular references to parent + // shape) + DrawShapeSharedPtr pParent( mpParentDrawShape.lock() ); + if( pParent ) + maContext.mpSubsettableShapeManager->revokeSubset( + pParent, + mpDrawShape ); } + + mpMetaFile.reset(); + mpDrawShape.reset(); + mpParentDrawShape.reset(); + mpWakeupEvent.reset(); + maContext.dispose(); + mbIsDisposed = true; + + maContext.mpSubsettableShapeManager->removeIntrinsicAnimationHandler( + mpListener ); } double ActivityImpl::calcTimeLag() const diff --git a/slideshow/source/engine/shapes/drawshapesubsetting.cxx b/slideshow/source/engine/shapes/drawshapesubsetting.cxx index 4b140a36efcb..cca217a0a59c 100644 --- a/slideshow/source/engine/shapes/drawshapesubsetting.cxx +++ b/slideshow/source/engine/shapes/drawshapesubsetting.cxx @@ -219,20 +219,20 @@ namespace slideshow // would mean "non-subsetting" mode unconditionally, with whole object added to subsets. // So to indicate a subset with all parts excluded, add two empty subsets (starting and // ending). - if (maCurrentSubsets.empty()) + if (!maCurrentSubsets.empty()) + return; + + if (maSubset.isEmpty()) { - if (maSubset.isEmpty()) - { - maCurrentSubsets.emplace_back(0, 0); - maCurrentSubsets.emplace_back(maActionClassVector.size(), - maActionClassVector.size()); - } - else - { - maCurrentSubsets.emplace_back(maSubset.getStartIndex(), - maSubset.getStartIndex()); - maCurrentSubsets.emplace_back(maSubset.getEndIndex(), maSubset.getEndIndex()); - } + maCurrentSubsets.emplace_back(0, 0); + maCurrentSubsets.emplace_back(maActionClassVector.size(), + maActionClassVector.size()); + } + else + { + maCurrentSubsets.emplace_back(maSubset.getStartIndex(), + maSubset.getStartIndex()); + maCurrentSubsets.emplace_back(maSubset.getEndIndex(), maSubset.getEndIndex()); } } diff --git a/slideshow/source/engine/shapes/viewmediashape.cxx b/slideshow/source/engine/shapes/viewmediashape.cxx index f61c6dd598d9..71f4f727d7e8 100644 --- a/slideshow/source/engine/shapes/viewmediashape.cxx +++ b/slideshow/source/engine/shapes/viewmediashape.cxx @@ -332,39 +332,39 @@ namespace slideshow void ViewMediaShape::implSetMediaProperties( const uno::Reference< beans::XPropertySet >& rxProps ) { - if( mxPlayer.is() ) - { - mxPlayer->setMediaTime( 0.0 ); + if( !mxPlayer.is() ) + return; - if( rxProps.is() ) - { - bool bLoop( false ); - getPropertyValue( bLoop, - rxProps, - "Loop"); - mxPlayer->setPlaybackLoop( bLoop ); - - bool bMute( false ); - getPropertyValue( bMute, - rxProps, - "Mute"); - mxPlayer->setMute( bMute || !mbIsSoundEnabled); - - sal_Int16 nVolumeDB(0); - getPropertyValue( nVolumeDB, - rxProps, - "VolumeDB"); - mxPlayer->setVolumeDB( nVolumeDB ); - - if( mxPlayerWindow.is() ) - { - media::ZoomLevel eZoom(media::ZoomLevel_FIT_TO_WINDOW); - getPropertyValue( eZoom, - rxProps, - "Zoom"); - mxPlayerWindow->setZoomLevel( eZoom ); - } - } + mxPlayer->setMediaTime( 0.0 ); + + if( !rxProps.is() ) + return; + + bool bLoop( false ); + getPropertyValue( bLoop, + rxProps, + "Loop"); + mxPlayer->setPlaybackLoop( bLoop ); + + bool bMute( false ); + getPropertyValue( bMute, + rxProps, + "Mute"); + mxPlayer->setMute( bMute || !mbIsSoundEnabled); + + sal_Int16 nVolumeDB(0); + getPropertyValue( nVolumeDB, + rxProps, + "VolumeDB"); + mxPlayer->setVolumeDB( nVolumeDB ); + + if( mxPlayerWindow.is() ) + { + media::ZoomLevel eZoom(media::ZoomLevel_FIT_TO_WINDOW); + getPropertyValue( eZoom, + rxProps, + "Zoom"); + mxPlayerWindow->setZoomLevel( eZoom ); } } @@ -375,25 +375,25 @@ namespace slideshow (void) rMediaURL; (void) rMimeType; #else - if( !mxPlayer.is() ) + if( mxPlayer.is() ) + return; + + try { - try - { - if( !rMediaURL.isEmpty() ) - { - mxPlayer.set( avmedia::MediaWindow::createPlayer( rMediaURL, ""/*TODO!*/, &rMimeType ), - uno::UNO_QUERY ); - } - } - catch( uno::RuntimeException& ) - { - throw; - } - catch( const uno::Exception& ) + if( !rMediaURL.isEmpty() ) { - throw lang::NoSupportException( "No video support for " + rMediaURL ); + mxPlayer.set( avmedia::MediaWindow::createPlayer( rMediaURL, ""/*TODO!*/, &rMimeType ), + uno::UNO_QUERY ); } } + catch( uno::RuntimeException& ) + { + throw; + } + catch( const uno::Exception& ) + { + throw lang::NoSupportException( "No video support for " + rMediaURL ); + } #endif } @@ -403,88 +403,88 @@ namespace slideshow const OUString& ) { SAL_INFO("slideshow", "ViewMediaShape::implInitializePlayerWindow" ); - if( !mpMediaWindow.get() && !rBounds.isEmpty() ) + if( mpMediaWindow.get() || rBounds.isEmpty() ) + return; + + try { - try - { - sal_Int64 aVal=0; + sal_Int64 aVal=0; - rVCLDeviceParams[ 1 ] >>= aVal; + rVCLDeviceParams[ 1 ] >>= aVal; - vcl::Window* pWindow = reinterpret_cast< vcl::Window* >( aVal ); + vcl::Window* pWindow = reinterpret_cast< vcl::Window* >( aVal ); - if( pWindow ) + if( pWindow ) + { + ::basegfx::B2DRange aTmpRange; + ::canvas::tools::calcTransformedRectBounds( aTmpRange, + rBounds, + mpViewLayer->getTransformation() ); + const ::basegfx::B2IRange& rRangePix( + ::basegfx::unotools::b2ISurroundingRangeFromB2DRange( aTmpRange )); + + if( !rRangePix.isEmpty() ) { - ::basegfx::B2DRange aTmpRange; - ::canvas::tools::calcTransformedRectBounds( aTmpRange, - rBounds, - mpViewLayer->getTransformation() ); - const ::basegfx::B2IRange& rRangePix( - ::basegfx::unotools::b2ISurroundingRangeFromB2DRange( aTmpRange )); - - if( !rRangePix.isEmpty() ) + uno::Sequence< uno::Any > aArgs( 3 ); + awt::Rectangle aAWTRect( rRangePix.getMinX(), + rRangePix.getMinY(), + rRangePix.getMaxX() - rRangePix.getMinX(), + rRangePix.getMaxY() - rRangePix.getMinY() ); { - uno::Sequence< uno::Any > aArgs( 3 ); - awt::Rectangle aAWTRect( rRangePix.getMinX(), - rRangePix.getMinY(), - rRangePix.getMaxX() - rRangePix.getMinX(), - rRangePix.getMaxY() - rRangePix.getMinY() ); + mpMediaWindow.disposeAndClear(); + mpMediaWindow = VclPtr<SystemChildWindow>::Create( pWindow, WB_CLIPCHILDREN ); + UnoViewSharedPtr xUnoView(std::dynamic_pointer_cast<UnoView>(mpViewLayer)); + if (xUnoView) { - mpMediaWindow.disposeAndClear(); - mpMediaWindow = VclPtr<SystemChildWindow>::Create( pWindow, WB_CLIPCHILDREN ); - UnoViewSharedPtr xUnoView(std::dynamic_pointer_cast<UnoView>(mpViewLayer)); - if (xUnoView) - { - awt::Rectangle aCanvasArea = xUnoView->getUnoView()->getCanvasArea(); - aAWTRect.X += aCanvasArea.X; - aAWTRect.Y += aCanvasArea.Y; - } - mpMediaWindow->SetPosSizePixel( Point( aAWTRect.X, aAWTRect.Y ), - Size( aAWTRect.Width, aAWTRect.Height ) ); + awt::Rectangle aCanvasArea = xUnoView->getUnoView()->getCanvasArea(); + aAWTRect.X += aCanvasArea.X; + aAWTRect.Y += aCanvasArea.Y; } - mpMediaWindow->SetBackground( COL_BLACK ); - mpMediaWindow->SetParentClipMode( ParentClipMode::NoClip ); - mpMediaWindow->EnableEraseBackground( false ); - mpMediaWindow->EnablePaint( false ); - mpMediaWindow->SetForwardKey( true ); - mpMediaWindow->SetMouseTransparent( true ); - mpMediaWindow->Show(); - - if( mxPlayer.is() ) - { - aArgs[ 0 ] <<= - sal::static_int_cast< sal_IntPtr >( mpMediaWindow->GetParentWindowHandle() ); - - aAWTRect.X = aAWTRect.Y = 0; - aArgs[ 1 ] <<= aAWTRect; - aArgs[ 2 ] <<= reinterpret_cast< sal_IntPtr >( mpMediaWindow.get() ); + mpMediaWindow->SetPosSizePixel( Point( aAWTRect.X, aAWTRect.Y ), + Size( aAWTRect.Width, aAWTRect.Height ) ); + } + mpMediaWindow->SetBackground( COL_BLACK ); + mpMediaWindow->SetParentClipMode( ParentClipMode::NoClip ); + mpMediaWindow->EnableEraseBackground( false ); + mpMediaWindow->EnablePaint( false ); + mpMediaWindow->SetForwardKey( true ); + mpMediaWindow->SetMouseTransparent( true ); + mpMediaWindow->Show(); + + if( mxPlayer.is() ) + { + aArgs[ 0 ] <<= + sal::static_int_cast< sal_IntPtr >( mpMediaWindow->GetParentWindowHandle() ); - mxPlayerWindow.set( mxPlayer->createPlayerWindow( aArgs ) ); + aAWTRect.X = aAWTRect.Y = 0; + aArgs[ 1 ] <<= aAWTRect; + aArgs[ 2 ] <<= reinterpret_cast< sal_IntPtr >( mpMediaWindow.get() ); - if( mxPlayerWindow.is() ) - { - mxPlayerWindow->setVisible( true ); - mxPlayerWindow->setEnable( true ); - } - } + mxPlayerWindow.set( mxPlayer->createPlayerWindow( aArgs ) ); - if( !mxPlayerWindow.is() ) + if( mxPlayerWindow.is() ) { - //if there was no playerwindow, then clear the mpMediaWindow too - //so that we can draw a placeholder instead in that space - mpMediaWindow.disposeAndClear(); + mxPlayerWindow->setVisible( true ); + mxPlayerWindow->setEnable( true ); } } + + if( !mxPlayerWindow.is() ) + { + //if there was no playerwindow, then clear the mpMediaWindow too + //so that we can draw a placeholder instead in that space + mpMediaWindow.disposeAndClear(); + } } } - catch( uno::RuntimeException& ) - { - throw; - } - catch( uno::Exception& ) - { - SAL_WARN( "slideshow", comphelper::anyToString( cppu::getCaughtException() ) ); - } + } + catch( uno::RuntimeException& ) + { + throw; + } + catch( uno::Exception& ) + { + SAL_WARN( "slideshow", comphelper::anyToString( cppu::getCaughtException() ) ); } } } diff --git a/slideshow/source/engine/slide/layermanager.cxx b/slideshow/source/engine/slide/layermanager.cxx index b5235840c0a8..2fa5a139151e 100644 --- a/slideshow/source/engine/slide/layermanager.cxx +++ b/slideshow/source/engine/slide/layermanager.cxx @@ -664,27 +664,27 @@ namespace slideshow const LayerShapeMap::const_iterator& aEndLayerShapes ) { const bool bLayerExists( maLayers.size() > nCurrLayerIndex ); - if( bLayerExists ) - { - const LayerSharedPtr& rLayer( maLayers.at(nCurrLayerIndex) ); - const bool bLayerResized( rLayer->commitBounds() ); - rLayer->setPriority( basegfx::B1DRange(nCurrLayerIndex, - nCurrLayerIndex+1) ); + if( !bLayerExists ) + return; - if( bLayerResized ) - { - // need to re-render whole layer - start from - // clean state - rLayer->clearContent(); + const LayerSharedPtr& rLayer( maLayers.at(nCurrLayerIndex) ); + const bool bLayerResized( rLayer->commitBounds() ); + rLayer->setPriority( basegfx::B1DRange(nCurrLayerIndex, + nCurrLayerIndex+1) ); - // render and remove from update set - while( aFirstLayerShape != aEndLayerShapes ) - { - maUpdateShapes.erase(aFirstLayerShape->first); - aFirstLayerShape->first->render(); - ++aFirstLayerShape; - } - } + if( !bLayerResized ) + return; + + // need to re-render whole layer - start from + // clean state + rLayer->clearContent(); + + // render and remove from update set + while( aFirstLayerShape != aEndLayerShapes ) + { + maUpdateShapes.erase(aFirstLayerShape->first); + aFirstLayerShape->first->render(); + ++aFirstLayerShape; } } diff --git a/slideshow/source/engine/slide/shapemanagerimpl.cxx b/slideshow/source/engine/slide/shapemanagerimpl.cxx index e6a3bea58c1e..d498e50cf90f 100644 --- a/slideshow/source/engine/slide/shapemanagerimpl.cxx +++ b/slideshow/source/engine/slide/shapemanagerimpl.cxx @@ -51,46 +51,46 @@ ShapeManagerImpl::ShapeManagerImpl( EventMultiplexer& rMultiplexer, void ShapeManagerImpl::activate() { - if( !mbEnabled ) - { - mbEnabled = true; + if( mbEnabled ) + return; - // register this handler on EventMultiplexer. - // Higher prio (overrides other engine handlers) - mrMultiplexer.addMouseMoveHandler( shared_from_this(), 2.0 ); - mrMultiplexer.addClickHandler( shared_from_this(), 2.0 ); - mrMultiplexer.addShapeListenerHandler( shared_from_this() ); + mbEnabled = true; - // clone listener map - uno::Reference<presentation::XShapeEventListener> xDummyListener; - for( const auto& rListener : mrGlobalListenersMap ) - listenerAdded( xDummyListener, rListener.first ); + // register this handler on EventMultiplexer. + // Higher prio (overrides other engine handlers) + mrMultiplexer.addMouseMoveHandler( shared_from_this(), 2.0 ); + mrMultiplexer.addClickHandler( shared_from_this(), 2.0 ); + mrMultiplexer.addShapeListenerHandler( shared_from_this() ); - // clone cursor map - for( const auto& rListener : mrGlobalCursorMap ) - cursorChanged( rListener.first, rListener.second ); + // clone listener map + uno::Reference<presentation::XShapeEventListener> xDummyListener; + for( const auto& rListener : mrGlobalListenersMap ) + listenerAdded( xDummyListener, rListener.first ); - if( mpLayerManager ) - mpLayerManager->activate(); - } + // clone cursor map + for( const auto& rListener : mrGlobalCursorMap ) + cursorChanged( rListener.first, rListener.second ); + + if( mpLayerManager ) + mpLayerManager->activate(); } void ShapeManagerImpl::deactivate() { - if( mbEnabled ) - { - mbEnabled = false; + if( !mbEnabled ) + return; + + mbEnabled = false; - if( mpLayerManager ) - mpLayerManager->deactivate(); + if( mpLayerManager ) + mpLayerManager->deactivate(); - maShapeListenerMap.clear(); - maShapeCursorMap.clear(); + maShapeListenerMap.clear(); + maShapeCursorMap.clear(); - mrMultiplexer.removeShapeListenerHandler( shared_from_this() ); - mrMultiplexer.removeMouseMoveHandler( shared_from_this() ); - mrMultiplexer.removeClickHandler( shared_from_this() ); - } + mrMultiplexer.removeShapeListenerHandler( shared_from_this() ); + mrMultiplexer.removeMouseMoveHandler( shared_from_this() ); + mrMultiplexer.removeClickHandler( shared_from_this() ); } void ShapeManagerImpl::dispose() diff --git a/slideshow/source/engine/slide/slideanimations.cxx b/slideshow/source/engine/slide/slideanimations.cxx index 8c6be3eeb99f..2264b4600f56 100644 --- a/slideshow/source/engine/slide/slideanimations.cxx +++ b/slideshow/source/engine/slide/slideanimations.cxx @@ -45,18 +45,18 @@ namespace slideshow SlideAnimations::~SlideAnimations() COVERITY_NOEXCEPT_FALSE { - if( mpRootNode ) + if( !mpRootNode ) + return; + + SHOW_NODE_TREE( mpRootNode ); + + try + { + mpRootNode->dispose(); + } + catch (uno::Exception &) { - SHOW_NODE_TREE( mpRootNode ); - - try - { - mpRootNode->dispose(); - } - catch (uno::Exception &) - { - SAL_WARN( "slideshow", comphelper::anyToString(cppu::getCaughtException() ) ); - } + SAL_WARN( "slideshow", comphelper::anyToString(cppu::getCaughtException() ) ); } } diff --git a/slideshow/source/engine/transitions/slidechangebase.cxx b/slideshow/source/engine/transitions/slidechangebase.cxx index 2bbec99404f3..1e6e40a6bc6a 100644 --- a/slideshow/source/engine/transitions/slidechangebase.cxx +++ b/slideshow/source/engine/transitions/slidechangebase.cxx @@ -148,24 +148,24 @@ void SlideChangeBase::renderBitmap( SlideBitmapSharedPtr const & pSlideBitmap, cppcanvas::CanvasSharedPtr const & pCanvas ) { - if( pSlideBitmap && pCanvas ) - { - // need to render without any transformation (we - // assume device units): - const basegfx::B2DHomMatrix viewTransform( - pCanvas->getTransformation() ); - const basegfx::B2DPoint pageOrigin( - viewTransform * basegfx::B2DPoint() ); - const cppcanvas::CanvasSharedPtr pDevicePixelCanvas( - pCanvas->clone() ); - - // render at output position, don't modify bitmap object (no move!): - const basegfx::B2DHomMatrix transform(basegfx::utils::createTranslateB2DHomMatrix( - pageOrigin.getX(), pageOrigin.getY())); - - pDevicePixelCanvas->setTransformation( transform ); - pSlideBitmap->draw( pDevicePixelCanvas ); - } + if( !(pSlideBitmap && pCanvas) ) + return; + + // need to render without any transformation (we + // assume device units): + const basegfx::B2DHomMatrix viewTransform( + pCanvas->getTransformation() ); + const basegfx::B2DPoint pageOrigin( + viewTransform * basegfx::B2DPoint() ); + const cppcanvas::CanvasSharedPtr pDevicePixelCanvas( + pCanvas->clone() ); + + // render at output position, don't modify bitmap object (no move!): + const basegfx::B2DHomMatrix transform(basegfx::utils::createTranslateB2DHomMatrix( + pageOrigin.getX(), pageOrigin.getY())); + + pDevicePixelCanvas->setTransformation( transform ); + pSlideBitmap->draw( pDevicePixelCanvas ); } void SlideChangeBase::prefetch( const AnimatableShapeSharedPtr&, diff --git a/slideshow/source/engine/waitsymbol.cxx b/slideshow/source/engine/waitsymbol.cxx index b232f42aa5b5..436d058cf598 100644 --- a/slideshow/source/engine/waitsymbol.cxx +++ b/slideshow/source/engine/waitsymbol.cxx @@ -73,24 +73,24 @@ WaitSymbol::WaitSymbol( uno::Reference<rendering::XBitmap> const & xBitmap, void WaitSymbol::setVisible( const bool bVisible ) { - if( mbVisible != bVisible ) - { - mbVisible = bVisible; + if( mbVisible == bVisible ) + return; - for( const auto& rView : maViews ) + mbVisible = bVisible; + + for( const auto& rView : maViews ) + { + if( rView.second ) { - if( rView.second ) - { - if( bVisible ) - rView.second->show(); - else - rView.second->hide(); - } + if( bVisible ) + rView.second->show(); + else + rView.second->hide(); } - - // sprites changed, need a screen update for this frame. - mrScreenUpdater.requestImmediateUpdate(); } + + // sprites changed, need a screen update for this frame. + mrScreenUpdater.requestImmediateUpdate(); } basegfx::B2DPoint WaitSymbol::calcSpritePos( |