diff --git a/AUTHORS b/AUTHORS index 984e9f525e7c1..f9021efd7e70e 100644 --- a/AUTHORS +++ b/AUTHORS @@ -16,4 +16,5 @@ Dwayne Slater Tetsuhiro Ueda shoryukenn SOTEC GmbH & Co. KG -Hidenori Matsubayashi \ No newline at end of file +Hidenori Matsubayashi +Sarbagya Dhaubanjar diff --git a/lib/ui/painting.dart b/lib/ui/painting.dart index 0ad46a775c293..c57155556fb6e 100644 --- a/lib/ui/painting.dart +++ b/lib/ui/painting.dart @@ -2744,12 +2744,11 @@ class PathMetric { return _measure.getTangentForOffset(contourIndex, distance); } - /// Given a start and stop distance, return the intervening segment(s). + /// Given a start and end distance, return the intervening segment(s). /// /// `start` and `end` are clamped to legal values (0..[length]) - /// Returns null if the segment is 0 length or `start` > `stop`. /// Begin the segment with a moveTo if `startWithMoveTo` is true. - Path? extractPath(double start, double end, {bool startWithMoveTo = true}) { + Path extractPath(double start, double end, {bool startWithMoveTo = true}) { return _measure.extractPath(contourIndex, start, end, startWithMoveTo: startWithMoveTo); } diff --git a/lib/web_ui/lib/src/engine/html/path/path_metrics.dart b/lib/web_ui/lib/src/engine/html/path/path_metrics.dart index fa640e415c85c..ada8f12335d02 100644 --- a/lib/web_ui/lib/src/engine/html/path/path_metrics.dart +++ b/lib/web_ui/lib/src/engine/html/path/path_metrics.dart @@ -114,7 +114,7 @@ class _SurfacePathMeasure { return true; } - ui.Path? extractPath(int contourIndex, double start, double end, + ui.Path extractPath(int contourIndex, double start, double end, {bool startWithMoveTo = true}) { return _contours[contourIndex].extractPath(start, end, startWithMoveTo); } @@ -196,7 +196,7 @@ class _PathContourMeasure { return segment.computeTangent(t); } - ui.Path? extractPath( + ui.Path extractPath( double startDistance, double stopDistance, bool startWithMoveTo) { if (startDistance < 0) { startDistance = 0; @@ -204,14 +204,14 @@ class _PathContourMeasure { if (stopDistance > _contourLength) { stopDistance = _contourLength; } + final ui.Path path = ui.Path(); if (startDistance > stopDistance || _segments.isEmpty) { - return null; + return path; } - final ui.Path path = ui.Path(); int startSegmentIndex = _segmentIndexAtDistance(startDistance); int stopSegmentIndex = _segmentIndexAtDistance(stopDistance); if (startSegmentIndex == -1 || stopSegmentIndex == -1) { - return null; + return path; } int currentSegmentIndex = startSegmentIndex; _PathSegment seg = _segments[currentSegmentIndex]; @@ -574,13 +574,11 @@ class SurfacePathMetric implements ui.PathMetric { return _measure.getTangentForOffset(contourIndex, distance); } - /// Given a start and stop distance, return the intervening segment(s). + /// Given a start and end distance, return the intervening segment(s). /// /// `start` and `end` are pinned to legal values (0..[length]) - /// Returns null if the segment is 0 length or `start` > `stop`. /// Begin the segment with a moveTo if `startWithMoveTo` is true. - ui.Path? extractPath(double start, double end, - {bool startWithMoveTo = true}) { + ui.Path extractPath(double start, double end, {bool startWithMoveTo = true}) { return _measure.extractPath(contourIndex, start, end, startWithMoveTo: startWithMoveTo); } diff --git a/lib/web_ui/lib/src/ui/path_metrics.dart b/lib/web_ui/lib/src/ui/path_metrics.dart index 65f07f881f1a2..b24856ef19865 100644 --- a/lib/web_ui/lib/src/ui/path_metrics.dart +++ b/lib/web_ui/lib/src/ui/path_metrics.dart @@ -22,7 +22,7 @@ abstract class PathMetric { double get length; int get contourIndex; Tangent? getTangentForOffset(double distance); - Path? extractPath(double start, double end, {bool startWithMoveTo = true}); + Path extractPath(double start, double end, {bool startWithMoveTo = true}); bool get isClosed; }