implement platform-agnostic comparison without abs()

pull/1761/head
abishai 2017-01-31 10:42:57 +03:00
parent 9e9b1a3a35
commit 97380f009b
1 changed files with 3 additions and 5 deletions

View File

@ -1658,11 +1658,9 @@ Image *Image::Highlight( unsigned int n_images, Image *images[], const Rgb thres
{
uint8_t *psrc = images[j]->buffer+c;
#ifndef SOLARIS
if ( (unsigned)abs((*psrc)-RGB_VAL(ref_colour,c)) >= RGB_VAL(threshold,c) )
#else
if ( (unsigned)std::abs((*psrc)-RGB_VAL(ref_colour,c)) >= RGB_VAL(threshold,c) )
#endif
unsigned int diff = ((*psrc)-RGB_VAL(ref_colour,c)) > 0 ? (*psrc)-RGB_VAL(ref_colour,c) : RGB_VAL(ref_colour,c) - (*psrc);
if (diff >= RGB_VAL(threshold,c))
{
count++;
}