]> granicus.if.org Git - libass/commitdiff
Fix incorrect closing of last drawing contour
authorDr.Smile <vabnick@gmail.com>
Tue, 4 Nov 2014 11:24:28 +0000 (14:24 +0300)
committerDr.Smile <vabnick@gmail.com>
Sat, 22 Nov 2014 22:49:10 +0000 (01:49 +0300)
libass/ass_drawing.c

index 2d9e2d7ce1d362e8171ce9e1fc3d933d7804a922..70afae596c09fc7a2bd64220ce5ed07bf3824fa4 100644 (file)
@@ -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;