[Libreoffice-commits] core.git: filter/source include/vcl svtools/source svx/source vcl/source

Noel Grandin noel.grandin at collabora.co.uk
Thu Feb 2 07:46:10 UTC 2017


 filter/source/msfilter/msdffimp.cxx    |    2 
 include/vcl/bitmap.hxx                 |   11 ----
 svtools/source/graphic/transformer.cxx |    2 
 svx/source/dialog/_bmpmask.cxx         |    2 
 svx/source/dialog/_contdlg.cxx         |    2 
 vcl/source/filter/wmf/winmtf.cxx       |    4 -
 vcl/source/gdi/bitmap.cxx              |   87 ---------------------------------
 7 files changed, 10 insertions(+), 100 deletions(-)

New commits:
commit 52360bf8dd567598593cb212ac85f0c919315618
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Wed Feb 1 15:04:45 2017 +0200

    convert BmpCombine to scoped enum and drop unused
    
    Change-Id: Ic67474683a25a25e5753777f4bbbeded6ceba414
    Reviewed-on: https://gerrit.libreoffice.org/33793
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/filter/source/msfilter/msdffimp.cxx b/filter/source/msfilter/msdffimp.cxx
index d2aeeeb..5e45f5b 100644
--- a/filter/source/msfilter/msdffimp.cxx
+++ b/filter/source/msfilter/msdffimp.cxx
@@ -3826,7 +3826,7 @@ SdrObject* SvxMSDffManager::ImportGraphic( SvStream& rSt, SfxItemSet& rSet, cons
                     Bitmap      aBitmap( aBitmapEx.GetBitmap() );
                     Bitmap      aMask( aBitmap.CreateMask( MSO_CLR_ToColor( nTransColor, DFF_Prop_pictureTransparent ), 9 ) );
                     if ( aBitmapEx.IsTransparent() )
-                        aMask.CombineSimple( aBitmapEx.GetMask(), BMP_COMBINE_OR );
+                        aMask.CombineSimple( aBitmapEx.GetMask(), BmpCombine::Or );
                     aGraf = BitmapEx( aBitmap, aMask );
                 }
             }
diff --git a/include/vcl/bitmap.hxx b/include/vcl/bitmap.hxx
index 9ff3984..9f99467 100644
--- a/include/vcl/bitmap.hxx
+++ b/include/vcl/bitmap.hxx
@@ -88,16 +88,9 @@ enum BmpConversion
     BMP_CONVERSION_GHOSTED = 10
 };
 
-enum BmpCombine
+enum class BmpCombine
 {
-    BMP_COMBINE_COPY = 0,
-    BMP_COMBINE_INVERT = 1,
-    BMP_COMBINE_AND = 2,
-    BMP_COMBINE_NAND = 3,
-    BMP_COMBINE_OR = 4,
-    BMP_COMBINE_NOR = 5,
-    BMP_COMBINE_XOR = 6,
-    BMP_COMBINE_NXOR = 7
+    Or, And
 };
 
 enum BmpReduce
