diff options
author | Caolán McNamara <caolanm@redhat.com> | 2016-07-11 10:13:16 +0100 |
---|---|---|
committer | Jan Holesovsky <kendy@collabora.com> | 2016-07-11 14:19:45 +0000 |
commit | 95024423f38a5050f614e2d14837eebdbc348a4a (patch) | |
tree | 4a9f0eb8d954079a4b8ffb003e6b08027aba6f93 | |
parent | 9613bb90986277f3a222bea9a6d6d11f53a36622 (diff) |
Resolves: tdf#100463 tolerence in contour editor doesn't work
probably since
commit f51f03a46102333bac6a7fe06bc8538492f413a5
Author: Stephan Bergmann <sbergman@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/27102
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Jan Holesovsky <kendy@collabora.com>
-rw-r--r-- | vcl/source/gdi/bitmap.cxx | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/vcl/source/gdi/bitmap.cxx b/vcl/source/gdi/bitmap.cxx index 6b675edc4f5e..6141e1b2c417 100644 --- a/vcl/source/gdi/bitmap.cxx +++ b/vcl/source/gdi/bitmap.cxx @@ -1257,12 +1257,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() ) { @@ -1579,12 +1579,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() ) { @@ -1663,12 +1663,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() ) |