From 81047eaebc0e25ff926bf944c57e082a8727c7f2 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Thu, 27 Jul 2017 12:26:38 +0100 Subject: make animation loop sal_uInt32 consistently all this foo is ultimately animated gifs and the count there is limited to unsigned 16bit Change-Id: Ib6e6dde7355f3619bb7735743e686e6338a235ee --- include/svtools/grfmgr.hxx | 2 +- include/vcl/animate.hxx | 8 ++++---- include/vcl/graph.hxx | 2 +- sd/source/ui/dlg/animobjs.cxx | 8 ++++---- slideshow/source/engine/shapes/drawshape.hxx | 2 +- slideshow/source/engine/shapes/gdimtftools.cxx | 2 +- slideshow/source/engine/shapes/gdimtftools.hxx | 6 +++--- slideshow/source/engine/shapes/intrinsicanimationactivity.cxx | 2 +- slideshow/source/engine/shapes/intrinsicanimationactivity.hxx | 2 +- vcl/inc/impgraph.hxx | 2 +- vcl/source/gdi/animate.cxx | 4 ++-- vcl/source/gdi/graph.cxx | 2 +- vcl/source/gdi/impgraph.cxx | 5 ++--- 13 files changed, 23 insertions(+), 24 deletions(-) diff --git a/include/svtools/grfmgr.hxx b/include/svtools/grfmgr.hxx index a6339128c479..4edde4dcb503 100644 --- a/include/svtools/grfmgr.hxx +++ b/include/svtools/grfmgr.hxx @@ -186,7 +186,7 @@ private: OUString maUserData; std::unique_ptr mxSwapOutTimer; std::unique_ptr mxSimpleCache; - sal_uLong mnAnimationLoopCount; + sal_uInt32 mnAnimationLoopCount; // a unique increasing ID to be able to say which data change is older sal_uLong mnDataChangeTimeStamp; diff --git a/include/vcl/animate.hxx b/include/vcl/animate.hxx index 119499629d36..bb8cc968c3ac 100644 --- a/include/vcl/animate.hxx +++ b/include/vcl/animate.hxx @@ -118,8 +118,8 @@ public: const BitmapEx& GetBitmapEx() const { return maBitmapEx; } void SetBitmapEx( const BitmapEx& rBmpEx ) { maBitmapEx = rBmpEx; } - sal_uLong GetLoopCount() const { return mnLoopCount; } - void SetLoopCount( const sal_uLong nLoopCount ); + sal_uInt32 GetLoopCount() const { return mnLoopCount; } + void SetLoopCount(const sal_uInt32 nLoopCount); void ResetLoopCount(); void SetNotifyHdl( const Link& rLink ) { maNotifyLink = rLink; } @@ -176,8 +176,8 @@ private: BitmapEx maBitmapEx; Timer maTimer; Size maGlobalSize; - long mnLoopCount; - long mnLoops; + sal_uInt32 mnLoopCount; + sal_uInt32 mnLoops; size_t mnPos; bool mbIsInAnimation; bool mbLoopTerminated; diff --git a/include/vcl/graph.hxx b/include/vcl/graph.hxx index 39fd594e878e..626b11bcddca 100644 --- a/include/vcl/graph.hxx +++ b/include/vcl/graph.hxx @@ -187,7 +187,7 @@ public: void SetAnimationNotifyHdl( const Link& rLink ); Link GetAnimationNotifyHdl() const; - sal_uLong GetAnimationLoopCount() const; + sal_uInt32 GetAnimationLoopCount() const; BitmapChecksum GetChecksum() const; diff --git a/sd/source/ui/dlg/animobjs.cxx b/sd/source/ui/dlg/animobjs.cxx index 4388395321d9..2ef96aa2de1c 100644 --- a/sd/source/ui/dlg/animobjs.cxx +++ b/sd/source/ui/dlg/animobjs.cxx @@ -744,7 +744,7 @@ void AnimationWindow::AddObj (::sd::View& rView ) // LoopCount if( i == 0 ) { - long nLoopCount = aAnimation.GetLoopCount(); + sal_uInt32 nLoopCount = aAnimation.GetLoopCount(); if( !nLoopCount ) // endless m_pLbLoopCount->SelectEntryPos( m_pLbLoopCount->GetEntryCount() - 1); @@ -980,11 +980,11 @@ void AnimationWindow::CreateAnimObj (::sd::View& rView ) // find LoopCount (number of passes) AnimationBitmap aAnimBmp; - long nLoopCount = 0L; - sal_Int32 nPos = m_pLbLoopCount->GetSelectEntryPos(); + sal_uInt32 nLoopCount = 0; + sal_Int32 nPos = m_pLbLoopCount->GetSelectEntryPos(); if( nPos != LISTBOX_ENTRY_NOTFOUND && nPos != m_pLbLoopCount->GetEntryCount() - 1 ) // endless - nLoopCount = (long) m_pLbLoopCount->GetSelectEntry().toInt32(); + nLoopCount = m_pLbLoopCount->GetSelectEntry().toUInt32(); aAnimBmp.aBmpEx = *pBitmapEx; aAnimBmp.aPosPix = aPt; diff --git a/slideshow/source/engine/shapes/drawshape.hxx b/slideshow/source/engine/shapes/drawshape.hxx index 7fb7cc225667..924727577e01 100644 --- a/slideshow/source/engine/shapes/drawshape.hxx +++ b/slideshow/source/engine/shapes/drawshape.hxx @@ -337,7 +337,7 @@ namespace slideshow int mnIsAnimatedCount; /// Number of times the bitmap animation shall loop - ::std::size_t mnAnimationLoopCount; + sal_uInt32 mnAnimationLoopCount; /// Whether shape is visible (without attribute layers) bool mbIsVisible; diff --git a/slideshow/source/engine/shapes/gdimtftools.cxx b/slideshow/source/engine/shapes/gdimtftools.cxx index 5cdd8d0095ed..3d7e643dfb7b 100644 --- a/slideshow/source/engine/shapes/gdimtftools.cxx +++ b/slideshow/source/engine/shapes/gdimtftools.cxx @@ -263,7 +263,7 @@ sal_Int32 getNextActionOffset( MetaAction * pCurrAct ) } bool getAnimationFromGraphic( VectorOfMtfAnimationFrames& o_rFrames, - ::std::size_t& o_rLoopCount, + sal_uInt32& o_rLoopCount, const Graphic& rGraphic ) { o_rFrames.clear(); diff --git a/slideshow/source/engine/shapes/gdimtftools.hxx b/slideshow/source/engine/shapes/gdimtftools.hxx index 861d3528ffa8..ac3989772e2f 100644 --- a/slideshow/source/engine/shapes/gdimtftools.hxx +++ b/slideshow/source/engine/shapes/gdimtftools.hxx @@ -112,9 +112,9 @@ namespace slideshow @param rGraphic Input graphic object, to extract animations from */ - bool getAnimationFromGraphic( VectorOfMtfAnimationFrames& o_rFrames, - ::std::size_t& o_rLoopCount, - const Graphic& rGraphic ); + bool getAnimationFromGraphic(VectorOfMtfAnimationFrames& o_rFrames, + sal_uInt32& o_rLoopCount, + const Graphic& rGraphic); /** Retrieve scroll text animation rectangles from given metafile diff --git a/slideshow/source/engine/shapes/intrinsicanimationactivity.cxx b/slideshow/source/engine/shapes/intrinsicanimationactivity.cxx index 15aca7471c0f..04016826e110 100644 --- a/slideshow/source/engine/shapes/intrinsicanimationactivity.cxx +++ b/slideshow/source/engine/shapes/intrinsicanimationactivity.cxx @@ -237,7 +237,7 @@ namespace slideshow const DrawShapeSharedPtr& rDrawShape, const WakeupEventSharedPtr& rWakeupEvent, const ::std::vector& rTimeouts, - ::std::size_t nNumLoops ) + sal_uInt32 nNumLoops) { return ActivitySharedPtr( new IntrinsicAnimationActivity(rContext, diff --git a/slideshow/source/engine/shapes/intrinsicanimationactivity.hxx b/slideshow/source/engine/shapes/intrinsicanimationactivity.hxx index 628a458cb728..c19c393a498d 100644 --- a/slideshow/source/engine/shapes/intrinsicanimationactivity.hxx +++ b/slideshow/source/engine/shapes/intrinsicanimationactivity.hxx @@ -60,7 +60,7 @@ namespace slideshow const DrawShapeSharedPtr& rDrawShape, const WakeupEventSharedPtr& rWakeupEvent, const ::std::vector& rTimeouts, - ::std::size_t nNumLoops ); + sal_uInt32 nNumLoops); } } diff --git a/vcl/inc/impgraph.hxx b/vcl/inc/impgraph.hxx index f5982f84cb2d..1dc5adc30ab5 100644 --- a/vcl/inc/impgraph.hxx +++ b/vcl/inc/impgraph.hxx @@ -115,7 +115,7 @@ private: void ImplSetAnimationNotifyHdl( const Link& rLink ); Link ImplGetAnimationNotifyHdl() const; - sal_uLong ImplGetAnimationLoopCount() const; + sal_uInt32 ImplGetAnimationLoopCount() const; private: diff --git a/vcl/source/gdi/animate.cxx b/vcl/source/gdi/animate.cxx index b7f335628aef..6b96cb971eca 100644 --- a/vcl/source/gdi/animate.cxx +++ b/vcl/source/gdi/animate.cxx @@ -510,7 +510,7 @@ void Animation::Replace( const AnimationBitmap& rNewAnimationBitmap, sal_uInt16 } } -void Animation::SetLoopCount( const sal_uLong nLoopCount ) +void Animation::SetLoopCount(const sal_uInt32 nLoopCount) { mnLoopCount = nLoopCount; ResetLoopCount(); @@ -767,7 +767,7 @@ SvStream& ReadAnimation( SvStream& rIStm, Animation& rAnimation ) rIStm.ReadUInt16( nTmp16 ); aAnimBmp.nWait = ( ( 65535 == nTmp16 ) ? ANIMATION_TIMEOUT_ON_CLICK : nTmp16 ); rIStm.ReadUInt16( nTmp16 ); aAnimBmp.eDisposal = ( Disposal) nTmp16; rIStm.ReadCharAsBool( cTmp ); aAnimBmp.bUserInput = cTmp; - rIStm.ReadUInt32( nTmp32 ); rAnimation.mnLoopCount = (sal_uInt16) nTmp32; + rIStm.ReadUInt32( rAnimation.mnLoopCount ); rIStm.ReadUInt32( nTmp32 ); // Unused rIStm.ReadUInt32( nTmp32 ); // Unused rIStm.ReadUInt32( nTmp32 ); // Unused diff --git a/vcl/source/gdi/graph.cxx b/vcl/source/gdi/graph.cxx index b36c5300f4d5..6452e08660fa 100644 --- a/vcl/source/gdi/graph.cxx +++ b/vcl/source/gdi/graph.cxx @@ -484,7 +484,7 @@ Link Graphic::GetAnimationNotifyHdl() const return mxImpGraphic->ImplGetAnimationNotifyHdl(); } -sal_uLong Graphic::GetAnimationLoopCount() const +sal_uInt32 Graphic::GetAnimationLoopCount() const { return mxImpGraphic->ImplGetAnimationLoopCount(); } diff --git a/vcl/source/gdi/impgraph.cxx b/vcl/source/gdi/impgraph.cxx index e782e71ebff3..812e504880ab 100644 --- a/vcl/source/gdi/impgraph.cxx +++ b/vcl/source/gdi/impgraph.cxx @@ -947,12 +947,11 @@ Link ImpGraphic::ImplGetAnimationNotifyHdl() const return aLink; } -sal_uLong ImpGraphic::ImplGetAnimationLoopCount() const +sal_uInt32 ImpGraphic::ImplGetAnimationLoopCount() const { - return( mpAnimation ? mpAnimation->GetLoopCount() : 0UL ); + return( mpAnimation ? mpAnimation->GetLoopCount() : 0 ); } - void ImpGraphic::ImplSetContext( const std::shared_ptr& pReader ) { mpContext = pReader; -- cgit