summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2016-07-11 10:13:16 +0100
committerCaolán McNamara <caolanm@redhat.com>2016-07-11 10:25:03 +0100
commitd5bd18ecac5806b7b4e39a1919b6b56df0f94ce3 (patch)
treec42df407cf1a536c76d7a0c719962b3fedff236c
parent99db9f2295eb9a8b3288df9798a292b8d6e1b854 (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
-rw-r--r--vcl/source/gdi/bitmap.cxx36
1 files changed, 18 insertions, 18 deletions
diff --git a/vcl/source/gdi/bitmap.cxx b/vcl/source/gdi/bitmap.cxx
index b30c71e4894d..63425de16629 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() )