[Libreoffice-commits] core.git: drawinglayer/source filter/source include/vcl sd/source slideshow/source vcl/source

Noel Grandin noel at peralex.com
Wed May 25 10:00:09 UTC 2016


 drawinglayer/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(-)

New commits:
commit edc87278036107dc392253bdcb99dce54a1d0a41
Author: Noel Grandin <noel at peralex.com>
Date:   Wed May 25 09:11:03 2016 +0200

    Convert Disposal to scoped enum
    
    and drop unused FULL value
    
    Change-Id: I3b9c26cb164785ef86f1a8d57cce962b015c85d6
    Reviewed-on: https://gerrit.libreoffice.org/25432
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noelgrandin at gmail.com>

diff --git a/drawinglayer/source/primitive2d/graphicprimitivehelper2d.cxx b/drawinglayer/source/primitive2d/graphicprimitivehelper2d.cxx
index 93a5f55..87d3959 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 3ba9ff0..9c90c0f 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 c87e8f8..d7a26ea 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 bedb836..73cc12d 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 5b985d9..8fd0c49 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 19fc001..ae5997d 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 4edb056..aac672f 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 a6eb430..67d9b7d 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 ce0947b..2606283 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<VirtualDevice>::Create() ),
         mpRestore       ( VclPtr<VirtualDevice>::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
         {


More information about the Libreoffice-commits mailing list