src/hg/hgTracks/wigTrack.c 1.96

1.96 2009/11/17 22:41:59 kent
Making whiskers take light and medium color from primary color rather than always using grays.
Index: src/hg/hgTracks/wigTrack.c
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/hg/hgTracks/wigTrack.c,v
retrieving revision 1.95
retrieving revision 1.96
diff -b -B -U 4 -r1.95 -r1.96
--- src/hg/hgTracks/wigTrack.c	17 Nov 2009 20:47:50 -0000	1.95
+++ src/hg/hgTracks/wigTrack.c	17 Nov 2009 22:41:59 -0000	1.96
@@ -792,10 +792,11 @@
 {
 int x1;
 int h = tg->lineHeight;	/*	the height of our drawing window */
 double scaleFactor = h/graphRange;
-Color mediumColor = shadesOfGray[grayInRange(30, 0, 100)];
-Color lightColor = shadesOfGray[grayInRange(15, 0, 100)];
+Color oldDrawColor = colorArray[0] + 1;	/* Just to be different from 1st drawColor. */
+Color mediumColor = MG_BLACK;	// Will be overriden
+Color lightColor = MG_BLACK;	// Will be overriden
 Color clipColor = MG_MAGENTA;
 enum wiggleGraphOptEnum lineBar = wigCart->lineBar;
 boolean whiskers = (wigCart->windowingFunction == wiggleWindowWhiskers);
 
@@ -806,12 +807,19 @@
  *	are all the same height in a run.
  */
 for (x1 = 0; x1 < width; ++x1)
     {
-    Color drawColor = colorArray[x1];
     int preDrawIndex = x1 + preDrawZero;
     struct preDrawElement *p = &preDraw[preDrawIndex];
 
+    Color drawColor = colorArray[x1];
+    if (drawColor != oldDrawColor)
+        {
+	mediumColor = lighterColor(hvg, drawColor);
+	lightColor = lighterColor(hvg, mediumColor);
+	oldDrawColor = drawColor;
+        }
+
     /*	count is non-zero meaning valid data exists here	*/
     if (p->count)
 	{
 	/*	data value has been picked by previous scanning.
@@ -856,10 +864,8 @@
 			    }
 			int boxHeight = scaledVal - zeroPos;
 			if (boxHeight < 1) boxHeight = 1;
 			hvGfxBox(hvg, x1+xOff, zeroPos, 1, boxHeight, drawColor);
-#ifdef SOON
-#endif /* SOON */
 			}
 		    else
 		        {
 			int scaledMax = scaleHeightToPixels(p->max);