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

Noel (via logerrit) logerrit at kemper.freedesktop.org
Fri Nov 13 11:26:17 UTC 2020


 include/vcl/BitmapConvolutionMatrixFilter.hxx       |    4 +--
 vcl/source/bitmap/BitmapConvolutionMatrixFilter.cxx |    6 ++---
 vcl/source/bitmap/bitmappaint.cxx                   |   24 ++++++++++----------
 3 files changed, 17 insertions(+), 17 deletions(-)

New commits:
commit abd42bdc86904d1b310e8298393c887e0c195499
Author:     Noel <noelgrandin at gmail.com>
AuthorDate: Thu Nov 12 14:50:16 2020 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Fri Nov 13 12:25:12 2020 +0100

    tools::Long->sal_Int32 in vcl filters
    
    Change-Id: I39cf98d1dc3f04ca91856f125b0a5b4fe1dfe237
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105749
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/include/vcl/BitmapConvolutionMatrixFilter.hxx b/include/vcl/BitmapConvolutionMatrixFilter.hxx
index 2d787cefe19f..a504ff0eebbe 100644
--- a/include/vcl/BitmapConvolutionMatrixFilter.hxx
+++ b/include/vcl/BitmapConvolutionMatrixFilter.hxx
@@ -20,7 +20,7 @@ class BitmapEx;
 class VCL_DLLPUBLIC BitmapConvolutionMatrixFilter : public BitmapFilter
 {
 public:
-    BitmapConvolutionMatrixFilter(const tools::Long (&rMatrix)[9])
+    BitmapConvolutionMatrixFilter(const sal_Int32 (&rMatrix)[9])
         : mrMatrix(rMatrix)
     {
     }
@@ -28,7 +28,7 @@ public:
     virtual BitmapEx execute(BitmapEx const& rBitmapEx) const override;
 
 private:
-    const tools::Long (&mrMatrix)[9];
+    const sal_Int32 (&mrMatrix)[9];
 };
 
 #endif
diff --git a/vcl/source/bitmap/BitmapConvolutionMatrixFilter.cxx b/vcl/source/bitmap/BitmapConvolutionMatrixFilter.cxx
index b92a0124b458..2d050b5cc117 100644
--- a/vcl/source/bitmap/BitmapConvolutionMatrixFilter.cxx
+++ b/vcl/source/bitmap/BitmapConvolutionMatrixFilter.cxx
@@ -45,8 +45,8 @@ BitmapEx BitmapConvolutionMatrixFilter::execute(BitmapEx const& rBitmapEx) const
             BitmapColor* pRowTmp3 = pColRow3.get();
             BitmapColor* pColor;
             tools::Long nY, nX, i, nSumR, nSumG, nSumB, nMatrixVal, nTmp;
-            std::array<std::array<tools::Long, 256>, 9> aKoeff;
-            tools::Long* pTmp;
+            std::array<std::array<sal_Int32, 256>, 9> aKoeff;
+            sal_Int32* pTmp;
 
             // create LUT of products of matrix value and possible color component values
             for (nY = 0; nY < 9; nY++)
@@ -199,7 +199,7 @@ BitmapEx BitmapConvolutionMatrixFilter::execute(BitmapEx const& rBitmapEx) const
     return BitmapEx();
 }
 
-const tools::Long g_SharpenMatrix[] = { -1, -1, -1, -1, 16, -1, -1, -1, -1 };
+const sal_Int32 g_SharpenMatrix[] = { -1, -1, -1, -1, 16, -1, -1, -1, -1 };
 
 BitmapSharpenFilter::BitmapSharpenFilter()
     : BitmapConvolutionMatrixFilter(g_SharpenMatrix)
diff --git a/vcl/source/bitmap/bitmappaint.cxx b/vcl/source/bitmap/bitmappaint.cxx
index dd9eb1a5999b..49713869069b 100644
--- a/vcl/source/bitmap/bitmappaint.cxx
+++ b/vcl/source/bitmap/bitmappaint.cxx
@@ -926,12 +926,12 @@ bool Bitmap::Replace(const Color* pSearchColors, const Color* pReplaceColors, sa
 
     if (pAcc)
     {
-        std::unique_ptr<tools::Long[]> pMinR(new tools::Long[nColorCount]);
-        std::unique_ptr<tools::Long[]> pMaxR(new tools::Long[nColorCount]);
-        std::unique_ptr<tools::Long[]> pMinG(new tools::Long[nColorCount]);
-        std::unique_ptr<tools::Long[]> pMaxG(new tools::Long[nColorCount]);
-        std::unique_ptr<tools::Long[]> pMinB(new tools::Long[nColorCount]);
-        std::unique_ptr<tools::Long[]> pMaxB(new tools::Long[nColorCount]);
+        std::unique_ptr<sal_Int8[]> pMinR(new sal_Int8[nColorCount]);
+        std::unique_ptr<sal_Int8[]> pMaxR(new sal_Int8[nColorCount]);
+        std::unique_ptr<sal_Int8[]> pMinG(new sal_Int8[nColorCount]);
+        std::unique_ptr<sal_Int8[]> pMaxG(new sal_Int8[nColorCount]);
+        std::unique_ptr<sal_Int8[]> pMinB(new sal_Int8[nColorCount]);
+        std::unique_ptr<sal_Int8[]> pMaxB(new sal_Int8[nColorCount]);
 
         if (pTols)
         {
@@ -940,12 +940,12 @@ bool Bitmap::Replace(const Color* pSearchColors, const Color* pReplaceColors, sa
                 const Color& rCol = pSearchColors[i];
                 const sal_uInt8 nTol = pTols[i];
 
-                pMinR[i] = MinMax<tools::Long>(rCol.GetRed() - nTol, 0, 255);
-                pMaxR[i] = MinMax<tools::Long>(rCol.GetRed() + nTol, 0, 255);
-                pMinG[i] = MinMax<tools::Long>(rCol.GetGreen() - nTol, 0, 255);
-                pMaxG[i] = MinMax<tools::Long>(rCol.GetGreen() + nTol, 0, 255);
-                pMinB[i] = MinMax<tools::Long>(rCol.GetBlue() - nTol, 0, 255);
-                pMaxB[i] = MinMax<tools::Long>(rCol.GetBlue() + nTol, 0, 255);
+                pMinR[i] = std::clamp(rCol.GetRed() - nTol, 0, 255);
+                pMaxR[i] = std::clamp(rCol.GetRed() + nTol, 0, 255);
+                pMinG[i] = std::clamp(rCol.GetGreen() - nTol, 0, 255);
+                pMaxG[i] = std::clamp(rCol.GetGreen() + nTol, 0, 255);
+                pMinB[i] = std::clamp(rCol.GetBlue() - nTol, 0, 255);
+                pMaxB[i] = std::clamp(rCol.GetBlue() + nTol, 0, 255);
             }
         }
         else


More information about the Libreoffice-commits mailing list