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

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Thu Dec 5 09:49:20 UTC 2019


 include/vcl/bitmapex.hxx              |    3 ++-
 vcl/source/filter/jpeg/JpegWriter.cxx |    3 +--
 vcl/source/gdi/bitmapex.cxx           |    8 ++++----
 vcl/source/gdi/impgraph.cxx           |    3 +--
 4 files changed, 8 insertions(+), 9 deletions(-)

New commits:
commit a8cd98c437f2c3b5c4f7c139aa7223c5cfb74d1a
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Thu Dec 5 08:06:12 2019 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Thu Dec 5 10:47:47 2019 +0100

    use o3tl::optional instead of pointer
    
    Change-Id: I71084d668829fdaaf383319697d71b4299f9afea
    Reviewed-on: https://gerrit.libreoffice.org/84500
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/include/vcl/bitmapex.hxx b/include/vcl/bitmapex.hxx
index dd5c715c01b3..2f98362a9e4e 100644
--- a/include/vcl/bitmapex.hxx
+++ b/include/vcl/bitmapex.hxx
@@ -20,6 +20,7 @@
 #ifndef INCLUDED_VCL_BITMAPEX_HXX
 #define INCLUDED_VCL_BITMAPEX_HXX
 
+#include <o3tl/optional.hxx>
 #include <vcl/dllapi.h>
 #include <vcl/alpha.hxx>
 #include <vcl/Scanline.hxx>
@@ -72,7 +73,7 @@ public:
     bool                IsTransparent() const;
     TransparentType     GetTransparentType() const { return meTransparent; }
 
-    Bitmap              GetBitmap( const Color* pTransReplaceColor = nullptr ) const;
+    Bitmap              GetBitmap( o3tl::optional<Color> xTransparentReplaceColor = o3tl::optional<Color>() ) const;
     /// Gives direct access to the contained bitmap.
     const Bitmap&       GetBitmapRef() const;
     Bitmap              GetMask() const;
diff --git a/vcl/source/filter/jpeg/JpegWriter.cxx b/vcl/source/filter/jpeg/JpegWriter.cxx
index a00bb2ab7d3c..82ed4bf98ad9 100644
--- a/vcl/source/filter/jpeg/JpegWriter.cxx
+++ b/vcl/source/filter/jpeg/JpegWriter.cxx
@@ -197,8 +197,7 @@ bool JPEGWriter::Write( const Graphic& rGraphic )
         mxStatusIndicator->start( OUString(), 100 );
     }
 
-    Color replaceColor = COL_WHITE;
-    Bitmap aGraphicBmp( rGraphic.GetBitmapEx().GetBitmap(&replaceColor) );
+    Bitmap aGraphicBmp( rGraphic.GetBitmapEx().GetBitmap(COL_WHITE) );
 
     if ( mbGreys )
     {
diff --git a/vcl/source/gdi/bitmapex.cxx b/vcl/source/gdi/bitmapex.cxx
index b4d7c106b37c..adb14f014ddf 100644
--- a/vcl/source/gdi/bitmapex.cxx
+++ b/vcl/source/gdi/bitmapex.cxx
@@ -233,11 +233,11 @@ const Bitmap& BitmapEx::GetBitmapRef() const
     return maBitmap;
 }
 
-Bitmap BitmapEx::GetBitmap( const Color* pTransReplaceColor ) const
+Bitmap BitmapEx::GetBitmap( o3tl::optional<Color> xTransparentReplaceColor ) const
 {
     Bitmap aRetBmp( maBitmap );
 
-    if( pTransReplaceColor && ( meTransparent != TransparentType::NONE ) )
+    if( xTransparentReplaceColor && ( meTransparent != TransparentType::NONE ) )
     {
         Bitmap aTempMask;
 
@@ -247,9 +247,9 @@ Bitmap BitmapEx::GetBitmap( const Color* pTransReplaceColor ) const
             aTempMask = maMask;
 
         if( !IsAlpha() )
-            aRetBmp.Replace( aTempMask, *pTransReplaceColor );
+            aRetBmp.Replace( aTempMask, *xTransparentReplaceColor );
         else
-            aRetBmp.Replace( GetAlpha(), *pTransReplaceColor );
+            aRetBmp.Replace( GetAlpha(), *xTransparentReplaceColor );
     }
 
     return aRetBmp;
diff --git a/vcl/source/gdi/impgraph.cxx b/vcl/source/gdi/impgraph.cxx
index 280ad3c2f1cd..0591606dba86 100644
--- a/vcl/source/gdi/impgraph.cxx
+++ b/vcl/source/gdi/impgraph.cxx
@@ -683,9 +683,8 @@ Bitmap ImpGraphic::ImplGetBitmap(const GraphicConversionParameters& rParameters)
         }
 
         const BitmapEx& rRetBmpEx = ( mpAnimation ? mpAnimation->GetBitmapEx() : maEx );
-        const Color     aReplaceColor( COL_WHITE );
 
-        aRetBmp = rRetBmpEx.GetBitmap( &aReplaceColor );
+        aRetBmp = rRetBmpEx.GetBitmap( COL_WHITE );
 
         if(rParameters.getSizePixel().Width() || rParameters.getSizePixel().Height())
             aRetBmp.Scale(rParameters.getSizePixel());


More information about the Libreoffice-commits mailing list