From 228fcd2b21d7354d65dd8ddc358d207b008f2074 Mon Sep 17 00:00:00 2001 From: lecoanet Date: Wed, 4 Feb 2004 15:25:07 +0000 Subject: * Fixed the clamping of visible_history_size so that it doesn't fall irremediably to zero. --- generic/Track.c | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) (limited to 'generic') diff --git a/generic/Track.c b/generic/Track.c index 6a16e7f..18d8c7e 100644 --- a/generic/Track.c +++ b/generic/Track.c @@ -626,11 +626,6 @@ Configure(ZnItem item, } /* - * Trunc the visible history to the managed size. - */ - track->visible_history_size = MIN(track->visible_history_size, - wi->track_managed_history_size); - /* * Adapt to the new label locating system. */ if (ISSET(*flags, ZN_POLAR_FLAG)) { @@ -759,12 +754,17 @@ ComputeCoordinates(ZnItem item, information from the symbol font. */ if ((item->class == ZnTrack) && track->history) { + /* + * Trunc the visible history to the managed size. + */ + unsigned int visible_history_size = MIN(track->visible_history_size, + wi->track_managed_history_size); ZnResetBBox(&bbox); num_acc_pos = ZnListSize(track->history); hist = ZnListArray(track->history); for (i = 0; i < num_acc_pos; i++) { ZnTransformPoint(wi->current_transfo, &hist[i].world, &hist[i].dev); - if ((i < track->visible_history_size) && (hist[i].visible)) { + if ((i < visible_history_size) && (hist[i].visible)) { bbox.orig.x = hist[i].dev.x - w2; bbox.orig.y = hist[i].dev.y - h2; bbox.corner.x = bbox.orig.x + w; @@ -1212,6 +1212,9 @@ Draw(ZnItem item) * Draw the history, current pos excepted. */ if ((item->class == ZnTrack) && track->history) { + unsigned int visible_history_size = MIN(track->visible_history_size, + wi->track_managed_history_size); + values.foreground = ZnGetGradientPixel(track->history_color, 0.0); values.fill_style = FillSolid; XChangeGC(wi->dpy, wi->gc, GCForeground|GCFillStyle, &values); @@ -1220,13 +1223,13 @@ Draw(ZnItem item) values.line_style = LineSolid; XChangeGC(wi->dpy, wi->gc, GCLineWidth | GCLineStyle, &values); } - num_acc_pos = MIN(track->visible_history_size, ZnListSize(track->history)); + num_acc_pos = MIN(visible_history_size, ZnListSize(track->history)); hist = ZnListArray(track->history); side_size = MAX(width, height); for (i = 0, nb_hist = 0; i < num_acc_pos; i++) { if (ISSET(track->flags, LAST_AS_FIRST_BIT) && - (i == track->visible_history_size-1)) { + (i == visible_history_size-1)) { values.foreground = ZnGetGradientPixel(track->symbol_color, 0.0); XChangeGC(wi->dpy, wi->gc, GCForeground, &values); } @@ -1480,13 +1483,16 @@ Render(ZnItem item) * Draw the history, current pos excepted. */ if ((item->class == ZnTrack) && track->history) { + unsigned int visible_history_size = MIN(track->visible_history_size, + wi->track_managed_history_size); + points = ZnGetCirclePoints(3, ZN_CIRCLE_COARSE, 0.0, 2*M_PI, &num_points, NULL); color = ZnGetGradientColor(track->history_color, 0.0, &alpha); alpha = ZnComposeAlpha(alpha, wi->alpha); glColor4us(color->red, color->green, color->blue, alpha); glLineWidth(1.0); glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); - num_acc_pos = MIN(track->visible_history_size, ZnListSize(track->history)); + num_acc_pos = MIN(visible_history_size, ZnListSize(track->history)); hist = ZnListArray(track->history); side_size = MAX(width, height); /* @@ -1497,7 +1503,7 @@ Render(ZnItem item) glDisable(GL_POINT_SMOOTH); for (i = 0, nb_hist = 0; i < num_acc_pos; i++) { if (ISSET(track->flags, LAST_AS_FIRST_BIT) && - (i == track->visible_history_size-1)) { + (i == visible_history_size-1)) { color = ZnGetGradientColor(track->symbol_color, 0.0, &alpha); alpha = ZnComposeAlpha(alpha, wi->alpha); glColor4us(color->red, color->green, color->blue, alpha); @@ -1763,8 +1769,8 @@ Pick(ZnItem item, ********************************************************************************** */ static void -PostScript(ZnItem item __unused, - ZnPostScriptInfo ps_info __unused) +PostScript(ZnItem item __unused, + ZnBool prepass __unused) { } -- cgit v1.1