Always redraw entire curve
This commit is contained in:
committed by
Stéphane Lesimple
parent
bb6c9222fb
commit
c4c0fcec81
@@ -70,7 +70,6 @@ void GuiInitializeCurve(void *rc_ptr, int max_rate, int can_c2)
|
||||
|
||||
rc->lastCopied = (1000*rc->firstSector)/rc->image->dh->sectors;
|
||||
rc->lastPlotted = rc->lastSegment = rc->lastCopied;
|
||||
rc->lastPlottedY = 0;
|
||||
|
||||
if(Closure->readLinearSpiral)
|
||||
for(i=rc->lastCopied-1; i>=0; i--)
|
||||
@@ -92,10 +91,8 @@ typedef struct
|
||||
static gboolean curve_idle_func(gpointer data)
|
||||
{ curve_info *ci = (curve_info*)data;
|
||||
read_closure *rc=ci->rc;
|
||||
gint x0,y0;
|
||||
char *utf,buf[80];
|
||||
gint i;
|
||||
gint resize_curve = FALSE;
|
||||
|
||||
/*** Update the textual output */
|
||||
|
||||
@@ -125,7 +122,9 @@ static gboolean curve_idle_func(gpointer data)
|
||||
|
||||
rc->lastSegment = ci->percent;
|
||||
|
||||
if(rc->pass) /* 2nd or higher reading pass, don't touch the curve */
|
||||
/* Don't touch the curve if 2nd or higher reading pass, of if there is no new data */
|
||||
|
||||
if(rc->pass || rc->lastPlotted >= ci->percent)
|
||||
{ g_free(ci);
|
||||
g_mutex_lock(rc->rendererMutex);
|
||||
rc->activeRenderers--;
|
||||
@@ -137,53 +136,12 @@ static gboolean curve_idle_func(gpointer data)
|
||||
|
||||
for(i=rc->lastPlotted+1; i<=ci->percent; i++)
|
||||
if(Closure->readLinearCurve->fvalue[i] > Closure->readLinearCurve->maxY)
|
||||
resize_curve = TRUE;
|
||||
Closure->readLinearCurve->maxY = Closure->readLinearCurve->fvalue[i];
|
||||
|
||||
if(resize_curve)
|
||||
{ Closure->readLinearCurve->maxY = Closure->readLinearCurve->fvalue[ci->percent] + 1;
|
||||
/*** Schedule the curve for redrawing */
|
||||
|
||||
update_geometry();
|
||||
gdk_window_clear(gtk_widget_get_window(Closure->readLinearCurveArea));
|
||||
redraw_curve();
|
||||
rc->lastPlotted = ci->percent;
|
||||
rc->lastPlottedY = GuiCurveY(Closure->readLinearCurve, Closure->readLinearCurve->fvalue[ci->percent]);
|
||||
g_free(ci);
|
||||
g_mutex_lock(rc->rendererMutex);
|
||||
rc->activeRenderers--;
|
||||
g_mutex_unlock(rc->rendererMutex);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/*** Draw the changed curve part */
|
||||
|
||||
x0 = GuiCurveX(Closure->readLinearCurve, rc->lastPlotted);
|
||||
y0 = GuiCurveY(Closure->readLinearCurve, Closure->readLinearCurve->fvalue[rc->lastPlotted]);
|
||||
if(rc->lastPlottedY) y0 = rc->lastPlottedY;
|
||||
|
||||
for(i=rc->lastPlotted+1; i<=ci->percent; i++)
|
||||
{ gint x1 = GuiCurveX(Closure->readLinearCurve, i);
|
||||
gint y1 = GuiCurveY(Closure->readLinearCurve, Closure->readLinearCurve->fvalue[i]);
|
||||
gint l1 = GuiCurveLogY(Closure->readLinearCurve, Closure->readLinearCurve->lvalue[i]);
|
||||
|
||||
if(Closure->readLinearCurve->lvalue[i])
|
||||
{ gdk_gc_set_rgb_fg_color(Closure->drawGC, Closure->logColor);
|
||||
|
||||
gdk_draw_rectangle(Closure->readLinearCurveArea->window,
|
||||
Closure->drawGC, TRUE,
|
||||
x0, l1,
|
||||
x0==x1 ? 1 : x1-x0, Closure->readLinearCurve->bottomLY-l1);
|
||||
}
|
||||
if(x0<x1)
|
||||
{ gdk_gc_set_rgb_fg_color(Closure->drawGC, Closure->curveColor);
|
||||
gdk_draw_line(Closure->readLinearCurveArea->window,
|
||||
Closure->drawGC,
|
||||
x0, y0, x1, y1);
|
||||
|
||||
rc->lastPlotted = ci->percent;
|
||||
x0 = x1;
|
||||
rc->lastPlottedY = y0 = y1;
|
||||
}
|
||||
}
|
||||
rc->lastPlotted = ci->percent;
|
||||
gtk_widget_queue_draw(Closure->readLinearCurveArea);
|
||||
|
||||
g_free(ci);
|
||||
g_mutex_lock(rc->rendererMutex);
|
||||
|
||||
@@ -88,7 +88,6 @@ typedef struct
|
||||
gint lastCopied;
|
||||
gint lastSegment;
|
||||
gint lastPlotted;
|
||||
gint lastPlottedY;
|
||||
gint activeRenderers;
|
||||
GMutex *rendererMutex;
|
||||
|
||||
|
||||
@@ -218,47 +218,8 @@ void RS01UpdateFixResults(RS01Widgets *wl, gint64 corrected, gint64 uncorrected)
|
||||
|
||||
static gboolean curve_idle_func(gpointer data)
|
||||
{ RS01Widgets *wl = (RS01Widgets*)data;
|
||||
gint x0 = GuiCurveX(wl->fixCurve, (double)wl->lastPercent);
|
||||
gint x1 = GuiCurveX(wl->fixCurve, (double)wl->percent);
|
||||
gint y = GuiCurveY(wl->fixCurve, wl->fixCurve->ivalue[wl->percent]);
|
||||
gint i;
|
||||
gtk_widget_queue_draw(wl->fixCurve->widget);
|
||||
|
||||
/*** Mark unused ecc values */
|
||||
|
||||
for(i=wl->lastPercent+1; i<wl->percent; i++)
|
||||
wl->fixCurve->ivalue[i] = wl->fixCurve->ivalue[wl->percent];
|
||||
|
||||
/*** Resize the Y axes if error values exceeds current maximum */
|
||||
|
||||
if(wl->fixCurve->ivalue[wl->percent] > wl->fixCurve->maxY)
|
||||
{ wl->fixCurve->maxY = wl->fixCurve->ivalue[wl->percent];
|
||||
wl->fixCurve->maxY = wl->fixCurve->maxY - (wl->fixCurve->maxY % 5) + 5;
|
||||
|
||||
update_geometry(wl);
|
||||
gdk_window_clear(gtk_widget_get_window(wl->fixCurve->widget));
|
||||
redraw_curve(wl);
|
||||
wl->lastPercent = wl->percent;
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/*** Draw the error value */
|
||||
|
||||
if(wl->fixCurve->ivalue[wl->percent] > 0)
|
||||
{ gdk_gc_set_rgb_fg_color(Closure->drawGC, Closure->barColor);
|
||||
gdk_draw_rectangle(wl->fixCurve->widget->window,
|
||||
Closure->drawGC, TRUE,
|
||||
x0, y, x0==x1 ? 1 : x1-x0, wl->fixCurve->bottomY-y);
|
||||
}
|
||||
wl->lastPercent = wl->percent;
|
||||
|
||||
/* Redraw the ecc capacity threshold line */
|
||||
|
||||
y = GuiCurveY(wl->fixCurve, wl->eccBytes);
|
||||
gdk_gc_set_rgb_fg_color(Closure->drawGC, Closure->greenSector);
|
||||
gdk_draw_line(gtk_widget_get_window(wl->fixCurve->widget),
|
||||
Closure->drawGC,
|
||||
wl->fixCurve->leftX-6, y, wl->fixCurve->rightX+6, y);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
@@ -158,47 +158,8 @@ void RS02UpdateFixResults(RS02Widgets *wl, gint64 corrected, gint64 uncorrected)
|
||||
|
||||
static gboolean curve_idle_func(gpointer data)
|
||||
{ RS02Widgets *wl = (RS02Widgets*)data;
|
||||
gint x0 = GuiCurveX(wl->fixCurve, (double)wl->lastPercent);
|
||||
gint x1 = GuiCurveX(wl->fixCurve, (double)wl->percent);
|
||||
gint y = GuiCurveY(wl->fixCurve, wl->fixCurve->ivalue[wl->percent]);
|
||||
gint i;
|
||||
gtk_widget_queue_draw(wl->fixCurve->widget);
|
||||
|
||||
/*** Mark unused ecc values */
|
||||
|
||||
for(i=wl->lastPercent+1; i<wl->percent; i++)
|
||||
wl->fixCurve->ivalue[i] = wl->fixCurve->ivalue[wl->percent];
|
||||
|
||||
/*** Resize the Y axes if error values exceeds current maximum */
|
||||
|
||||
if(wl->fixCurve->ivalue[wl->percent] > wl->fixCurve->maxY)
|
||||
{ wl->fixCurve->maxY = wl->fixCurve->ivalue[wl->percent];
|
||||
wl->fixCurve->maxY = wl->fixCurve->maxY - (wl->fixCurve->maxY % 5) + 5;
|
||||
|
||||
update_geometry(wl);
|
||||
gdk_window_clear(gtk_widget_get_window(wl->fixCurve->widget));
|
||||
redraw_curve(wl);
|
||||
wl->lastPercent = wl->percent;
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/*** Draw the error value */
|
||||
|
||||
if(wl->fixCurve->ivalue[wl->percent] > 0)
|
||||
{ gdk_gc_set_rgb_fg_color(Closure->drawGC, Closure->barColor);
|
||||
gdk_draw_rectangle(wl->fixCurve->widget->window,
|
||||
Closure->drawGC, TRUE,
|
||||
x0, y, x0==x1 ? 1 : x1-x0, wl->fixCurve->bottomY-y);
|
||||
}
|
||||
wl->lastPercent = wl->percent;
|
||||
|
||||
/* Redraw the ecc capacity threshold line */
|
||||
|
||||
y = GuiCurveY(wl->fixCurve, wl->eccBytes);
|
||||
gdk_gc_set_rgb_fg_color(Closure->drawGC, Closure->greenSector);
|
||||
gdk_draw_line(wl->fixCurve->widget->window,
|
||||
Closure->drawGC,
|
||||
wl->fixCurve->leftX-6, y, wl->fixCurve->rightX+6, y);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
@@ -188,47 +188,8 @@ void RS03UpdateFixResults(RS03Widgets *wl, gint64 corrected, gint64 uncorrected)
|
||||
|
||||
static gboolean curve_idle_func(gpointer data)
|
||||
{ RS03Widgets *wl = (RS03Widgets*)data;
|
||||
gint x0 = GuiCurveX(wl->fixCurve, (double)wl->lastPercent);
|
||||
gint x1 = GuiCurveX(wl->fixCurve, (double)wl->percent);
|
||||
gint y = GuiCurveY(wl->fixCurve, wl->fixCurve->ivalue[wl->percent]);
|
||||
gint i;
|
||||
gtk_widget_queue_draw(wl->fixCurve->widget);
|
||||
|
||||
/*** Mark unused ecc values */
|
||||
|
||||
for(i=wl->lastPercent+1; i<wl->percent; i++)
|
||||
wl->fixCurve->ivalue[i] = wl->fixCurve->ivalue[wl->percent];
|
||||
|
||||
/*** Resize the Y axes if error values exceeds current maximum */
|
||||
|
||||
if(wl->fixCurve->ivalue[wl->percent] > wl->fixCurve->maxY)
|
||||
{ wl->fixCurve->maxY = wl->fixCurve->ivalue[wl->percent];
|
||||
wl->fixCurve->maxY = wl->fixCurve->maxY - (wl->fixCurve->maxY % 5) + 5;
|
||||
|
||||
update_geometry(wl);
|
||||
gdk_window_clear(gtk_widget_get_window(wl->fixCurve->widget));
|
||||
redraw_curve(wl);
|
||||
wl->lastPercent = wl->percent;
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/*** Draw the error value */
|
||||
|
||||
if(wl->fixCurve->ivalue[wl->percent] > 0)
|
||||
{ gdk_gc_set_rgb_fg_color(Closure->drawGC, Closure->barColor);
|
||||
gdk_draw_rectangle(wl->fixCurve->widget->window,
|
||||
Closure->drawGC, TRUE,
|
||||
x0, y, x0==x1 ? 1 : x1-x0, wl->fixCurve->bottomY-y);
|
||||
}
|
||||
wl->lastPercent = wl->percent;
|
||||
|
||||
/* Redraw the ecc capacity threshold line */
|
||||
|
||||
y = GuiCurveY(wl->fixCurve, wl->eccBytes);
|
||||
gdk_gc_set_rgb_fg_color(Closure->drawGC, Closure->greenSector);
|
||||
gdk_draw_line(gtk_widget_get_window(wl->fixCurve->widget),
|
||||
Closure->drawGC,
|
||||
wl->fixCurve->leftX-6, y, wl->fixCurve->rightX+6, y);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user