etch-a-ton: off by one error

was writing past the buffer when inserting strokes
This commit is contained in:
Campbell Barton 2015-02-17 17:12:19 +11:00
parent 28f31bdfd8
commit 86a2e9d0e4
1 changed files with 3 additions and 3 deletions

View File

@ -196,14 +196,14 @@ void sk_appendStrokePoint(SK_Stroke *stk, SK_Point *pt)
void sk_insertStrokePoints(SK_Stroke *stk, SK_Point *pts, int len, int start, int end)
{
int size = end - start + 1;
int size = end - start;
sk_growStrokeBufferN(stk, len - size);
if (len != size) {
int tail_size = stk->nb_points - end + 1;
int tail_size = stk->nb_points - end;
memmove(stk->points + start + len, stk->points + end + 1, tail_size * sizeof(SK_Point));
memmove(stk->points + start + len, stk->points + end, tail_size * sizeof(SK_Point));
}
memcpy(stk->points + start, pts, len * sizeof(SK_Point));