+ if(preserve_direction) {
+ if(stroke->dir == DIR_UP) {
+ pos = stroke->num_points-1;
+ incr = -1;
+ }
+ } else {
+ // try to find matching point on either end.
+ // Prefer downward.
+ if(last.x == stroke->points[stroke->num_points-1].x &&
+ last.y == stroke->points[stroke->num_points-1].y) {
+ pos = stroke->num_points-1;
+ incr = -1;
+ }