]> O.S.I.I.S - jp/vkvg.git/commitdiff
prevent storing path containing only a moveto
authorJean-Philippe Bruyère <jp_bruyere@hotmail.com>
Wed, 25 Apr 2018 03:03:04 +0000 (05:03 +0200)
committerJean-Philippe Bruyère <jp_bruyere@hotmail.com>
Wed, 25 Apr 2018 03:03:04 +0000 (05:03 +0200)
src/vkvg_context_internal.c

index 7e9fe34bb4d54ff4367def299610eb560c3ab7cb..fe2669e1d93a1f4c3138922ec93e3c5ff38ba17d 100644 (file)
@@ -61,6 +61,12 @@ void _start_sub_path (VkvgContext ctx, float x, float y) {
 void _finish_path (VkvgContext ctx){
     if (_current_path_is_empty(ctx))
         return;
+    if (ctx->pathes[ctx->pathPtr-1] == ctx->pointCount - 1){
+        //only current pos is in path
+        ctx->pathPtr--;
+        return;
+    }
+
     //set end index of current path to last point in points array
     ctx->pathes[ctx->pathPtr] = ctx->pointCount - 1;
     _check_pathes_array(ctx);