More spelling errors, whitespace, and simplifying code with many side effects

This commit is contained in:
Joshua Leung 2012-11-12 10:38:51 +00:00
parent 40382c15ac
commit 0fc0cb351b
2 changed files with 15 additions and 10 deletions

@ -535,15 +535,19 @@ static void gp_timing_data_add_point(tGpTimingData *gtd, double stroke_inittime,
{ {
if (time < 0.0f) { if (time < 0.0f) {
/* This is a gap, negative value! */ /* This is a gap, negative value! */
gtd->tot_time = -(gtd->times[gtd->cur_point] = -(((float)(stroke_inittime - gtd->inittime)) + time)); gtd->times[gtd->cur_point] = -(((float)(stroke_inittime - gtd->inittime)) + time);
gtd->tot_time = -gtd->times[gtd->cur_point];
gtd->gap_tot_time += gtd->times[gtd->cur_point] - gtd->times[gtd->cur_point - 1]; gtd->gap_tot_time += gtd->times[gtd->cur_point] - gtd->times[gtd->cur_point - 1];
} }
else { else {
gtd->tot_time = (gtd->times[gtd->cur_point] = (((float)(stroke_inittime - gtd->inittime)) + time)); gtd->times[gtd->cur_point] = (((float)(stroke_inittime - gtd->inittime)) + time);
gtd->tot_time = (gtd->times[gtd->cur_point]);
} }
gtd->tot_dist += delta_dist; gtd->tot_dist += delta_dist;
gtd->dists[gtd->cur_point] = gtd->tot_dist; gtd->dists[gtd->cur_point] = gtd->tot_dist;
gtd->cur_point++; gtd->cur_point++;
} }
@ -569,13 +573,14 @@ static int gp_find_end_of_stroke_idx(tGpTimingData *gtd, int idx, int nbr_gaps,
/* We want gaps that are in gtd->gap_duration +/- gtd->gap_randomness range, /* We want gaps that are in gtd->gap_duration +/- gtd->gap_randomness range,
* and which sum to exactly tot_gaps_time... * and which sum to exactly tot_gaps_time...
*/ */
int rem_gaps = nbr_gaps - *nbr_done_gaps; int rem_gaps = nbr_gaps - (*nbr_done_gaps);
if (rem_gaps < 2) { if (rem_gaps < 2) {
/* Last gap, just give remaining time! */ /* Last gap, just give remaining time! */
*next_delta_time = tot_gaps_time; *next_delta_time = tot_gaps_time;
} }
else { else {
float delta, min, max; float delta, min, max;
/* This code ensures that if the first gaps have been shorter than average gap_duration, /* This code ensures that if the first gaps have been shorter than average gap_duration,
* next gaps will tend to be longer (i.e. try to recover the lateness), and vice-versa! * next gaps will tend to be longer (i.e. try to recover the lateness), and vice-versa!
*/ */

@ -771,7 +771,7 @@ static short gp_stroke_eraser_splitdel(bGPDframe *gpf, bGPDstroke *gps, int i)
/* We must adjust timings! /* We must adjust timings!
* Each point's timing data is a delta from stroke's inittime, so as we erase the first * Each point's timing data is a delta from stroke's inittime, so as we erase the first
* point of the stroke, we have to offset this inittime and all remaing points' delta values. * point of the stroke, we have to offset this inittime and all remaining points' delta values.
* This way we get a new stroke with exactly the same timing as if user had started drawing from * This way we get a new stroke with exactly the same timing as if user had started drawing from
* the second point... * the second point...
*/ */