From 0cee6ebc77c9477ddfe5710812058b24ba9c0b02 Mon Sep 17 00:00:00 2001 From: giraffedata Date: Sat, 8 Sep 2018 15:57:44 +0000 Subject: Fix bug: signed value declared unsigned, so row below center of a region looks like a row way above it and gets ignored git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@3320 9d0c8265-081b-0410-96cb-a4ca84ce46f8 --- analyzer/pamgetcolor.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'analyzer') diff --git a/analyzer/pamgetcolor.c b/analyzer/pamgetcolor.c index 123ae23f..cd9d2028 100644 --- a/analyzer/pamgetcolor.c +++ b/analyzer/pamgetcolor.c @@ -379,7 +379,7 @@ readChord(RegData * const dataP, uint const x0, uint const x1) { /*---------------------------------------------------------------------------- - Update region sample *dataP with the data from horisontal chord lying in row + Update region sample *dataP with the data from horizontal chord lying in row 'row' and going from 'x0' to 'x1'. 'linear' means tuples in 'row' are the intensity-linear values as opposed to normal libnetpbm gamma-adjusted values. @@ -421,13 +421,15 @@ processRow(tuple * const row, for (r = 0; r < cmdLineP->regN; ++r) { RegSpec const spec = cmdLineP->regSpecs[r]; RegData * const dataP = ®Samples[r]; - uint const yd = spec.y - y; + int const yd = (int)spec.y - (int)y; if (abs(yd) > cmdLineP->radius) { - /* Avoid the slow root operation */ + /* Row is entirely above or below the region; Avoid the slow root + operation + */ } else { uint const xd2 = sqri(cmdLineP->radius) - sqri(yd); - uint const xd = (int)(sqrt((double)xd2) + 0.5); + uint const xd = ROUNDU(sqrt((double)xd2)); int x0, x1; -- cgit 1.4.1