dc9e7527ce8516efbb098a4f0f8702d49986677b
kate
  Thu Jul 16 09:44:16 2015 -0700
Removing obsolete 8-bit color support. refs #15722

diff --git src/lib/pscmGfx.c src/lib/pscmGfx.c
index af30b54..2234994 100644
--- src/lib/pscmGfx.c
+++ src/lib/pscmGfx.c
@@ -81,175 +81,94 @@
 double y1 = y;
 /* pad a half-pixel all the way around the box */
 x1 -= 0.5;
 y1 -= 0.5;
 x2 += 0.5;
 y2 += 0.5;
 psClipRect(pscm->ps, x1, y1, x2-x1, y2-y1);
 }
 
 void pscmUnclip(struct pscmGfx *pscm)
 /* Set clipping rect to cover full thing. */
 {
 pscmSetClip(pscm, 0, 0, pscm->ps->userWidth, pscm->ps->userHeight);
 }
 
-#ifndef COLOR32
-static Color pscmClosestColor(struct pscmGfx *pscm, 
-	unsigned char r, unsigned char g, unsigned char b)
-/* Returns closest color in color map to r,g,b */
-{
-struct rgbColor *c = pscm->colorMap;
-int closestDist = 0x7fffffff;
-int closestIx = -1;
-int dist, dif;
-int i;
-
-for (i=0; i<pscm->colorsUsed; ++i)
-    {
-    dif = c->r - r;
-    dist = dif*dif;
-    dif = c->g - g;
-    dist += dif*dif;
-    dif = c->b - b;
-    dist += dif*dif;
-    if (dist < closestDist)
-        {
-        closestDist = dist;
-        closestIx = i;
-        }
-    ++c;
-    }
-return closestIx;
-}
-
-static Color pscmAddColor(struct pscmGfx *pscm, 
-	unsigned char r, unsigned char g, unsigned char b)
-/* Adds color to end of color map if there's room. */
-{
-int colIx = pscm->colorsUsed;
-struct rgbColor *c = pscm->colorMap + pscm->colorsUsed;
-c->r = r;
-c->g = g;
-c->b = b;
-pscm->colorsUsed += 1;
-colHashAdd(pscm->colorHash, r, g, b, colIx);;
-return (Color)colIx;
-}
-#endif
-
 int pscmFindColorIx(struct pscmGfx *pscm, int r, int g, int b)
 /* Returns closest color in color map to rgb values.  If it doesn't
  * already exist in color map and there's room, it will create
  * exact color in map. */
 {
-#ifdef COLOR32
 return MAKECOLOR_32(r,g,b);
-#else
-struct colHashEl *che;
-if (r>255||g>255||b>255) 
-    errAbort("RGB values out of range (0-255).  r:%d g:%d b:%d", r, g, b);
-if ((che = colHashLookup(pscm->colorHash, r, g, b)) != NULL)
-    return che->ix;
-if (pscm->colorsUsed < 256)
-    return pscmAddColor(pscm, r, g, b);
-return pscmClosestColor(pscm, r, g, b);
-#endif
 }
 
 
 struct rgbColor pscmColorIxToRgb(struct pscmGfx *pscm, int colorIx)
 /* Return rgb value at color index. */
 {
-#ifdef COLOR32
 static struct rgbColor rgb;
 rgb.r = (colorIx >> 0) & 0xff;
 rgb.g = (colorIx >> 8) & 0xff;
 rgb.b = (colorIx >> 16) & 0xff;
 
 return rgb;
-#else
-return pscm->colorMap[colorIx];
-#endif
 }
 
-#ifndef COLOR32
-static void pscmSetDefaultColorMap(struct pscmGfx *pscm)
-/* Set up default color map for a memGfx. */
-{
-/* Note dependency in order here and in MG_WHITE, MG_BLACK, etc. */
-int i;
-for (i=0; i<ArraySize(mgFixedColors); ++i)
-    {
-    struct rgbColor *c = &mgFixedColors[i];
-    pscmFindColorIx(pscm, c->r, c->g, c->b);
-    }
-}
-#endif
-
 void pscmSetWriteMode(struct pscmGfx *pscm, unsigned int writeMode)
 /* Set write mode */
 {
 pscm->writeMode = writeMode;
 }
 
 struct pscmGfx *pscmOpen(int width, int height, char *file)
 /* Return new pscmGfx. */
 {
 struct pscmGfx *pscm;
 
 AllocVar(pscm);
 pscm->ps = psOpen(file, width, height, 72.0 * 7.5, 0, 0);
 psTranslate(pscm->ps,0.5,0.5);  /* translate all coordinates to pixel centers */
-#ifndef COLOR32
-pscm->colorHash = colHashNew();
-pscmSetDefaultColorMap(pscm);
-#endif
 pscm->clipMinX = pscm->clipMinY = 0;
 pscm->clipMaxX = width;     
 pscm->clipMaxY = height;
 pscm->hints = hashNew(6);
 return pscm;
 }
 
 void pscmClose(struct pscmGfx **pPscm)
 /* Finish writing out and free structure. */
 {
 struct pscmGfx *pscm = *pPscm;
 if (pscm != NULL)
     {
     psClose(&pscm->ps);
     colHashFree(&pscm->colorHash);
     freez(pPscm);
     }
 }
 
 void pscmSetColor(struct pscmGfx *pscm, Color color)
 /* Set current color to Color. */
 {
 struct rgbColor *col;
 
-#ifdef COLOR32
 struct rgbColor myCol;
 col = &myCol;
 
 col->r = (color >> 0) & 0xff;
 col->g = (color >> 8) & 0xff;
 col->b = (color >> 16) & 0xff;
-#else
-col = pscm->colorMap + color;
-#endif
 
 if (color != pscm->curColor)
     {
     psSetColor(pscm->ps, col->r, col->g, col->b);
     pscm->curColor = color;
     }
 }
 
 void pscmBoxToPs(struct pscmGfx *pscm, int x, int y, 
 	int width, int height)
 /* adjust coordinates for PS */
 {
 /* Do some clipping here to make the postScript
  * easier to edit in illustrator. */
 double x2 = x + width;