From 93bd3d9c3a22e354e4720c6b60ba7bbf17d0f461 Mon Sep 17 00:00:00 2001 From: "Dr.Smile" Date: Tue, 4 Nov 2014 14:24:28 +0300 Subject: Fix incorrect closing of last drawing contour --- libass/ass_drawing.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/libass/ass_drawing.c b/libass/ass_drawing.c index 2d9e2d7..70afae5 100644 --- a/libass/ass_drawing.c +++ b/libass/ass_drawing.c @@ -70,10 +70,8 @@ static inline void drawing_close_shape(ASS_Drawing *drawing) drawing->max_contours); } - if (ol->n_points) { - ol->contours[ol->n_contours] = ol->n_points - 1; - ol->n_contours++; - } + ol->contours[ol->n_contours] = ol->n_points - 1; + ol->n_contours++; } /* @@ -97,9 +95,6 @@ static void drawing_finish(ASS_Drawing *drawing, int raw_mode) FT_BBox bbox = drawing->cbox; FT_Outline *ol = &drawing->outline; - // Close the last contour - drawing_close_shape(drawing); - if (drawing->library) ass_msg(drawing->library, MSGL_V, "Parsed drawing with %d points and %d contours", ol->n_points, @@ -407,6 +402,10 @@ FT_Outline *ass_drawing_parse(ASS_Drawing *drawing, int raw_mode) } } + // Close the last contour + if (started) + drawing_close_shape(drawing); + drawing_finish(drawing, raw_mode); drawing_free_tokens(drawing->tokens); return &drawing->outline; -- cgit v1.2.3