src/hg/hgTracks/chainTrack.c 1.35

1.35 2009/08/13 06:27:00 markd
simplify computer chain normalized score gray scale suggest by jk
Index: src/hg/hgTracks/chainTrack.c
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/hg/hgTracks/chainTrack.c,v
retrieving revision 1.34
retrieving revision 1.35
diff -b -B -U 4 -r1.34 -r1.35
--- src/hg/hgTracks/chainTrack.c	13 Aug 2009 04:15:52 -0000	1.34
+++ src/hg/hgTracks/chainTrack.c	13 Aug 2009 06:27:00 -0000	1.35
@@ -12,8 +12,9 @@
 #include "chainBlock.h"
 #include "chainLink.h"
 #include "chainDb.h"
 #include "chainCart.h"
+#include "hgColors.h"
 
 static char const rcsid[] = "$Id$";
 
 
@@ -298,13 +299,9 @@
     lf->grayIx = maxShade;
     if (chainCart->chainColor == chainColorScoreColors)
 	{
 	float normScore = sqlFloat((row+rowOffset)[11]);
-	lf->grayIx = (int) ((float)maxShade * (normScore/100.0));
-	if (lf->grayIx > (maxShade+1))
-            lf->grayIx = maxShade+1;
-        else if (lf->grayIx == 0)
-            lf->grayIx = 1;
+        lf->grayIx = hGrayInRange(normScore, 0, 100, maxShade+1);
 	lf->score = normScore;
 	}
     else
 	lf->score = chain.score;