From: Jean-Philippe Bruyère Date: Fri, 31 Jan 2020 06:19:58 +0000 (+0100) Subject: scale arc steps with current matrix X-Git-Tag: v0.1-alpha~30 X-Git-Url: https://git.osiis.dedyn.io/?a=commitdiff_plain;h=9bdd091e99d782fdee84fdf9adcf434f5a24fb63;p=jp%2Fvkvg.git scale arc steps with current matrix --- diff --git a/appveyor.yml b/appveyor.yml index f1b651a..c627c53 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -34,7 +34,7 @@ for: - msbuild vkvg.sln /p:Configuration=Debug /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll" after_build: - cd .. - - 7z a vkvg.zip build\*.dll build\*.exe build\*.lib + - 7z a vkvg.zip build\*.* - matrix: @@ -54,7 +54,7 @@ for: - make after_build: - cd .. - - 7z a build/vkvg.zip build/*.so* build/test_* + - 7z a vkvg.zip build/*.so* build/test_* diff --git a/src/vkvg_context.c b/src/vkvg_context.c index 3067528..a2a0cb5 100644 --- a/src/vkvg_context.c +++ b/src/vkvg_context.c @@ -373,7 +373,8 @@ void vkvg_arc (VkvgContext ctx, float xc, float yc, float radius, float a1, floa vec2 v = {cosf(a1)*radius + xc, sinf(a1)*radius + yc}; - float step = _get_arc_step(radius); + float step = _get_arc_step(ctx, radius); + printf ("steps: %.2f\n", 2.f*M_PIF/step); float a = a1; if (_current_path_is_empty(ctx)) @@ -416,7 +417,7 @@ void vkvg_arc_negative (VkvgContext ctx, float xc, float yc, float radius, float vec2 v = {cosf(a1)*radius + xc, sinf(a1)*radius + yc}; - float step = _get_arc_step(radius); + float step = _get_arc_step(ctx, radius); float a = a1; if (_current_path_is_empty(ctx)) diff --git a/src/vkvg_context_internal.c b/src/vkvg_context_internal.c index cb72fdf..423ba05 100644 --- a/src/vkvg_context_internal.c +++ b/src/vkvg_context_internal.c @@ -172,8 +172,10 @@ float _normalizeAngle(float a) else return res; } -float _get_arc_step (float radius) { - return M_PIF/sqrtf(radius)*0.35f; +float _get_arc_step (VkvgContext ctx, float radius) { + float dx = 1, dy = 1; + vkvg_matrix_transform_distance (&ctx->pushConsts.mat, &dx, &dy); + return M_PIF/sqrtf(radius)*0.35f/fmaxf(dx,dy); } void _create_gradient_buff (VkvgContext ctx){ vkvg_buffer_create (ctx->pSurf->dev, diff --git a/src/vkvg_context_internal.h b/src/vkvg_context_internal.h index 4a0bbf4..052813b 100644 --- a/src/vkvg_context_internal.h +++ b/src/vkvg_context_internal.h @@ -182,7 +182,7 @@ void _set_curve_end (VkvgContext ctx); bool _path_has_curves (VkvgContext ctx, uint32_t ptrPath); float _normalizeAngle (float a); -float _get_arc_step (float radius); +float _get_arc_step (VkvgContext ctx, float radius); vec2 _get_current_position (VkvgContext ctx); void _add_point (VkvgContext ctx, float x, float y);