Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntonio Vazquez <blendergit@gmail.com>2021-05-19 18:56:12 +0300
committerAntonio Vazquez <blendergit@gmail.com>2021-05-19 18:56:26 +0300
commit857f39a3d76c7672bb49d95988352bb7caff41a4 (patch)
treea5d47879a97860243693c4024f6702caf8248fb2 /source/blender/io
parent23b642cbb43dee2420154e632194615cbd8cb0a2 (diff)
GPencil: Apply NanoSVG fix
This fix is ported from official NanoSVG git
Diffstat (limited to 'source/blender/io')
-rw-r--r--source/blender/io/gpencil/nanosvg/nanosvg.h7
1 files changed, 6 insertions, 1 deletions
diff --git a/source/blender/io/gpencil/nanosvg/nanosvg.h b/source/blender/io/gpencil/nanosvg/nanosvg.h
index 886b6402267..94dad37861a 100644
--- a/source/blender/io/gpencil/nanosvg/nanosvg.h
+++ b/source/blender/io/gpencil/nanosvg/nanosvg.h
@@ -2362,7 +2362,12 @@ static void nsvg__pathArcTo(NSVGparser *p, float *cpx, float *cpy, float *args,
// The loop assumes an iteration per end point (including start and end), this +1.
ndivs = (int)(fabsf(da) / (NSVG_PI * 0.5f) + 1.0f);
hda = (da / (float)ndivs) / 2.0f;
- kappa = fabsf(4.0f / 3.0f * (1.0f - cosf(hda)) / sinf(hda));
+ // Fix for ticket #179: division by 0: avoid cotangens around 0 (infinite)
+ if ((hda < 1e-3f) && (hda > -1e-3f))
+ hda *= 0.5f;
+ else
+ hda = (1.0f - cosf(hda)) / sinf(hda);
+ kappa = fabsf(4.0f / 3.0f * hda);
if (da < 0.0f)
kappa = -kappa;