summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2019-04-27 21:48:24 +0900
committerTomaž Vajngerl <quikee@gmail.com>2019-04-28 05:29:54 +0200
commit9afa666120d8bb045f3569a77475a58c368c03a1 (patch)
treeed2a880b48b754f6419376b29812f1644507af1f /vcl
parent5c3ae69f03eee5deddcaa4673b4fbab062f6c66a (diff)
move Animation, AnimationBitmap out from clang-format blacklist
Change-Id: I95fd2d4e164bf04c4457b3e20401270227e21a8f Reviewed-on: https://gerrit.libreoffice.org/71424 Reviewed-by: Tomaž Vajngerl <quikee@gmail.com> Tested-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'vcl')
-rw-r--r--vcl/source/animate/Animation.cxx486
-rw-r--r--vcl/source/animate/AnimationBitmap.cxx32
2 files changed, 253 insertions, 265 deletions
diff --git a/vcl/source/animate/Animation.cxx b/vcl/source/animate/Animation.cxx
index 54582eaf40ff..12d9ae60d07c 100644
--- a/vcl/source/animate/Animation.cxx
+++ b/vcl/source/animate/Animation.cxx
@@ -34,46 +34,45 @@
sal_uLong Animation::mnAnimCount = 0;
-Animation::Animation() :
- mnLoopCount ( 0 ),
- mnLoops ( 0 ),
- mnPos ( 0 ),
- mbIsInAnimation ( false ),
- mbLoopTerminated ( false )
+Animation::Animation()
+ : mnLoopCount(0)
+ , mnLoops(0)
+ , mnPos(0)
+ , mbIsInAnimation(false)
+ , mbLoopTerminated(false)
{
- maTimer.SetInvokeHandler( LINK( this, Animation, ImplTimeoutHdl ) );
+ maTimer.SetInvokeHandler(LINK(this, Animation, ImplTimeoutHdl));
}
-Animation::Animation( const Animation& rAnimation ) :
- maBitmapEx ( rAnimation.maBitmapEx ),
- maGlobalSize ( rAnimation.maGlobalSize ),
- mnLoopCount ( rAnimation.mnLoopCount ),
- mnPos ( rAnimation.mnPos ),
- mbIsInAnimation ( false ),
- mbLoopTerminated ( rAnimation.mbLoopTerminated )
+Animation::Animation(const Animation& rAnimation)
+ : maBitmapEx(rAnimation.maBitmapEx)
+ , maGlobalSize(rAnimation.maGlobalSize)
+ , mnLoopCount(rAnimation.mnLoopCount)
+ , mnPos(rAnimation.mnPos)
+ , mbIsInAnimation(false)
+ , mbLoopTerminated(rAnimation.mbLoopTerminated)
{
+ for (auto const& i : rAnimation.maList)
+ maList.emplace_back(new AnimationBitmap(*i));
- for(auto const & i : rAnimation.maList)
- maList.emplace_back( new AnimationBitmap( *i ) );
-
- maTimer.SetInvokeHandler( LINK( this, Animation, ImplTimeoutHdl ) );
+ maTimer.SetInvokeHandler(LINK(this, Animation, ImplTimeoutHdl));
mnLoops = mbLoopTerminated ? 0 : mnLoopCount;
}
Animation::~Animation()
{
- if( mbIsInAnimation )
+ if (mbIsInAnimation)
Stop();
}
-Animation& Animation::operator=( const Animation& rAnimation )
+Animation& Animation::operator=(const Animation& rAnimation)
{
if (this != &rAnimation)
{
Clear();
- for(auto const & i : rAnimation.maList)
- maList.emplace_back( new AnimationBitmap( *i ) );
+ for (auto const& i : rAnimation.maList)
+ maList.emplace_back(new AnimationBitmap(*i));
maGlobalSize = rAnimation.maGlobalSize;
maBitmapEx = rAnimation.maBitmapEx;
@@ -85,21 +84,19 @@ Animation& Animation::operator=( const Animation& rAnimation )
return *this;
}
-bool Animation::operator==( const Animation& rAnimation ) const
+bool Animation::operator==(const Animation& rAnimation) const
{
const size_t nCount = maList.size();
bool bRet = false;
- if( rAnimation.maList.size() == nCount
- && rAnimation.maBitmapEx == maBitmapEx
- && rAnimation.maGlobalSize == maGlobalSize
- )
+ if (rAnimation.maList.size() == nCount && rAnimation.maBitmapEx == maBitmapEx
+ && rAnimation.maGlobalSize == maGlobalSize)
{
bRet = true;
- for( size_t n = 0; n < nCount; n++ )
+ for (size_t n = 0; n < nCount; n++)
{
- if( ( *maList[ n ] ) != ( *rAnimation.maList[ n ] ) )
+ if ((*maList[n]) != (*rAnimation.maList[n]))
{
bRet = false;
break;
@@ -122,25 +119,24 @@ void Animation::Clear()
bool Animation::IsTransparent() const
{
- tools::Rectangle aRect( Point(), maGlobalSize );
- bool bRet = false;
+ tools::Rectangle aRect(Point(), maGlobalSize);
+ bool bRet = false;
// If some small bitmap needs to be replaced by the background,
// we need to be transparent, in order to be displayed correctly
// as the application (?) does not invalidate on non-transparent
// graphics due to performance reasons.
- for(auto const & pAnimBmp : maList)
+ for (auto const& pAnimBmp : maList)
{
- if( Disposal::Back == pAnimBmp->eDisposal
- && tools::Rectangle( pAnimBmp->aPosPix, pAnimBmp->aSizePix ) != aRect
- )
+ if (Disposal::Back == pAnimBmp->eDisposal
+ && tools::Rectangle(pAnimBmp->aPosPix, pAnimBmp->aSizePix) != aRect)
{
bRet = true;
break;
}
}
- if( !bRet )
+ if (!bRet)
bRet = maBitmapEx.IsTransparent();
return bRet;
@@ -150,7 +146,7 @@ sal_uLong Animation::GetSizeBytes() const
{
sal_uLong nSizeBytes = GetBitmapEx().GetSizeBytes();
- for(auto const & pAnimBmp : maList)
+ for (auto const& pAnimBmp : maList)
{
nSizeBytes += pAnimBmp->aBmpEx.GetSizeBytes();
}
@@ -160,57 +156,55 @@ sal_uLong Animation::GetSizeBytes() const
BitmapChecksum Animation::GetChecksum() const
{
- SVBT32 aBT32;
+ SVBT32 aBT32;
BitmapChecksumOctetArray aBCOA;
- BitmapChecksum nCrc = GetBitmapEx().GetChecksum();
+ BitmapChecksum nCrc = GetBitmapEx().GetChecksum();
- UInt32ToSVBT32( maList.size(), aBT32 );
- nCrc = vcl_get_checksum( nCrc, aBT32, 4 );
+ UInt32ToSVBT32(maList.size(), aBT32);
+ nCrc = vcl_get_checksum(nCrc, aBT32, 4);
- Int32ToSVBT32( maGlobalSize.Width(), aBT32 );
- nCrc = vcl_get_checksum( nCrc, aBT32, 4 );
+ Int32ToSVBT32(maGlobalSize.Width(), aBT32);
+ nCrc = vcl_get_checksum(nCrc, aBT32, 4);
- Int32ToSVBT32( maGlobalSize.Height(), aBT32 );
- nCrc = vcl_get_checksum( nCrc, aBT32, 4 );
+ Int32ToSVBT32(maGlobalSize.Height(), aBT32);
+ nCrc = vcl_get_checksum(nCrc, aBT32, 4);
- for(auto const & i : maList)
+ for (auto const& i : maList)
{
- BCToBCOA( i->GetChecksum(), aBCOA );
- nCrc = vcl_get_checksum( nCrc, aBCOA, BITMAP_CHECKSUM_SIZE );
+ BCToBCOA(i->GetChecksum(), aBCOA);
+ nCrc = vcl_get_checksum(nCrc, aBCOA, BITMAP_CHECKSUM_SIZE);
}
return nCrc;
}
-bool Animation::Start( OutputDevice* pOut, const Point& rDestPt, const Size& rDestSz, long nExtraData,
- OutputDevice* pFirstFrameOutDev )
+bool Animation::Start(OutputDevice* pOut, const Point& rDestPt, const Size& rDestSz,
+ long nExtraData, OutputDevice* pFirstFrameOutDev)
{
bool bRet = false;
- if( !maList.empty() )
+ if (!maList.empty())
{
- if( ( pOut->GetOutDevType() == OUTDEV_WINDOW )
- && !mbLoopTerminated
- && ( ANIMATION_TIMEOUT_ON_CLICK != maList[ mnPos ]->nWait )
- )
+ if ((pOut->GetOutDevType() == OUTDEV_WINDOW) && !mbLoopTerminated
+ && (ANIMATION_TIMEOUT_ON_CLICK != maList[mnPos]->nWait))
{
- ImplAnimView* pView;
- ImplAnimView* pMatch = nullptr;
+ ImplAnimView* pView;
+ ImplAnimView* pMatch = nullptr;
- for( size_t i = 0; i < maViewList.size(); ++i )
+ for (size_t i = 0; i < maViewList.size(); ++i)
{
- pView = maViewList[ i ].get();
- if( pView->matches( pOut, nExtraData ) )
+ pView = maViewList[i].get();
+ if (pView->matches(pOut, nExtraData))
{
- if( pView->getOutPos() == rDestPt &&
- pView->getOutSizePix() == pOut->LogicToPixel( rDestSz ) )
+ if (pView->getOutPos() == rDestPt
+ && pView->getOutSizePix() == pOut->LogicToPixel(rDestSz))
{
pView->repaint();
pMatch = pView;
}
else
{
- maViewList.erase( maViewList.begin() + i );
+ maViewList.erase(maViewList.begin() + i);
pView = nullptr;
}
@@ -218,24 +212,25 @@ bool Animation::Start( OutputDevice* pOut, const Point& rDestPt, const Size& rDe
}
}
- if( maViewList.empty() )
+ if (maViewList.empty())
{
maTimer.Stop();
mbIsInAnimation = false;
mnPos = 0;
}
- if( !pMatch )
- maViewList.emplace_back( new ImplAnimView( this, pOut, rDestPt, rDestSz, nExtraData, pFirstFrameOutDev ) );
+ if (!pMatch)
+ maViewList.emplace_back(
+ new ImplAnimView(this, pOut, rDestPt, rDestSz, nExtraData, pFirstFrameOutDev));
- if( !mbIsInAnimation )
+ if (!mbIsInAnimation)
{
- ImplRestartTimer( maList[ mnPos ]->nWait );
+ ImplRestartTimer(maList[mnPos]->nWait);
mbIsInAnimation = true;
}
}
else
- Draw( pOut, rDestPt, rDestSz );
+ Draw(pOut, rDestPt, rDestSz);
bRet = true;
}
@@ -243,110 +238,108 @@ bool Animation::Start( OutputDevice* pOut, const Point& rDestPt, const Size& rDe
return bRet;
}
-void Animation::Stop( OutputDevice* pOut, long nExtraData )
+void Animation::Stop(OutputDevice* pOut, long nExtraData)
{
- for( size_t i = 0; i < maViewList.size(); )
+ for (size_t i = 0; i < maViewList.size();)
{
- ImplAnimView* pView = maViewList[ i ].get();
- if( pView->matches( pOut, nExtraData ) )
+ ImplAnimView* pView = maViewList[i].get();
+ if (pView->matches(pOut, nExtraData))
{
- maViewList.erase( maViewList.begin() + i );
+ maViewList.erase(maViewList.begin() + i);
}
else
i++;
}
- if( maViewList.empty() )
+ if (maViewList.empty())
{
maTimer.Stop();
mbIsInAnimation = false;
}
}
-void Animation::Draw( OutputDevice* pOut, const Point& rDestPt ) const
+void Animation::Draw(OutputDevice* pOut, const Point& rDestPt) const
{
- Draw( pOut, rDestPt, pOut->PixelToLogic( maGlobalSize ) );
+ Draw(pOut, rDestPt, pOut->PixelToLogic(maGlobalSize));
}
-void Animation::Draw( OutputDevice* pOut, const Point& rDestPt, const Size& rDestSz ) const
+void Animation::Draw(OutputDevice* pOut, const Point& rDestPt, const Size& rDestSz) const
{
const size_t nCount = maList.size();
- if( nCount )
+ if (nCount)
{
- AnimationBitmap* pObj = maList[ std::min( mnPos, nCount - 1 ) ].get();
-
- if( pOut->GetConnectMetaFile()
- || ( pOut->GetOutDevType() == OUTDEV_PRINTER )
- )
- maList[ 0 ]->aBmpEx.Draw( pOut, rDestPt, rDestSz );
- else if( ANIMATION_TIMEOUT_ON_CLICK == pObj->nWait )
- pObj->aBmpEx.Draw( pOut, rDestPt, rDestSz );
+ AnimationBitmap* pObj = maList[std::min(mnPos, nCount - 1)].get();
+
+ if (pOut->GetConnectMetaFile() || (pOut->GetOutDevType() == OUTDEV_PRINTER))
+ maList[0]->aBmpEx.Draw(pOut, rDestPt, rDestSz);
+ else if (ANIMATION_TIMEOUT_ON_CLICK == pObj->nWait)
+ pObj->aBmpEx.Draw(pOut, rDestPt, rDestSz);
else
{
const size_t nOldPos = mnPos;
- const_cast<Animation*>(this)->mnPos = mbLoopTerminated ? ( nCount - 1 ) : mnPos;
- delete new ImplAnimView( const_cast<Animation*>(this), pOut, rDestPt, rDestSz, 0 );
+ const_cast<Animation*>(this)->mnPos = mbLoopTerminated ? (nCount - 1) : mnPos;
+ delete new ImplAnimView(const_cast<Animation*>(this), pOut, rDestPt, rDestSz, 0);
const_cast<Animation*>(this)->mnPos = nOldPos;
}
}
}
-void Animation::ImplRestartTimer( sal_uLong nTimeout )
+void Animation::ImplRestartTimer(sal_uLong nTimeout)
{
- maTimer.SetTimeout( std::max( nTimeout, static_cast<sal_uLong>(MIN_TIMEOUT) ) * 10 );
+ maTimer.SetTimeout(std::max(nTimeout, static_cast<sal_uLong>(MIN_TIMEOUT)) * 10);
maTimer.Start();
}
-IMPL_LINK_NOARG(Animation, ImplTimeoutHdl, Timer *, void)
+IMPL_LINK_NOARG(Animation, ImplTimeoutHdl, Timer*, void)
{
const size_t nAnimCount = maList.size();
- if( nAnimCount )
+ if (nAnimCount)
{
- ImplAnimView* pView;
- bool bGlobalPause = true;
+ ImplAnimView* pView;
+ bool bGlobalPause = true;
- if( maNotifyLink.IsSet() )
+ if (maNotifyLink.IsSet())
{
- std::vector< std::unique_ptr<AInfo> > aAInfoList;
+ std::vector<std::unique_ptr<AInfo>> aAInfoList;
// create AInfo-List
- for(auto const & i : maViewList)
- aAInfoList.emplace_back( i->createAInfo() );
+ for (auto const& i : maViewList)
+ aAInfoList.emplace_back(i->createAInfo());
- maNotifyLink.Call( this );
+ maNotifyLink.Call(this);
// set view state from AInfo structure
- for(auto& pAInfo : aAInfoList)
+ for (auto& pAInfo : aAInfoList)
{
- if( !pAInfo->pViewData )
+ if (!pAInfo->pViewData)
{
- pView = new ImplAnimView( this, pAInfo->pOutDev,
- pAInfo->aStartOrg, pAInfo->aStartSize, pAInfo->nExtraData );
+ pView = new ImplAnimView(this, pAInfo->pOutDev, pAInfo->aStartOrg,
+ pAInfo->aStartSize, pAInfo->nExtraData);
- maViewList.push_back( std::unique_ptr<ImplAnimView>(pView) );
+ maViewList.push_back(std::unique_ptr<ImplAnimView>(pView));
}
else
pView = static_cast<ImplAnimView*>(pAInfo->pViewData);
- pView->pause( pAInfo->bPause );
- pView->setMarked( true );
+ pView->pause(pAInfo->bPause);
+ pView->setMarked(true);
}
// delete all unmarked views and reset marked state
- for( size_t i = 0; i < maViewList.size(); )
+ for (size_t i = 0; i < maViewList.size();)
{
- pView = maViewList[ i ].get();
- if( !pView->isMarked() )
+ pView = maViewList[i].get();
+ if (!pView->isMarked())
{
- maViewList.erase( maViewList.begin() + i );
+ maViewList.erase(maViewList.begin() + i);
}
else
{
- if( !pView->isPause() )
+ if (!pView->isPause())
bGlobalPause = false;
- pView->setMarked( false );
+ pView->setMarked(false);
i++;
}
}
@@ -354,31 +347,31 @@ IMPL_LINK_NOARG(Animation, ImplTimeoutHdl, Timer *, void)
else
bGlobalPause = false;
- if( maViewList.empty() )
+ if (maViewList.empty())
Stop();
- else if( bGlobalPause )
- ImplRestartTimer( 10 );
+ else if (bGlobalPause)
+ ImplRestartTimer(10);
else
{
- AnimationBitmap* pStepBmp = (++mnPos < maList.size()) ? maList[ mnPos ].get() : nullptr;
+ AnimationBitmap* pStepBmp = (++mnPos < maList.size()) ? maList[mnPos].get() : nullptr;
- if( !pStepBmp )
+ if (!pStepBmp)
{
- if( mnLoops == 1 )
+ if (mnLoops == 1)
{
Stop();
mbLoopTerminated = true;
mnPos = nAnimCount - 1;
- maBitmapEx = maList[ mnPos ]->aBmpEx;
+ maBitmapEx = maList[mnPos]->aBmpEx;
return;
}
else
{
- if( mnLoops )
+ if (mnLoops)
mnLoops--;
mnPos = 0;
- pStepBmp = maList[ mnPos ].get();
+ pStepBmp = maList[mnPos].get();
}
}
@@ -386,43 +379,44 @@ IMPL_LINK_NOARG(Animation, ImplTimeoutHdl, Timer *, void)
// marked; in this case remove view, because area of output
// lies out of display area of window; mark state is
// set from view itself
- for( size_t i = 0; i < maViewList.size(); )
+ for (size_t i = 0; i < maViewList.size();)
{
- pView = maViewList[ i ].get();
- pView->draw( mnPos );
+ pView = maViewList[i].get();
+ pView->draw(mnPos);
- if( pView->isMarked() )
+ if (pView->isMarked())
{
- maViewList.erase( maViewList.begin() + i );
+ maViewList.erase(maViewList.begin() + i);
}
else
i++;
}
// stop or restart timer
- if( maViewList.empty() )
+ if (maViewList.empty())
Stop();
else
- ImplRestartTimer( pStepBmp->nWait );
+ ImplRestartTimer(pStepBmp->nWait);
}
}
else
Stop();
}
-bool Animation::Insert( const AnimationBitmap& rStepBmp )
+bool Animation::Insert(const AnimationBitmap& rStepBmp)
{
bool bRet = false;
- if( !IsInAnimation() )
+ if (!IsInAnimation())
{
- tools::Rectangle aGlobalRect( Point(), maGlobalSize );
+ tools::Rectangle aGlobalRect(Point(), maGlobalSize);
- maGlobalSize = aGlobalRect.Union( tools::Rectangle( rStepBmp.aPosPix, rStepBmp.aSizePix ) ).GetSize();
- maList.emplace_back( new AnimationBitmap( rStepBmp ) );
+ maGlobalSize
+ = aGlobalRect.Union(tools::Rectangle(rStepBmp.aPosPix, rStepBmp.aSizePix)).GetSize();
+ maList.emplace_back(new AnimationBitmap(rStepBmp));
// As a start, we make the first BitmapEx the replacement BitmapEx
- if( maList.size() == 1 )
+ if (maList.size() == 1)
maBitmapEx = rStepBmp.aBmpEx;
bRet = true;
@@ -431,30 +425,22 @@ bool Animation::Insert( const AnimationBitmap& rStepBmp )
return bRet;
}
-const AnimationBitmap& Animation::Get( sal_uInt16 nAnimation ) const
+const AnimationBitmap& Animation::Get(sal_uInt16 nAnimation) const
{
- SAL_WARN_IF( ( nAnimation >= maList.size() ), "vcl", "No object at this position" );
- return *maList[ nAnimation ];
+ SAL_WARN_IF((nAnimation >= maList.size()), "vcl", "No object at this position");
+ return *maList[nAnimation];
}
-void Animation::Replace( const AnimationBitmap& rNewAnimationBitmap, sal_uInt16 nAnimation )
+void Animation::Replace(const AnimationBitmap& rNewAnimationBitmap, sal_uInt16 nAnimation)
{
- SAL_WARN_IF( ( nAnimation >= maList.size() ), "vcl", "No object at this position" );
+ SAL_WARN_IF((nAnimation >= maList.size()), "vcl", "No object at this position");
- maList[ nAnimation ].reset( new AnimationBitmap( rNewAnimationBitmap ) );
+ maList[nAnimation].reset(new AnimationBitmap(rNewAnimationBitmap));
// If we insert at first position we also need to
// update the replacement BitmapEx
- if ( ( !nAnimation
- && ( !mbLoopTerminated
- || ( maList.size() == 1 )
- )
- )
- ||
- ( ( nAnimation == maList.size() - 1 )
- && mbLoopTerminated
- )
- )
+ if ((!nAnimation && (!mbLoopTerminated || (maList.size() == 1)))
+ || ((nAnimation == maList.size() - 1) && mbLoopTerminated))
{
maBitmapEx = rNewAnimationBitmap.aBmpEx;
}
@@ -472,36 +458,37 @@ void Animation::ResetLoopCount()
mbLoopTerminated = false;
}
-void Animation::Convert( BmpConversion eConversion )
+void Animation::Convert(BmpConversion eConversion)
{
- SAL_WARN_IF( IsInAnimation(), "vcl", "Animation modified while it is animated" );
+ SAL_WARN_IF(IsInAnimation(), "vcl", "Animation modified while it is animated");
bool bRet;
- if( !IsInAnimation() && !maList.empty() )
+ if (!IsInAnimation() && !maList.empty())
{
bRet = true;
- for( size_t i = 0, n = maList.size(); ( i < n ) && bRet; ++i )
- bRet = maList[ i ]->aBmpEx.Convert( eConversion );
+ for (size_t i = 0, n = maList.size(); (i < n) && bRet; ++i)
+ bRet = maList[i]->aBmpEx.Convert(eConversion);
- maBitmapEx.Convert( eConversion );
+ maBitmapEx.Convert(eConversion);
}
}
-bool Animation::ReduceColors( sal_uInt16 nNewColorCount )
+bool Animation::ReduceColors(sal_uInt16 nNewColorCount)
{
- SAL_WARN_IF( IsInAnimation(), "vcl", "Animation modified while it is animated" );
+ SAL_WARN_IF(IsInAnimation(), "vcl", "Animation modified while it is animated");
bool bRet;
- if( !IsInAnimation() && !maList.empty() )
+ if (!IsInAnimation() && !maList.empty())
{
bRet = true;
for (size_t i = 0, n = maList.size(); (i < n) && bRet; ++i)
{
- bRet = BitmapFilter::Filter(maList[i]->aBmpEx, BitmapColorQuantizationFilter(nNewColorCount));
+ bRet = BitmapFilter::Filter(maList[i]->aBmpEx,
+ BitmapColorQuantizationFilter(nNewColorCount));
}
BitmapFilter::Filter(maBitmapEx, BitmapColorQuantizationFilter(nNewColorCount));
@@ -516,16 +503,16 @@ bool Animation::ReduceColors( sal_uInt16 nNewColorCount )
bool Animation::Invert()
{
- SAL_WARN_IF( IsInAnimation(), "vcl", "Animation modified while it is animated" );
+ SAL_WARN_IF(IsInAnimation(), "vcl", "Animation modified while it is animated");
bool bRet;
- if( !IsInAnimation() && !maList.empty() )
+ if (!IsInAnimation() && !maList.empty())
{
bRet = true;
- for( size_t i = 0, n = maList.size(); ( i < n ) && bRet; ++i )
- bRet = maList[ i ]->aBmpEx.Invert();
+ for (size_t i = 0, n = maList.size(); (i < n) && bRet; ++i)
+ bRet = maList[i]->aBmpEx.Invert();
maBitmapEx.Invert();
}
@@ -535,179 +522,180 @@ bool Animation::Invert()
return bRet;
}
-void Animation::Mirror( BmpMirrorFlags nMirrorFlags )
+void Animation::Mirror(BmpMirrorFlags nMirrorFlags)
{
- SAL_WARN_IF( IsInAnimation(), "vcl", "Animation modified while it is animated" );
+ SAL_WARN_IF(IsInAnimation(), "vcl", "Animation modified while it is animated");
- bool bRet;
+ bool bRet;
- if( !IsInAnimation() && !maList.empty() )
+ if (!IsInAnimation() && !maList.empty())
{
bRet = true;
- if( nMirrorFlags != BmpMirrorFlags::NONE )
+ if (nMirrorFlags != BmpMirrorFlags::NONE)
{
- for( size_t i = 0, n = maList.size(); ( i < n ) && bRet; ++i )
+ for (size_t i = 0, n = maList.size(); (i < n) && bRet; ++i)
{
- AnimationBitmap* pStepBmp = maList[ i ].get();
- bRet = pStepBmp->aBmpEx.Mirror( nMirrorFlags );
- if( bRet )
+ AnimationBitmap* pStepBmp = maList[i].get();
+ bRet = pStepBmp->aBmpEx.Mirror(nMirrorFlags);
+ if (bRet)
{
- if( nMirrorFlags & BmpMirrorFlags::Horizontal )
- pStepBmp->aPosPix.setX( maGlobalSize.Width() - pStepBmp->aPosPix.X() - pStepBmp->aSizePix.Width() );
+ if (nMirrorFlags & BmpMirrorFlags::Horizontal)
+ pStepBmp->aPosPix.setX(maGlobalSize.Width() - pStepBmp->aPosPix.X()
+ - pStepBmp->aSizePix.Width());
- if( nMirrorFlags & BmpMirrorFlags::Vertical )
- pStepBmp->aPosPix.setY( maGlobalSize.Height() - pStepBmp->aPosPix.Y() - pStepBmp->aSizePix.Height() );
+ if (nMirrorFlags & BmpMirrorFlags::Vertical)
+ pStepBmp->aPosPix.setY(maGlobalSize.Height() - pStepBmp->aPosPix.Y()
+ - pStepBmp->aSizePix.Height());
}
}
- maBitmapEx.Mirror( nMirrorFlags );
+ maBitmapEx.Mirror(nMirrorFlags);
}
}
}
-void Animation::Adjust( short nLuminancePercent, short nContrastPercent,
- short nChannelRPercent, short nChannelGPercent, short nChannelBPercent,
- double fGamma, bool bInvert )
+void Animation::Adjust(short nLuminancePercent, short nContrastPercent, short nChannelRPercent,
+ short nChannelGPercent, short nChannelBPercent, double fGamma, bool bInvert)
{
- SAL_WARN_IF( IsInAnimation(), "vcl", "Animation modified while it is animated" );
+ SAL_WARN_IF(IsInAnimation(), "vcl", "Animation modified while it is animated");
bool bRet;
- if( !IsInAnimation() && !maList.empty() )
+ if (!IsInAnimation() && !maList.empty())
{
bRet = true;
- for( size_t i = 0, n = maList.size(); ( i < n ) && bRet; ++i )
+ for (size_t i = 0, n = maList.size(); (i < n) && bRet; ++i)
{
- bRet = maList[ i ]->aBmpEx.Adjust( nLuminancePercent,
- nContrastPercent,
- nChannelRPercent,
- nChannelGPercent,
- nChannelBPercent,
- fGamma, bInvert
- );
+ bRet = maList[i]->aBmpEx.Adjust(nLuminancePercent, nContrastPercent, nChannelRPercent,
+ nChannelGPercent, nChannelBPercent, fGamma, bInvert);
}
- maBitmapEx.Adjust( nLuminancePercent, nContrastPercent,
- nChannelRPercent, nChannelGPercent, nChannelBPercent,
- fGamma, bInvert );
+ maBitmapEx.Adjust(nLuminancePercent, nContrastPercent, nChannelRPercent, nChannelGPercent,
+ nChannelBPercent, fGamma, bInvert);
}
}
-SvStream& WriteAnimation( SvStream& rOStm, const Animation& rAnimation )
+SvStream& WriteAnimation(SvStream& rOStm, const Animation& rAnimation)
{
const sal_uInt16 nCount = rAnimation.Count();
- if( nCount )
+ if (nCount)
{
- const sal_uInt32 nDummy32 = 0;
+ const sal_uInt32 nDummy32 = 0;
// If no BitmapEx was set we write the first Bitmap of
// the Animation
- if( !rAnimation.GetBitmapEx().GetBitmap() )
- WriteDIBBitmapEx(rAnimation.Get( 0 ).aBmpEx, rOStm);
+ if (!rAnimation.GetBitmapEx().GetBitmap())
+ WriteDIBBitmapEx(rAnimation.Get(0).aBmpEx, rOStm);
else
WriteDIBBitmapEx(rAnimation.GetBitmapEx(), rOStm);
// Write identifier ( SDANIMA1 )
- rOStm.WriteUInt32( 0x5344414e ).WriteUInt32( 0x494d4931 );
+ rOStm.WriteUInt32(0x5344414e).WriteUInt32(0x494d4931);
- for( sal_uInt16 i = 0; i < nCount; i++ )
+ for (sal_uInt16 i = 0; i < nCount; i++)
{
- const AnimationBitmap& rAnimBmp = rAnimation.Get( i );
- const sal_uInt16 nRest = nCount - i - 1;
+ const AnimationBitmap& rAnimBmp = rAnimation.Get(i);
+ const sal_uInt16 nRest = nCount - i - 1;
// Write AnimationBitmap
WriteDIBBitmapEx(rAnimBmp.aBmpEx, rOStm);
- WritePair( rOStm, rAnimBmp.aPosPix );
- WritePair( rOStm, rAnimBmp.aSizePix );
- WritePair( rOStm, rAnimation.maGlobalSize );
- rOStm.WriteUInt16( ( ANIMATION_TIMEOUT_ON_CLICK == rAnimBmp.nWait ) ? 65535 : rAnimBmp.nWait );
- rOStm.WriteUInt16( static_cast<sal_uInt16>(rAnimBmp.eDisposal) );
- rOStm.WriteBool( rAnimBmp.bUserInput );
- rOStm.WriteUInt32( rAnimation.mnLoopCount );
- rOStm.WriteUInt32( nDummy32 ); // Unused
- rOStm.WriteUInt32( nDummy32 ); // Unused
- rOStm.WriteUInt32( nDummy32 ); // Unused
+ WritePair(rOStm, rAnimBmp.aPosPix);
+ WritePair(rOStm, rAnimBmp.aSizePix);
+ WritePair(rOStm, rAnimation.maGlobalSize);
+ rOStm.WriteUInt16((ANIMATION_TIMEOUT_ON_CLICK == rAnimBmp.nWait) ? 65535
+ : rAnimBmp.nWait);
+ rOStm.WriteUInt16(static_cast<sal_uInt16>(rAnimBmp.eDisposal));
+ rOStm.WriteBool(rAnimBmp.bUserInput);
+ rOStm.WriteUInt32(rAnimation.mnLoopCount);
+ rOStm.WriteUInt32(nDummy32); // Unused
+ rOStm.WriteUInt32(nDummy32); // Unused
+ rOStm.WriteUInt32(nDummy32); // Unused
write_uInt16_lenPrefixed_uInt8s_FromOString(rOStm, OString()); // dummy
- rOStm.WriteUInt16( nRest ); // Count of remaining structures
+ rOStm.WriteUInt16(nRest); // Count of remaining structures
}
}
return rOStm;
}
-SvStream& ReadAnimation( SvStream& rIStm, Animation& rAnimation )
+SvStream& ReadAnimation(SvStream& rIStm, Animation& rAnimation)
{
- sal_uLong nStmPos;
- sal_uInt32 nAnimMagic1, nAnimMagic2;
+ sal_uLong nStmPos;
+ sal_uInt32 nAnimMagic1, nAnimMagic2;
SvStreamEndian nOldFormat = rIStm.GetEndian();
- bool bReadAnimations = false;
+ bool bReadAnimations = false;
- rIStm.SetEndian( SvStreamEndian::LITTLE );
+ rIStm.SetEndian(SvStreamEndian::LITTLE);
nStmPos = rIStm.Tell();
- rIStm.ReadUInt32( nAnimMagic1 ).ReadUInt32( nAnimMagic2 );
+ rIStm.ReadUInt32(nAnimMagic1).ReadUInt32(nAnimMagic2);
rAnimation.Clear();
// If the BitmapEx at the beginning have already been read (by Graphic)
// we can start reading the AnimationBitmaps right away
- if( ( nAnimMagic1 == 0x5344414e ) && ( nAnimMagic2 == 0x494d4931 ) && !rIStm.GetError() )
+ if ((nAnimMagic1 == 0x5344414e) && (nAnimMagic2 == 0x494d4931) && !rIStm.GetError())
bReadAnimations = true;
// Else, we try reading the Bitmap(-Ex)
else
{
- rIStm.Seek( nStmPos );
+ rIStm.Seek(nStmPos);
ReadDIBBitmapEx(rAnimation.maBitmapEx, rIStm);
nStmPos = rIStm.Tell();
- rIStm.ReadUInt32( nAnimMagic1 ).ReadUInt32( nAnimMagic2 );
+ rIStm.ReadUInt32(nAnimMagic1).ReadUInt32(nAnimMagic2);
- if( ( nAnimMagic1 == 0x5344414e ) && ( nAnimMagic2 == 0x494d4931 ) && !rIStm.GetError() )
+ if ((nAnimMagic1 == 0x5344414e) && (nAnimMagic2 == 0x494d4931) && !rIStm.GetError())
bReadAnimations = true;
else
- rIStm.Seek( nStmPos );
+ rIStm.Seek(nStmPos);
}
// Read AnimationBitmaps
- if( bReadAnimations )
+ if (bReadAnimations)
{
AnimationBitmap aAnimBmp;
- sal_uInt32 nTmp32;
- sal_uInt16 nTmp16;
- bool cTmp;
+ sal_uInt32 nTmp32;
+ sal_uInt16 nTmp16;
+ bool cTmp;
do
{
ReadDIBBitmapEx(aAnimBmp.aBmpEx, rIStm);
- ReadPair( rIStm, aAnimBmp.aPosPix );
- ReadPair( rIStm, aAnimBmp.aSizePix );
- ReadPair( rIStm, rAnimation.maGlobalSize );
- rIStm.ReadUInt16( nTmp16 ); aAnimBmp.nWait = ( ( 65535 == nTmp16 ) ? ANIMATION_TIMEOUT_ON_CLICK : nTmp16 );
- rIStm.ReadUInt16( nTmp16 ); aAnimBmp.eDisposal = static_cast<Disposal>(nTmp16);
- rIStm.ReadCharAsBool( cTmp ); aAnimBmp.bUserInput = cTmp;
- rIStm.ReadUInt32( rAnimation.mnLoopCount );
- rIStm.ReadUInt32( nTmp32 ); // Unused
- rIStm.ReadUInt32( nTmp32 ); // Unused
- rIStm.ReadUInt32( nTmp32 ); // Unused
+ ReadPair(rIStm, aAnimBmp.aPosPix);
+ ReadPair(rIStm, aAnimBmp.aSizePix);
+ ReadPair(rIStm, rAnimation.maGlobalSize);
+ rIStm.ReadUInt16(nTmp16);
+ aAnimBmp.nWait = ((65535 == nTmp16) ? ANIMATION_TIMEOUT_ON_CLICK : nTmp16);
+ rIStm.ReadUInt16(nTmp16);
+ aAnimBmp.eDisposal = static_cast<Disposal>(nTmp16);
+ rIStm.ReadCharAsBool(cTmp);
+ aAnimBmp.bUserInput = cTmp;
+ rIStm.ReadUInt32(rAnimation.mnLoopCount);
+ rIStm.ReadUInt32(nTmp32); // Unused
+ rIStm.ReadUInt32(nTmp32); // Unused
+ rIStm.ReadUInt32(nTmp32); // Unused
read_uInt16_lenPrefixed_uInt8s_ToOString(rIStm); // Unused
- rIStm.ReadUInt16( nTmp16 ); // The rest to read
+ rIStm.ReadUInt16(nTmp16); // The rest to read
- rAnimation.Insert( aAnimBmp );
- }
- while( nTmp16 && !rIStm.GetError() );
+ rAnimation.Insert(aAnimBmp);
+ } while (nTmp16 && !rIStm.GetError());
rAnimation.ResetLoopCount();
}
- rIStm.SetEndian( nOldFormat );
+ rIStm.SetEndian(nOldFormat);
return rIStm;
}
-AInfo::AInfo() : pOutDev( nullptr ),
- pViewData( nullptr ),
- nExtraData( 0 ),
- bPause( false ) {}
+AInfo::AInfo()
+ : pOutDev(nullptr)
+ , pViewData(nullptr)
+ , nExtraData(0)
+ , bPause(false)
+{
+}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/animate/AnimationBitmap.cxx b/vcl/source/animate/AnimationBitmap.cxx
index c1d3e15bf09e..963c921d8658 100644
--- a/vcl/source/animate/AnimationBitmap.cxx
+++ b/vcl/source/animate/AnimationBitmap.cxx
@@ -24,29 +24,29 @@
BitmapChecksum AnimationBitmap::GetChecksum() const
{
- BitmapChecksum nCrc = aBmpEx.GetChecksum();
- SVBT32 aBT32;
+ BitmapChecksum nCrc = aBmpEx.GetChecksum();
+ SVBT32 aBT32;
- Int32ToSVBT32( aPosPix.X(), aBT32 );
- nCrc = vcl_get_checksum( nCrc, aBT32, 4 );
+ Int32ToSVBT32(aPosPix.X(), aBT32);
+ nCrc = vcl_get_checksum(nCrc, aBT32, 4);
- Int32ToSVBT32( aPosPix.Y(), aBT32 );
- nCrc = vcl_get_checksum( nCrc, aBT32, 4 );
+ Int32ToSVBT32(aPosPix.Y(), aBT32);
+ nCrc = vcl_get_checksum(nCrc, aBT32, 4);
- Int32ToSVBT32( aSizePix.Width(), aBT32 );
- nCrc = vcl_get_checksum( nCrc, aBT32, 4 );
+ Int32ToSVBT32(aSizePix.Width(), aBT32);
+ nCrc = vcl_get_checksum(nCrc, aBT32, 4);
- Int32ToSVBT32( aSizePix.Height(), aBT32 );
- nCrc = vcl_get_checksum( nCrc, aBT32, 4 );
+ Int32ToSVBT32(aSizePix.Height(), aBT32);
+ nCrc = vcl_get_checksum(nCrc, aBT32, 4);
- Int32ToSVBT32( nWait, aBT32 );
- nCrc = vcl_get_checksum( nCrc, aBT32, 4 );
+ Int32ToSVBT32(nWait, aBT32);
+ nCrc = vcl_get_checksum(nCrc, aBT32, 4);
- UInt32ToSVBT32( o3tl::underlyingEnumValue(eDisposal), aBT32 );
- nCrc = vcl_get_checksum( nCrc, aBT32, 4 );
+ UInt32ToSVBT32(o3tl::underlyingEnumValue(eDisposal), aBT32);
+ nCrc = vcl_get_checksum(nCrc, aBT32, 4);
- UInt32ToSVBT32( sal_uInt32(bUserInput), aBT32 );
- nCrc = vcl_get_checksum( nCrc, aBT32, 4 );
+ UInt32ToSVBT32(sal_uInt32(bUserInput), aBT32);
+ nCrc = vcl_get_checksum(nCrc, aBT32, 4);
return nCrc;
}