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

Noel Grandin noel.grandin at collabora.co.uk
Fri Mar 16 18:24:35 UTC 2018


 filter/source/msfilter/msdffimp.cxx |    9 +++------
 include/vcl/bitmapex.hxx            |    1 +
 vcl/source/gdi/bitmapex.cxx         |    8 ++++++++
 3 files changed, 12 insertions(+), 6 deletions(-)

New commits:
commit 8015e0a15d1b8c454c26c645c7e8ebee9c4e1ee1
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Fri Mar 16 13:43:08 2018 +0200

    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 at collabora.com>
    Tested-by: Jenkins <ci at libreoffice.org>

diff --git a/filter/source/msfilter/msdffimp.cxx b/filter/source/msfilter/msdffimp.cxx
index 960fa7f1ed2d..7c77dff78824 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 4876180e10c4..d78f273b21ad 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 1dcc72befeaf..14b3fa17efd6 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: */


More information about the Libreoffice-commits mailing list