[Libreoffice-commits] core.git: Branch 'libreoffice-5-2' - vcl/source

Caolán McNamara caolanm at redhat.com
Mon Jul 11 14:19:49 UTC 2016


 vcl/source/gdi/bitmap.cxx |   36 ++++++++++++++++++------------------
 1 file changed, 18 insertions(+), 18 deletions(-)

New commits:
commit a1979c74cf072feac6c39399eee35ffba4319639
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon Jul 11 10:13:16 2016 +0100

    Resolves: tdf#100463 tolerence in contour editor doesn't work
    
    probably since
    
    commit f51f03a46102333bac6a7fe06bc8538492f413a5
    Author: Stephan Bergmann <sbergman at redhat.com>
    Date:   Wed Mar 5 12:24:14 2014 +0100
    
        Do not needlessly truncate MinMax argument before comparison with bounds
    
    Change-Id: I5c92f0af3e05ad68ed88fa860b36e8426e160bf9
    (cherry picked from commit d5bd18ecac5806b7b4e39a1919b6b56df0f94ce3)
    Reviewed-on: https://gerrit.libreoffice.org/27101
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Jan Holesovsky <kendy at collabora.com>

diff --git a/vcl/source/gdi/bitmap.cxx b/vcl/source/gdi/bitmap.cxx
index b30c71e..63425de 100644
--- a/vcl/source/gdi/bitmap.cxx
+++ b/vcl/source/gdi/bitmap.cxx
@@ -1221,12 +1221,12 @@ Bitmap Bitmap::CreateMask( const Color& rTransColor, sal_uLong nTol ) const
             {
                 BitmapColor aCol;
                 long        nR, nG, nB;
-                const long  nMinR = MinMax( (long) rTransColor.GetRed() - nTol, 0, 255 );
-                const long  nMaxR = MinMax( (long) rTransColor.GetRed() + nTol, 0, 255 );
-                const long  nMinG = MinMax( (long) rTransColor.GetGreen() - nTol, 0, 255 );
-                const long  nMaxG = MinMax( (long) rTransColor.GetGreen() + nTol, 0, 255 );
-                const long  nMinB = MinMax( (long) rTransColor.GetBlue() - nTol, 0, 255 );
-                const long  nMaxB = MinMax( (long) rTransColor.GetBlue() + nTol, 0, 255 );
+                const long  nMinR = MinMax<long>(rTransColor.GetRed() - nTol, 0, 255);
+                const long  nMaxR = MinMax<long>(rTransColor.GetRed() + nTol, 0, 255);
+                const long  nMinG = MinMax<long>(rTransColor.GetGreen() - nTol, 0, 255);
+                const long  nMaxG = MinMax<long>(rTransColor.GetGreen() + nTol, 0, 255);
+                const long  nMinB = MinMax<long>(rTransColor.GetBlue() - nTol, 0, 255);
+                const long  nMaxB = MinMax<long>(rTransColor.GetBlue() + nTol, 0, 255);
 
                 if( pReadAcc->HasPalette() )
                 {
@@ -1538,12 +1538,12 @@ bool Bitmap::Replace( const Color& rSearchColor, const Color& rReplaceColor, sal
 
     if( pAcc )
     {
-        const long  nMinR = MinMax( (long) rSearchColor.GetRed() - nTol, 0, 255 );
-        const long  nMaxR = MinMax( (long) rSearchColor.GetRed() + nTol, 0, 255 );
-        const long  nMinG = MinMax( (long) rSearchColor.GetGreen() - nTol, 0, 255 );
-        const long  nMaxG = MinMax( (long) rSearchColor.GetGreen() + nTol, 0, 255 );
-        const long  nMinB = MinMax( (long) rSearchColor.GetBlue() - nTol, 0, 255 );
-        const long  nMaxB = MinMax( (long) rSearchColor.GetBlue() + nTol, 0, 255 );
+        const long  nMinR = MinMax<long>(rSearchColor.GetRed() - nTol, 0, 255);
+        const long  nMaxR = MinMax<long>(rSearchColor.GetRed() + nTol, 0, 255);
+        const long  nMinG = MinMax<long>(rSearchColor.GetGreen() - nTol, 0, 255);
+        const long  nMaxG = MinMax<long>(rSearchColor.GetGreen() + nTol, 0, 255);
+        const long  nMinB = MinMax<long>(rSearchColor.GetBlue() - nTol, 0, 255);
+        const long  nMaxB = MinMax<long>(rSearchColor.GetBlue() + nTol, 0, 255);
 
         if( pAcc->HasPalette() )
         {
@@ -1622,12 +1622,12 @@ bool Bitmap::Replace( const Color* pSearchColors, const Color* pReplaceColors,
             const Color&    rCol = pSearchColors[ i ];
             const long      nTol = pTols[ i ];
 
-            pMinR[ i ] = MinMax( (long) rCol.GetRed() - nTol, 0, 255 );
-            pMaxR[ i ] = MinMax( (long) rCol.GetRed() + nTol, 0, 255 );
-            pMinG[ i ] = MinMax( (long) rCol.GetGreen() - nTol, 0, 255 );
-            pMaxG[ i ] = MinMax( (long) rCol.GetGreen() + nTol, 0, 255 );
-            pMinB[ i ] = MinMax( (long) rCol.GetBlue() - nTol, 0, 255 );
-            pMaxB[ i ] = MinMax( (long) rCol.GetBlue() + nTol, 0, 255 );
+            pMinR[ i ] = MinMax<long>(rCol.GetRed() - nTol, 0, 255);
+            pMaxR[ i ] = MinMax<long>(rCol.GetRed() + nTol, 0, 255);
+            pMinG[ i ] = MinMax<long>(rCol.GetGreen() - nTol, 0, 255);
+            pMaxG[ i ] = MinMax<long>(rCol.GetGreen() + nTol, 0, 255);
+            pMinB[ i ] = MinMax<long>(rCol.GetBlue() - nTol, 0, 255);
+            pMaxB[ i ] = MinMax<long>(rCol.GetBlue() + nTol, 0, 255);
         }
 
         if( pAcc->HasPalette() )


More information about the Libreoffice-commits mailing list