move some mask code from SvxMSDffManager::ImportGraphic inside BitmapEx

part of moving GetMask/GetAlpha touching code inside vcl

Change-Id: I46e908ed6216dd521143ca94d2dcbd7e95d8b9ce
Reviewed-on: https://gerrit.libreoffice.org/51408
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Tested-by: Jenkins <ci@libreoffice.org>
diff --git a/filter/source/msfilter/msdffimp.cxx b/filter/source/msfilter/msdffimp.cxx
index 960fa7f..7c77dff 100644
--- a/filter/source/msfilter/msdffimp.cxx
+++ b/filter/source/msfilter/msdffimp.cxx
@@ -3822,12 +3822,9 @@ SdrObject* SvxMSDffManager::ImportGraphic( SvStream& rSt, SfxItemSet& rSet, cons

                if ( aGraf.GetType() == GraphicType::Bitmap )
                {
                    BitmapEx    aBitmapEx( aGraf.GetBitmapEx() );
                    Bitmap      aBitmap( aBitmapEx.GetBitmap() );
                    Bitmap      aMask( aBitmap.CreateMask( MSO_CLR_ToColor( nTransColor, DFF_Prop_pictureTransparent ), 9 ) );
                    if ( aBitmapEx.IsTransparent() )
                        aMask.CombineSimple( aBitmapEx.GetMask(), BmpCombine::Or );
                    aGraf = BitmapEx( aBitmap, aMask );
                    BitmapEx aBitmapEx( aGraf.GetBitmapEx() );
                    aBitmapEx.CombineMaskOr( MSO_CLR_ToColor( nTransColor, DFF_Prop_pictureTransparent ), 9 );
                    aGraf = aBitmapEx;
                }
            }

diff --git a/include/vcl/bitmapex.hxx b/include/vcl/bitmapex.hxx
index 4876180..d78f273 100644
--- a/include/vcl/bitmapex.hxx
+++ b/include/vcl/bitmapex.hxx
@@ -448,6 +448,7 @@ public:

    void                AdjustTransparency( sal_uInt8 cTrans );

    void                CombineMaskOr(Color maskColor, sal_uInt8 nTol);
public:

    SAL_DLLPRIVATE std::shared_ptr<ImpBitmap> const & ImplGetBitmapImpBitmap() const { return maBitmap.ImplGetImpBitmap(); }
diff --git a/vcl/source/gdi/bitmapex.cxx b/vcl/source/gdi/bitmapex.cxx
index 1dcc72b..14b3fa1 100644
--- a/vcl/source/gdi/bitmapex.cxx
+++ b/vcl/source/gdi/bitmapex.cxx
@@ -1441,4 +1441,12 @@ void BitmapEx::GetSplitData( std::vector<sal_uInt8>& rvColorData, std::vector<sa
    }
}

void BitmapEx::CombineMaskOr(Color maskColor, sal_uInt8 nTol)
{
    Bitmap aNewMask = maBitmap.CreateMask( maskColor, nTol );
    if ( IsTransparent() )
         aNewMask.CombineSimple( maMask, BmpCombine::Or );
    maMask = aNewMask;
}

/* vim:set shiftwidth=4 softtabstop=4 expandtab: */