diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-08-04 09:22:10 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-08-04 11:21:22 +0200 |
commit | f45ff1a7147e6a9479c669f082dd74349c6bcb4b (patch) | |
tree | 9ec5eee03fe7bbc5e026318efd6dcca3502d4696 /vcl/source/animate | |
parent | 58937aa4a50ecd681382f03331340da4c843b01e (diff) |
loplugin:flatten in vcl
Change-Id: I271cc67ecf34acbf0edbda960e33315fb6a1f9dc
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100041
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'vcl/source/animate')
-rw-r--r-- | vcl/source/animate/Animation.cxx | 95 |
1 files changed, 46 insertions, 49 deletions
diff --git a/vcl/source/animate/Animation.cxx b/vcl/source/animate/Animation.cxx index d9eaed56ce73..2b799dabf3af 100644 --- a/vcl/source/animate/Animation.cxx +++ b/vcl/source/animate/Animation.cxx @@ -239,26 +239,26 @@ void Animation::Draw(OutputDevice* pOut, const Point& rDestPt, const Size& rDest { const size_t nCount = maList.size(); - if (nCount) - { - AnimationBitmap* pObj = maList[std::min(mnPos, nCount - 1)].get(); + if (!nCount) + return; - if (pOut->GetConnectMetaFile() || (pOut->GetOutDevType() == OUTDEV_PRINTER)) - maList[0]->maBitmapEx.Draw(pOut, rDestPt, rDestSz); - else if (ANIMATION_TIMEOUT_ON_CLICK == pObj->mnWait) - pObj->maBitmapEx.Draw(pOut, rDestPt, rDestSz); - else - { - const size_t nOldPos = mnPos; - if (mbLoopTerminated) - const_cast<Animation*>(this)->mnPos = nCount - 1; + AnimationBitmap* pObj = maList[std::min(mnPos, nCount - 1)].get(); - { - ImplAnimView{ const_cast<Animation*>(this), pOut, rDestPt, rDestSz, 0 }; - } + if (pOut->GetConnectMetaFile() || (pOut->GetOutDevType() == OUTDEV_PRINTER)) + maList[0]->maBitmapEx.Draw(pOut, rDestPt, rDestSz); + else if (ANIMATION_TIMEOUT_ON_CLICK == pObj->mnWait) + pObj->maBitmapEx.Draw(pOut, rDestPt, rDestSz); + else + { + const size_t nOldPos = mnPos; + if (mbLoopTerminated) + const_cast<Animation*>(this)->mnPos = nCount - 1; - const_cast<Animation*>(this)->mnPos = nOldPos; + { + ImplAnimView{ const_cast<Animation*>(this), pOut, rDestPt, rDestSz, 0 }; } + + const_cast<Animation*>(this)->mnPos = nOldPos; } } @@ -499,33 +499,31 @@ void Animation::Mirror(BmpMirrorFlags nMirrorFlags) bool bRet; - if (!IsInAnimation() && !maList.empty()) - { - bRet = true; + if (IsInAnimation() || maList.empty()) + return; + + bRet = true; + + if (nMirrorFlags == BmpMirrorFlags::NONE) + return; - if (nMirrorFlags != BmpMirrorFlags::NONE) + for (size_t i = 0, n = maList.size(); (i < n) && bRet; ++i) + { + AnimationBitmap* pStepBmp = maList[i].get(); + bRet = pStepBmp->maBitmapEx.Mirror(nMirrorFlags); + if (bRet) { - for (size_t i = 0, n = maList.size(); (i < n) && bRet; ++i) - { - AnimationBitmap* pStepBmp = maList[i].get(); - bRet = pStepBmp->maBitmapEx.Mirror(nMirrorFlags); - if (bRet) - { - if (nMirrorFlags & BmpMirrorFlags::Horizontal) - pStepBmp->maPositionPixel.setX(maGlobalSize.Width() - - pStepBmp->maPositionPixel.X() - - pStepBmp->maSizePixel.Width()); - - if (nMirrorFlags & BmpMirrorFlags::Vertical) - pStepBmp->maPositionPixel.setY(maGlobalSize.Height() - - pStepBmp->maPositionPixel.Y() - - pStepBmp->maSizePixel.Height()); - } - } + if (nMirrorFlags & BmpMirrorFlags::Horizontal) + pStepBmp->maPositionPixel.setX(maGlobalSize.Width() - pStepBmp->maPositionPixel.X() + - pStepBmp->maSizePixel.Width()); - maBitmapEx.Mirror(nMirrorFlags); + if (nMirrorFlags & BmpMirrorFlags::Vertical) + pStepBmp->maPositionPixel.setY(maGlobalSize.Height() - pStepBmp->maPositionPixel.Y() + - pStepBmp->maSizePixel.Height()); } } + + maBitmapEx.Mirror(nMirrorFlags); } void Animation::Adjust(short nLuminancePercent, short nContrastPercent, short nChannelRPercent, @@ -535,20 +533,19 @@ void Animation::Adjust(short nLuminancePercent, short nContrastPercent, short nC bool bRet; - if (!IsInAnimation() && !maList.empty()) - { - bRet = true; + if (IsInAnimation() || maList.empty()) + return; - for (size_t i = 0, n = maList.size(); (i < n) && bRet; ++i) - { - bRet = maList[i]->maBitmapEx.Adjust(nLuminancePercent, nContrastPercent, - nChannelRPercent, nChannelGPercent, - nChannelBPercent, fGamma, bInvert); - } + bRet = true; - maBitmapEx.Adjust(nLuminancePercent, nContrastPercent, nChannelRPercent, nChannelGPercent, - nChannelBPercent, fGamma, bInvert); + for (size_t i = 0, n = maList.size(); (i < n) && bRet; ++i) + { + bRet = maList[i]->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) |