diff --git a/svtools/source/graphic/transformer.cxx b/svtools/source/graphic/transformer.cxx
index 4caf469..8b934da 100644
--- a/svtools/source/graphic/transformer.cxx
+++ b/svtools/source/graphic/transformer.cxx
@@ -98,7 +98,7 @@ uno::Reference< graphic::XGraphic > SAL_CALL GraphicTransformer::colorChange(
             {
                 Bitmap aMask( aBitmapEx.GetMask() );
                 Bitmap aMask2( aBitmap.CreateMask( aColorFrom, nTolerance ) );
-                aMask.CombineSimple( aMask2, BMP_COMBINE_OR );
+                aMask.CombineSimple( aMask2, BmpCombine::Or );
                 aBitmap.Replace( aColorFrom, aColorTo, nTolerance );
                 aGraphic = ::Graphic( BitmapEx( aBitmap, aMask ) );
             }
diff --git a/svx/source/dialog/_bmpmask.cxx b/svx/source/dialog/_bmpmask.cxx
index b7e1948..eebc880 100644
--- a/svx/source/dialog/_bmpmask.cxx
+++ b/svx/source/dialog/_bmpmask.cxx
@@ -631,7 +631,7 @@ BitmapEx SvxBmpMask::ImpMaskTransparent( const BitmapEx& rBitmapEx, const Color&
     Bitmap      aMask( rBitmapEx.GetBitmap().CreateMask( rColor, nTol ) );
 
     if( rBitmapEx.IsTransparent() )
-        aMask.CombineSimple( rBitmapEx.GetMask(), BMP_COMBINE_OR );
+        aMask.CombineSimple( rBitmapEx.GetMask(), BmpCombine::Or );
 
     aBmpEx = BitmapEx( rBitmapEx.GetBitmap(), aMask );
     LeaveWait();
diff --git a/svx/source/dialog/_contdlg.cxx b/svx/source/dialog/_contdlg.cxx
index 11d559f..c8c20df 100644
--- a/svx/source/dialog/_contdlg.cxx
+++ b/svx/source/dialog/_contdlg.cxx
@@ -691,7 +691,7 @@ IMPL_LINK( SvxSuperContourDlg, PipetteClickHdl, ContourWindow&, rWnd, void )
             aMask = aBmp.CreateMask( rColor, nTol );
 
             if( aGraphic.IsTransparent() )
-                aMask.CombineSimple( aGraphic.GetBitmapEx().GetMask(), BMP_COMBINE_OR );
+                aMask.CombineSimple( aGraphic.GetBitmapEx().GetMask(), BmpCombine::Or );
 
             if( !!aMask )
             {
diff --git a/vcl/source/filter/wmf/winmtf.cxx b/vcl/source/filter/wmf/winmtf.cxx
index b383439..b824a1a 100644
--- a/vcl/source/filter/wmf/winmtf.cxx
+++ b/vcl/source/filter/wmf/winmtf.cxx
@@ -1637,11 +1637,11 @@ void WinMtfOutput::ImplDrawBitmap( const Point& rPos, const Size& rSize, const B
 
                 if ( rBitmap.GetTransparentColor() == Color( COL_WHITE ) )
                 {
-                    aMask.CombineSimple( rBitmap.GetMask(), BMP_COMBINE_OR );
+                    aMask.CombineSimple( rBitmap.GetMask(), BmpCombine::Or );
                 }
                 else
                 {
-                    aMask.CombineSimple( rBitmap.GetMask(), BMP_COMBINE_AND );
+                    aMask.CombineSimple( rBitmap.GetMask(), BmpCombine::And );
                 }
 
                 aBmpEx = BitmapEx( rBitmap.GetBitmap(), aMask );
diff --git a/vcl/source/gdi/bitmap.cxx b/vcl/source/gdi/bitmap.cxx
index ec382f2..16aa9adf 100644
--- a/vcl/source/gdi/bitmap.cxx
+++ b/vcl/source/gdi/bitmap.cxx
@@ -1721,31 +1721,7 @@ bool Bitmap::CombineSimple( const Bitmap& rMask, BmpCombine eCombine )
 
         switch( eCombine )
         {
-            case BMP_COMBINE_COPY:
-            {
-                for( long nY = 0L; nY < nHeight; nY++ ) for( long nX = 0L; nX < nWidth; nX++ )
-                {
-                    if( pMaskAcc->GetPixel( nY, nX ) == aMaskBlack )
-                        pAcc->SetPixel( nY, nX, aBlack );
-                    else
-                        pAcc->SetPixel( nY, nX, aWhite );
-                }
-            }
-            break;
-
-            case BMP_COMBINE_INVERT:
-            {
-                for( long nY = 0L; nY < nHeight; nY++ ) for( long nX = 0L; nX < nWidth; nX++ )
-                {
-                    if( pAcc->GetPixel( nY, nX ) == aBlack )
-                        pAcc->SetPixel( nY, nX, aWhite );
-                    else
-                        pAcc->SetPixel( nY, nX, aBlack );
-                }
-            }
-            break;
-
-            case BMP_COMBINE_AND:
+            case BmpCombine::And:
             {
                 for( long nY = 0L; nY < nHeight; nY++ ) for( long nX = 0L; nX < nWidth; nX++ )
                 {
@@ -1757,19 +1733,7 @@ bool Bitmap::CombineSimple( const Bitmap& rMask, BmpCombine eCombine )
             }
             break;
 
-            case BMP_COMBINE_NAND:
-            {
-                for( long nY = 0L; nY < nHeight; nY++ ) for( long nX = 0L; nX < nWidth; nX++ )
-                {
-                    if( pMaskAcc->GetPixel( nY, nX ) != aMaskBlack && pAcc->GetPixel( nY, nX ) != aBlack )
-                        pAcc->SetPixel( nY, nX, aBlack );
-                    else
-                        pAcc->SetPixel( nY, nX, aWhite );
-                }
-            }
-            break;
-
-            case BMP_COMBINE_OR:
+            case BmpCombine::Or:
             {
                 for( long nY = 0L; nY < nHeight; nY++ ) for( long nX = 0L; nX < nWidth; nX++ )
                 {
@@ -1781,53 +1745,6 @@ bool Bitmap::CombineSimple( const Bitmap& rMask, BmpCombine eCombine )
             }
             break;
 
-            case BMP_COMBINE_NOR:
-            {
-                for( long nY = 0L; nY < nHeight; nY++ ) for( long nX = 0L; nX < nWidth; nX++ )
-                {
-                    if( pMaskAcc->GetPixel( nY, nX ) != aMaskBlack || pAcc->GetPixel( nY, nX ) != aBlack )
-                        pAcc->SetPixel( nY, nX, aBlack );
-                    else
-                        pAcc->SetPixel( nY, nX, aWhite );
-                }
-            }
-            break;
-
-            case BMP_COMBINE_XOR:
-            {
-                for( long nY = 0L; nY < nHeight; nY++ ) for( long nX = 0L; nX < nWidth; nX++ )
-                {
-                    aPixel = pAcc->GetPixel( nY, nX );
-                    aMaskPixel = pMaskAcc->GetPixel( nY, nX );
-
-                    if( ( aMaskPixel != aMaskBlack && aPixel == aBlack ) ||
-                        ( aMaskPixel == aMaskBlack && aPixel != aBlack ) )
-                    {
-                        pAcc->SetPixel( nY, nX, aWhite );
-                    }
-                    else
-                        pAcc->SetPixel( nY, nX, aBlack );
-                }
-            }
-            break;
-
-            case BMP_COMBINE_NXOR:
-            {
-                for( long nY = 0L; nY < nHeight; nY++ ) for( long nX = 0L; nX < nWidth; nX++ )
-                {
-                    aPixel = pAcc->GetPixel( nY, nX );
-                    aMaskPixel = pMaskAcc->GetPixel( nY, nX );
-
-                    if( ( aMaskPixel != aMaskBlack && aPixel == aBlack ) ||
-                        ( aMaskPixel == aMaskBlack && aPixel != aBlack ) )
-                    {
-                        pAcc->SetPixel( nY, nX, aBlack );
-                    }
-                    else
-                        pAcc->SetPixel( nY, nX, aWhite );
-                }
-            }
-            break;
         }
 
         bRet = true;


More information about the Libreoffice-commits mailing list