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

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Wed May 5 07:48:54 UTC 2021


 include/vcl/BitmapDuoToneFilter.hxx          |    6 +++---
 vcl/source/bitmap/BitmapDuoToneFilter.cxx    |    8 ++------
 vcl/source/graphic/UnoGraphicTransformer.cxx |    5 ++++-
 3 files changed, 9 insertions(+), 10 deletions(-)

New commits:
commit c0771af1b35269b58b35df52004604b20971c6ae
Author:     Noel Grandin <noelgrandin at gmail.com>
AuthorDate: Tue May 4 20:48:26 2021 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Wed May 5 09:48:05 2021 +0200

    sal_uLong->Color in BitmapDuoToneFilter
    
    Change-Id: I3f57d9b21d439fa8449579d9cdaac9377ac80934
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115110
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/include/vcl/BitmapDuoToneFilter.hxx b/include/vcl/BitmapDuoToneFilter.hxx
index bb83a121fa52..27ade1cb297f 100644
--- a/include/vcl/BitmapDuoToneFilter.hxx
+++ b/include/vcl/BitmapDuoToneFilter.hxx
@@ -18,7 +18,7 @@ class BitmapEx;
 class BitmapDuoToneFilter final : public BitmapFilter
 {
 public:
-    BitmapDuoToneFilter(sal_uLong nColorOne, sal_uLong nColorTwo)
+    BitmapDuoToneFilter(Color nColorOne, Color nColorTwo)
         : mnColorOne(nColorOne)
         , mnColorTwo(nColorTwo)
     {
@@ -27,8 +27,8 @@ public:
     virtual BitmapEx execute(BitmapEx const& rBitmapEx) const override;
 
 private:
-    sal_uLong mnColorOne;
-    sal_uLong mnColorTwo;
+    Color mnColorOne;
+    Color mnColorTwo;
 };
 
 #endif
diff --git a/vcl/source/bitmap/BitmapDuoToneFilter.cxx b/vcl/source/bitmap/BitmapDuoToneFilter.cxx
index 9afb82ee9237..3c91245460b7 100644
--- a/vcl/source/bitmap/BitmapDuoToneFilter.cxx
+++ b/vcl/source/bitmap/BitmapDuoToneFilter.cxx
@@ -32,12 +32,8 @@ BitmapEx BitmapDuoToneFilter::execute(BitmapEx const& rBitmapEx) const
     Bitmap aResultBitmap(aBitmap.GetSizePixel(), vcl::PixelFormat::N24_BPP);
     Bitmap::ScopedReadAccess pReadAcc(aBitmap);
     BitmapScopedWriteAccess pWriteAcc(aResultBitmap);
-    const BitmapColor aColorOne(static_cast<sal_uInt8>(mnColorOne >> 16),
-                                static_cast<sal_uInt8>(mnColorOne >> 8),
-                                static_cast<sal_uInt8>(mnColorOne));
-    const BitmapColor aColorTwo(static_cast<sal_uInt8>(mnColorTwo >> 16),
-                                static_cast<sal_uInt8>(mnColorTwo >> 8),
-                                static_cast<sal_uInt8>(mnColorTwo));
+    const BitmapColor aColorOne(mnColorOne);
+    const BitmapColor aColorTwo(mnColorTwo);
 
     for (tools::Long x = 0; x < nWidth; x++)
     {
diff --git a/vcl/source/graphic/UnoGraphicTransformer.cxx b/vcl/source/graphic/UnoGraphicTransformer.cxx
index 0edeaddb0213..9be6c2dbf4f6 100644
--- a/vcl/source/graphic/UnoGraphicTransformer.cxx
+++ b/vcl/source/graphic/UnoGraphicTransformer.cxx
@@ -98,7 +98,10 @@ uno::Reference< graphic::XGraphic > SAL_CALL GraphicTransformer::applyDuotone(
     AlphaMask   aMask( aBitmapEx.GetAlpha() );
 
     BitmapEx    aTmpBmpEx(aBitmapEx.GetBitmap());
-    BitmapFilter::Filter(aTmpBmpEx, BitmapDuoToneFilter(static_cast<sal_uLong>(nColorOne), static_cast<sal_uLong>(nColorTwo)));
+    BitmapFilter::Filter(aTmpBmpEx,
+                    BitmapDuoToneFilter(
+                        Color(ColorTransparency, nColorOne),
+                        Color(ColorTransparency, nColorTwo)));
 
     aReturnGraphic = ::Graphic( BitmapEx( aTmpBmpEx.GetBitmap(), aMask ) );
     aReturnGraphic.setOriginURL(aGraphic.getOriginURL());


More information about the Libreoffice-commits mailing list