c2c92c1b216b92b489d2ebdd46dcc21fb910aee1 angie Fri Jul 8 14:22:47 2011 -0700 Bug #4263 (track items not being drawn in hgTracks when zoomed way in):fixing same integer overflow problem, for RGD tracks -- thanks Brooke for catching those. diff --git src/hg/hgTracks/simpleTracks.c src/hg/hgTracks/simpleTracks.c index 766b5b3..6dd87f2 100644 --- src/hg/hgTracks/simpleTracks.c +++ src/hg/hgTracks/simpleTracks.c @@ -5144,32 +5144,35 @@ { struct bed *bed = item; struct trackDb *tdb = tg->tdb; if (tg->itemColor != NULL) color = tg->itemColor(tg, bed, hvg); else if (tg->colorShades) { int scoreMin = atoi(trackDbSettingClosestToHomeOrDefault(tdb, "scoreMin", "0")); int scoreMax = atoi(trackDbSettingClosestToHomeOrDefault(tdb, "scoreMax", "1000")); color = tg->colorShades[grayInRange(bed->score, scoreMin, scoreMax)]; } if (color) { int heightPer = tg->heightPer; - int x1 = round((double)((int)bed->chromStart-winStart)*scale) + xOff; - int x2 = round((double)((int)bed->chromEnd-winStart)*scale) + xOff; + int s = max(bed->chromStart, winStart), e = min(bed->chromEnd, winEnd); + if (s > e) + return; + int x1 = round((s-winStart)*scale) + xOff; + int x2 = round((e-winStart)*scale) + xOff; int w = x2-x1; if (w < 1) w = 1; hvGfxBox(hvg, x1, y, w, heightPer, color); if (tg->drawName && vis != tvSquish) { /* get description from rgdQtlLink table */ struct sqlConnection *conn = hAllocConn(database); char cond_str[256]; char linkTable[256]; safef(linkTable, sizeof(linkTable), "%sLink", tg->table); safef(cond_str, sizeof(cond_str), "name='%s'", tg->itemName(tg, bed)); char *s = sqlGetField(database, linkTable, "description", cond_str); hFreeConn(&conn); if (s == NULL)