From edc87278036107dc392253bdcb99dce54a1d0a41 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Wed, 25 May 2016 09:11:03 +0200 Subject: Convert Disposal to scoped enum and drop unused FULL value Change-Id: I3b9c26cb164785ef86f1a8d57cce962b015c85d6 Reviewed-on: https://gerrit.libreoffice.org/25432 Tested-by: Jenkins Reviewed-by: Noel Grandin --- .../source/primitive2d/graphicprimitivehelper2d.cxx | 11 +++-------- filter/source/graphicfilter/egif/egif.cxx | 6 +++--- filter/source/graphicfilter/itiff/itiff.cxx | 2 +- include/vcl/animate.hxx | 13 ++++++------- sd/source/ui/dlg/animobjs.cxx | 2 +- slideshow/source/engine/shapes/gdimtftools.cxx | 13 +++---------- vcl/source/filter/igif/gifread.cxx | 6 +++--- vcl/source/gdi/animate.cxx | 4 ++-- vcl/source/gdi/impanmvw.cxx | 10 +++++----- 9 files changed, 27 insertions(+), 40 deletions(-) diff --git a/drawinglayer/source/primitive2d/graphicprimitivehelper2d.cxx b/drawinglayer/source/primitive2d/graphicprimitivehelper2d.cxx index 93a5f55133ac..87d3959cebf9 100644 --- a/drawinglayer/source/primitive2d/graphicprimitivehelper2d.cxx +++ b/drawinglayer/source/primitive2d/graphicprimitivehelper2d.cxx @@ -117,7 +117,7 @@ namespace switch(rAnimBitmap.eDisposal) { - case DISPOSE_NOT: + case Disposal::Not: { aVirtualDevice->DrawBitmapEx(rAnimBitmap.aPosPix, rAnimBitmap.aBmpEx); Bitmap aMask = rAnimBitmap.aBmpEx.GetMask(); @@ -137,7 +137,7 @@ namespace break; } - case DISPOSE_BACK: + case Disposal::Back: { // #i70772# react on no mask, for primitives, too. const Bitmap aMask(rAnimBitmap.aBmpEx.GetMask()); @@ -160,12 +160,7 @@ namespace break; } - case DISPOSE_FULL: - { - aVirtualDevice->DrawBitmapEx(rAnimBitmap.aPosPix, rAnimBitmap.aBmpEx); - break; - } - case DISPOSE_PREVIOUS : + case Disposal::Previous : { aVirtualDevice->DrawBitmapEx(rAnimBitmap.aPosPix, rAnimBitmap.aBmpEx); aVirtualDeviceMask->DrawBitmap(rAnimBitmap.aPosPix, rAnimBitmap.aBmpEx.GetMask()); diff --git a/filter/source/graphicfilter/egif/egif.cxx b/filter/source/graphicfilter/egif/egif.cxx index 3ba9ff0d8874..9c90c0f0f244 100644 --- a/filter/source/graphicfilter/egif/egif.cxx +++ b/filter/source/graphicfilter/egif/egif.cxx @@ -59,7 +59,7 @@ class GIFWriter void WriteAnimation( const Animation& rAnimation ); void WriteBitmapEx( const BitmapEx& rBmpEx, const Point& rPoint, bool bExtended, - long nTimer = 0, Disposal eDisposal = DISPOSE_NOT ); + long nTimer = 0, Disposal eDisposal = Disposal::Not ); css::uno::Reference< css::task::XStatusIndicator > xStatusIndicator; @@ -385,9 +385,9 @@ void GIFWriter::WriteImageExtension( long nTimer, Disposal eDisposal ) cFlags |= 1; // set Disposal-value - if( eDisposal == DISPOSE_BACK ) + if( eDisposal == Disposal::Back ) cFlags |= ( 2 << 2 ); - else if( eDisposal == DISPOSE_PREVIOUS ) + else if( eDisposal == Disposal::Previous ) cFlags |= ( 3 << 2 ); m_rGIF.WriteUChar( 0x21 ); diff --git a/filter/source/graphicfilter/itiff/itiff.cxx b/filter/source/graphicfilter/itiff/itiff.cxx index c87e8f8e24f7..d7a26ead6670 100644 --- a/filter/source/graphicfilter/itiff/itiff.cxx +++ b/filter/source/graphicfilter/itiff/itiff.cxx @@ -1420,7 +1420,7 @@ bool TIFFReader::ReadTIFF(SvStream & rTIFF, Graphic & rGraphic ) aImage = aBitmap; AnimationBitmap aAnimationBitmap( aImage, Point( 0, 0 ), aBitmap.GetSizePixel(), - ANIMATION_TIMEOUT_ON_CLICK, DISPOSE_BACK ); + ANIMATION_TIMEOUT_ON_CLICK, Disposal::Back ); aAnimation.Insert( aAnimationBitmap ); } diff --git a/include/vcl/animate.hxx b/include/vcl/animate.hxx index bedb8364b1b7..73cc12def8c6 100644 --- a/include/vcl/animate.hxx +++ b/include/vcl/animate.hxx @@ -27,12 +27,11 @@ #define ANIMATION_TIMEOUT_ON_CLICK 2147483647L -enum Disposal +enum class Disposal { - DISPOSE_NOT, - DISPOSE_BACK, - DISPOSE_FULL, - DISPOSE_PREVIOUS + Not, + Back, + Previous }; enum CycleMode @@ -55,7 +54,7 @@ struct VCL_DLLPUBLIC AnimationBitmap AnimationBitmap() : nWait(0) - , eDisposal(DISPOSE_NOT) + , eDisposal(Disposal::Not) , bUserInput(false) {} @@ -64,7 +63,7 @@ struct VCL_DLLPUBLIC AnimationBitmap const Point& rPosPix, const Size& rSizePix, long _nWait = 0L, - Disposal _eDisposal = DISPOSE_NOT + Disposal _eDisposal = Disposal::Not ) : aBmpEx ( rBmpEx ), aPosPix ( rPosPix ), diff --git a/sd/source/ui/dlg/animobjs.cxx b/sd/source/ui/dlg/animobjs.cxx index 5b985d9768d1..8fd0c49d50c7 100644 --- a/sd/source/ui/dlg/animobjs.cxx +++ b/sd/source/ui/dlg/animobjs.cxx @@ -1003,7 +1003,7 @@ void AnimationWindow::CreateAnimObj (::sd::View& rView ) aAnimBmp.aPosPix = aPt; aAnimBmp.aSizePix = aBitmapSize; aAnimBmp.nWait = nTime; - aAnimBmp.eDisposal = DISPOSE_BACK; + aAnimBmp.eDisposal = Disposal::Back; aAnimBmp.bUserInput = false; aAnimation.Insert( aAnimBmp ); diff --git a/slideshow/source/engine/shapes/gdimtftools.cxx b/slideshow/source/engine/shapes/gdimtftools.cxx index 19fc0015b6a4..ae5997d2ff71 100644 --- a/slideshow/source/engine/shapes/gdimtftools.cxx +++ b/slideshow/source/engine/shapes/gdimtftools.cxx @@ -323,7 +323,7 @@ bool getAnimationFromGraphic( VectorOfMtfAnimationFrames& o_rFrames, const AnimationBitmap& rAnimBmp( aAnimation.Get(i) ); switch(rAnimBmp.eDisposal) { - case DISPOSE_NOT: + case Disposal::Not: { pVDev->DrawBitmapEx(rAnimBmp.aPosPix, rAnimBmp.aBmpEx); @@ -347,7 +347,7 @@ bool getAnimationFromGraphic( VectorOfMtfAnimationFrames& o_rFrames, break; } - case DISPOSE_BACK: + case Disposal::Back: { // #i70772# react on no mask const Bitmap aMask(rAnimBmp.aBmpEx.GetMask()); @@ -370,14 +370,7 @@ bool getAnimationFromGraphic( VectorOfMtfAnimationFrames& o_rFrames, break; } - case DISPOSE_FULL: - { - pVDev->DrawBitmapEx(rAnimBmp.aPosPix, - rAnimBmp.aBmpEx); - break; - } - - case DISPOSE_PREVIOUS : + case Disposal::Previous : { pVDev->DrawBitmapEx(rAnimBmp.aPosPix, rAnimBmp.aBmpEx); diff --git a/vcl/source/filter/igif/gifread.cxx b/vcl/source/filter/igif/gifread.cxx index 4edb05666ed2..aac672f22271 100644 --- a/vcl/source/filter/igif/gifread.cxx +++ b/vcl/source/filter/igif/gifread.cxx @@ -643,11 +643,11 @@ void GIFReader::CreateNewBitmaps() aAnimBmp.bUserInput = false; if( nGCDisposalMethod == 2 ) - aAnimBmp.eDisposal = DISPOSE_BACK; + aAnimBmp.eDisposal = Disposal::Back; else if( nGCDisposalMethod == 3 ) - aAnimBmp.eDisposal = DISPOSE_PREVIOUS; + aAnimBmp.eDisposal = Disposal::Previous; else - aAnimBmp.eDisposal = DISPOSE_NOT; + aAnimBmp.eDisposal = Disposal::Not; aAnimation.Insert( aAnimBmp ); diff --git a/vcl/source/gdi/animate.cxx b/vcl/source/gdi/animate.cxx index a6eb4300334e..67d9b7dda9ea 100644 --- a/vcl/source/gdi/animate.cxx +++ b/vcl/source/gdi/animate.cxx @@ -177,7 +177,7 @@ bool Animation::IsTransparent() const // graphics due to performance reasons. for(const AnimationBitmap* pAnimBmp : maList) { - if( DISPOSE_BACK == pAnimBmp->eDisposal + if( Disposal::Back == pAnimBmp->eDisposal && Rectangle( pAnimBmp->aPosPix, pAnimBmp->aSizePix ) != aRect ) { @@ -713,7 +713,7 @@ SvStream& WriteAnimation( SvStream& rOStm, const Animation& rAnimation ) WritePair( rOStm, rAnimBmp.aSizePix ); WritePair( rOStm, rAnimation.maGlobalSize ); rOStm.WriteUInt16( ( ANIMATION_TIMEOUT_ON_CLICK == rAnimBmp.nWait ) ? 65535 : rAnimBmp.nWait ); - rOStm.WriteUInt16( rAnimBmp.eDisposal ); + rOStm.WriteUInt16( (sal_uInt16)rAnimBmp.eDisposal ); rOStm.WriteBool( rAnimBmp.bUserInput ); rOStm.WriteUInt32( rAnimation.mnLoopCount ); rOStm.WriteUInt32( nDummy32 ); // Unused diff --git a/vcl/source/gdi/impanmvw.cxx b/vcl/source/gdi/impanmvw.cxx index ce0947b4daa0..2606283c5cd6 100644 --- a/vcl/source/gdi/impanmvw.cxx +++ b/vcl/source/gdi/impanmvw.cxx @@ -37,7 +37,7 @@ ImplAnimView::ImplAnimView( Animation* pParent, OutputDevice* pOut, maClip ( mpOut->GetClipRegion() ), mpBackground ( VclPtr::Create() ), mpRestore ( VclPtr::Create() ), - meLastDisposal ( DISPOSE_BACK ), + meLastDisposal ( Disposal::Back ), mbPause ( false ), mbMarked ( false ), mbHMirr ( maSz.Width() < 0L ), @@ -251,15 +251,15 @@ void ImplAnimView::draw( sal_uLong nPos, VirtualDevice* pVDev ) // restore background after each run if( !nPos ) { - meLastDisposal = DISPOSE_BACK; + meLastDisposal = Disposal::Back; maRestPt = Point(); maRestSz = maSzPix; } // restore - if( ( DISPOSE_NOT != meLastDisposal ) && maRestSz.Width() && maRestSz.Height() ) + if( ( Disposal::Not != meLastDisposal ) && maRestSz.Width() && maRestSz.Height() ) { - if( DISPOSE_BACK == meLastDisposal ) + if( Disposal::Back == meLastDisposal ) pDev->DrawOutDev( maRestPt, maRestSz, maRestPt, maRestSz, *mpBackground ); else pDev->DrawOutDev( maRestPt, maRestSz, Point(), maRestSz, *mpRestore ); @@ -272,7 +272,7 @@ void ImplAnimView::draw( sal_uLong nPos, VirtualDevice* pVDev ) // What do we need to restore the next time? // Put it into a bitmap if needed, else delete // SaveBitmap to conserve memory - if( ( meLastDisposal == DISPOSE_BACK ) || ( meLastDisposal == DISPOSE_NOT ) ) + if( ( meLastDisposal == Disposal::Back ) || ( meLastDisposal == Disposal::Not ) ) mpRestore->SetOutputSizePixel( Size( 1, 1 ), false ); else { -- cgit