Skip to content

Commit

Permalink
drawing: stop checking types for bezier curves
Browse files Browse the repository at this point in the history
Our parser should already guarantee types and counts
are correct and VSFilter also only checks counts here.
  • Loading branch information
TheOneric committed May 6, 2024
1 parent 9489944 commit 2d06ea9
Showing 1 changed file with 7 additions and 23 deletions.
30 changes: 7 additions & 23 deletions libass/ass_drawing.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,19 +30,6 @@
#define DRAWING_INITIAL_POINTS 100
#define DRAWING_INITIAL_SEGMENTS 100

/*
* \brief Check whether a number of items on the list is available
*/
static bool token_check_values(ASS_DrawingToken *token, int i, ASS_TokenType type)
{
for (int j = 0; j < i; j++) {
if (!token || token->type != type) return false;
token = token->next;
}

return true;
}

/*
* \brief Free a list of tokens
*/
Expand Down Expand Up @@ -367,16 +354,13 @@ bool ass_drawing_parse(ASS_Outline *outline, ASS_Rect *cbox,
break;
}
case TOKEN_CUBIC_BEZIER:
if (token_check_values(token, 3, TOKEN_CUBIC_BEZIER) &&
token->prev) {
if (!drawing_add_curve(outline, cbox, token->prev, false, started))
goto error;
token = token->next;
token = token->next;
token = token->next;
started = true;
} else
token = token->next;
assert_3_forward(token);
if (!drawing_add_curve(outline, cbox, token->prev, false, started))
goto error;
token = token->next;
token = token->next;
token = token->next;
started = true;
break;
case TOKEN_B_SPLINE:
assert_3_forward(token);
Expand Down

0 comments on commit 2d06ea9

Please sign in to comment.