6ebd41094a6b59a7c9b2e8d7ce364b502efe4cf1 braney Fri Sep 16 11:40:06 2011 -0700 labels on BAM tracks using tag coloring weren't drawing with an 0 alpha value #5338 diff --git src/hg/hgTracks/bamTrack.c src/hg/hgTracks/bamTrack.c index 8d0b321..6883e7d 100644 --- src/hg/hgTracks/bamTrack.c +++ src/hg/hgTracks/bamTrack.c @@ -238,31 +238,31 @@ UBYTE *quals = bamGetQueryQuals(bam, TRUE); lf->components = expandSfQuals(lf->components, quals, lf->orientation, clippedQLen, btd->baseQualShadeMin, btd->baseQualShadeMax); lf->grayIx = maxShade - 3; } else if (sameString(btd->colorMode, BAM_COLOR_MODE_TAG) && isNotEmpty(btd->userTag)) { char buf[16]; char *rgb = bamGetTagString(bam, btd->userTag, buf, sizeof(buf)); if (rgb != NULL) { // We don't have access to hvg at loadtime, so can't allocate color here. // Instead, pack RGB values into lf->filterColor which fortunately is an int. unsigned char r, g, b; if (parseRgb(rgb, &r, &g, &b)) - lf->filterColor = ((r & 0xff) << 16) | ((g & 0xff) << 8) | (b & 0xff); + lf->filterColor = MAKECOLOR_32(r,g,b); else { static boolean already = FALSE; if (! already) { warn("%s: At least one BAM tag value for %s (%s) is not in the expected " "RGB format: N,N,N where each N is from 0 to 255.", btd->tg->tdb->shortLabel, btd->userTag, htmlEncode(rgb)); already = TRUE; btd->userTag = NULL; } } } else lf->grayIx = maxShade; @@ -586,38 +586,34 @@ { drawOpt = baseColorDrawSetup(hvg, tg, lf, &mrnaSeq, &psl); if (drawOpt > baseColorDrawOff) exonArrows = FALSE; } static Color darkBlueColor = 0; static Color darkRedColor = 0; if (darkRedColor == 0) { darkRedColor = hvGfxFindColorIx(hvg, 100,0,0); darkBlueColor = hvGfxFindColorIx(hvg, 0,0,100); } if (sameString(colorMode, BAM_COLOR_MODE_STRAND)) color = (lf->orientation < 0) ? darkRedColor : darkBlueColor; -else if (lf->filterColor > 0) - { - // In bamTrack, lf->filterColor is a packed int. Unpack: - int r, g, b; - r = (lf->filterColor >> 16) & 0xff; - g = (lf->filterColor >> 8) & 0xff; - b = lf->filterColor & 0xff; - color = hvGfxFindColorIx(hvg, r, g, b); +else if (lf->filterColor != 0) + { + // In bamTrack, lf->filterColor is an RGBA value + color = lf->filterColor; } else if (tg->colorShades) color = tg->colorShades[lf->grayIx]; else color = tg->ixColor; indelEnabled(cart, tg->tdb, basesPerPixel, &indelShowDoubleInsert, &indelShowQueryInsert, &indelShowPolyA); if (!indelShowDoubleInsert) innerLine(hvg, x1, midY, w, color); for (sf = lf->components; sf != NULL; sf = sf->next) { int s = sf->start, e = sf->end; if (e <= s || e < winStart || s > winEnd) continue;