From e7c7397291c8cea889e1cd10e237a101e81808b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Thu, 7 Dec 2023 20:53:04 +0100 Subject: [PATCH] Rename some members for understanding --- .../Utils/IncrementalBSplineBuilder.cs | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/osu.Framework/Utils/IncrementalBSplineBuilder.cs b/osu.Framework/Utils/IncrementalBSplineBuilder.cs index ae5c957be9..ad773bc69d 100644 --- a/osu.Framework/Utils/IncrementalBSplineBuilder.cs +++ b/osu.Framework/Utils/IncrementalBSplineBuilder.cs @@ -79,9 +79,9 @@ private static float getAbsWindingAt(List path, List cumulativeD Value = new List>() }; - private bool controlPointsPartiallyInvalid; + private bool shouldOptimiseLastSegment; - private bool shouldFinishLastSegment; + private bool finishedDrawing; private int degree; @@ -174,10 +174,10 @@ public IReadOnlyList> ControlPoints get { if (!controlPoints.IsValid) - regenerateApproximatedPathControlPoints(); + regenerateFullApproximatedPath(); - if (controlPointsPartiallyInvalid) - updateApproximatedPathControlPoints(); + if (shouldOptimiseLastSegment) + regenerateLastApproximatedSegment(); return controlPoints.Value; } @@ -392,11 +392,11 @@ private void updateLastSegment(List vertices, List distances, Li res, iterations, 4f, initialControlPoints: lastSegment, learnableMask: learnableMask); } - private void updateApproximatedPathControlPoints() + private void regenerateLastApproximatedSegment() { if (!controlPoints.IsValid) { - regenerateApproximatedPathControlPoints(); + regenerateFullApproximatedPath(); return; } @@ -430,15 +430,15 @@ private void updateApproximatedPathControlPoints() segments.Add(new List()); } - if (shouldFinishLastSegment) + if (finishedDrawing) updateLastSegment(vertices, distances, cornerTs, segments, 100, false); else updateLastSegment(vertices, distances, cornerTs, segments, 10, true); - controlPointsPartiallyInvalid = false; + shouldOptimiseLastSegment = false; } - private void regenerateApproximatedPathControlPoints() + private void regenerateFullApproximatedPath() { // Approximating a given input path with a BSpline has three stages: // 1. Fit a dense-ish BSpline (with one control point in FdEpsilon-sized intervals) to the input path. @@ -478,7 +478,7 @@ private void regenerateApproximatedPathControlPoints() segments.Add(cps); } - controlPointsPartiallyInvalid = false; + shouldOptimiseLastSegment = false; } private void redrawApproximatedPath() @@ -502,8 +502,8 @@ public void Clear() controlPoints.Value = new List>(); outputCache.Value = new List(); - controlPointsPartiallyInvalid = false; - shouldFinishLastSegment = false; + shouldOptimiseLastSegment = false; + finishedDrawing = false; } /// @@ -513,7 +513,7 @@ public void Clear() public void AddLinearPoint(Vector2 v) { outputCache.Invalidate(); - controlPointsPartiallyInvalid = true; + shouldOptimiseLastSegment = true; // Implementation detail: we would like to disregard input path detail that is smaller than // FD_EPSILON * 2 because it can otherwise mess with the winding calculations. However, we @@ -551,8 +551,8 @@ public void Finish() // Do additional optimization steps on the entire last segment. // This improves results after drawing, so the performance stays fast and control points dont wobble too much while drawing. outputCache.Invalidate(); - controlPointsPartiallyInvalid = true; - shouldFinishLastSegment = true; + shouldOptimiseLastSegment = true; + finishedDrawing = true; } } }