diff options
Diffstat (limited to 'src/vkvg_context_internal.c')
| -rw-r--r-- | src/vkvg_context_internal.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/src/vkvg_context_internal.c b/src/vkvg_context_internal.c index 1a1ef73..76cd6f6 100644 --- a/src/vkvg_context_internal.c +++ b/src/vkvg_context_internal.c @@ -940,7 +940,7 @@ bool _build_vb_step (vkvg_context* ctx, float hw, stroke_context_t* str, bool is vec2 bisec_n_perp = vec2_perp(bisec_n); //limit bisectrice length - float rlh = lh; + float rlh = lh;//rlh is for inside pos tweeks if (dot < 0.f) rlh = fminf (rlh, fminf (length_v0, length_v1)); //--- @@ -977,8 +977,16 @@ bool _build_vb_step (vkvg_context* ctx, float hw, stroke_context_t* str, bool is } } + vkvg_line_join_t join = ctx->lineJoin; - if (ctx->lineJoin == VKVG_LINE_JOIN_MITER || isCurve){ + if (isCurve) { + if (dot < 0.8f) + join = VKVG_LINE_JOIN_ROUND; + else + join = VKVG_LINE_JOIN_MITER; + } + + if (join == VKVG_LINE_JOIN_MITER){ if (lh > str->lhMax) {//miter limit double x = (lh - str->lhMax) * cosf (halfAlpha); vec2 bisecPerp = vec2_mult_s (bisec_n, x); @@ -1051,7 +1059,7 @@ bool _build_vb_step (vkvg_context* ctx, float hw, stroke_context_t* str, bool is } _add_vertex(ctx, v); - if (ctx->lineJoin == VKVG_LINE_JOIN_BEVEL){ + if (join == VKVG_LINE_JOIN_BEVEL){ if (det<0){ _add_triangle_indices(ctx, idx, idx+2, idx+1); _add_triangle_indices(ctx, idx+2, idx+4, idx+0); @@ -1061,7 +1069,7 @@ bool _build_vb_step (vkvg_context* ctx, float hw, stroke_context_t* str, bool is _add_triangle_indices(ctx, idx+2, idx+3, idx+1); _add_triangle_indices(ctx, idx+1, idx+3, idx+4); } - }else if (ctx->lineJoin == VKVG_LINE_JOIN_ROUND){ + }else if (join == VKVG_LINE_JOIN_ROUND){ float step = M_PIF / hw; float a = acosf(vp.x); if (vp.y < 0) |