3904cbc6353d7d6d09d7615bfddf7449456588f5 kent Tue Apr 19 16:54:41 2011 -0700 Making autoscale work as you'd hope for multiWigs - where all the wigs have a common scale. diff --git src/hg/hgTracks/bedGraph.c src/hg/hgTracks/bedGraph.c index 038c494..82e04b7 100644 --- src/hg/hgTracks/bedGraph.c +++ src/hg/hgTracks/bedGraph.c @@ -123,32 +123,36 @@ sqlFreeResult(&sr); hFreeConn(&conn); slReverse(&bgList); tg->items = bgList; } /* bedGraphLoadItems() */ static void bedGraphFreeItems(struct track *tg) { #if defined(DEBUG) snprintf(dbgMsg, DBGMSGSZ, "I haven't seen bedGraphFreeItems ever called ?"); wigDebugPrint("bedGraphFreeItems"); #endif } struct preDrawContainer *bedGraphLoadPreDraw(struct track *tg, int seqStart, int seqEnd, int width) -/* Do bits that load the predraw buffer tg->preDraw and also preDrawSize and preDrawZero. */ +/* Do bits that load the predraw buffer tg->preDrawContainer. */ { +/* Just need to do this once... */ +if (tg->preDrawContainer) + return tg->preDrawContainer; + struct bedGraphItem *wi; double pixelsPerBase = scaleForPixels(width); double basesPerPixel = 1.0; int i; /* an integer loop counter */ if (pixelsPerBase > 0.0) basesPerPixel = 1.0 / pixelsPerBase; /* Allocate predraw and save it and related info in the track. */ struct preDrawContainer *pre = tg->preDrawContainer = initPreDrawContainer(width); struct preDrawElement *preDraw = pre->preDraw; /* to accumulate everything in prep for draw */ int preDrawZero = pre->preDrawZero; /* location in preDraw where screen starts */ int preDrawSize = pre->preDrawSize; /* size of preDraw array */ /* walk through all the data fill in the preDraw array */ for (wi = tg->items; wi != NULL; wi = wi->next) @@ -260,19 +264,20 @@ track->loadItems = bedGraphLoadItems; track->freeItems = bedGraphFreeItems; track->drawItems = bedGraphDrawItems; track->itemName = bedGraphName; track->mapItemName = bedGraphName; track->totalHeight = wigTotalHeight; track->itemHeight = tgFixedItemHeight; track->itemStart = tgItemNoStart; track->itemEnd = tgItemNoEnd; track->mapsSelf = TRUE; track->extraUiData = (void *) wigCart; track->colorShades = shadesOfGray; track->drawLeftLabels = wigLeftLabels; +track->loadPreDraw = bedGraphLoadPreDraw; /* the lfSubSample type makes the image map function correctly */ track->subType = lfSubSample; /*make subType be "sample" (=2)*/ } /* bedGraphMethods() */