[Impeller] Remove unused/untested Path APIs. (flutter/engine#47841)
This will simplify the Path internals cleanup that I'd like to land as a part of https://github.com/flutter/flutter/issues/138004
This commit is contained in:
@@ -212,63 +212,6 @@ bool Path::GetContourComponentAtIndex(size_t index,
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Path::UpdateLinearComponentAtIndex(size_t index,
|
||||
const LinearPathComponent& linear) {
|
||||
if (index >= components_.size()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (components_[index].type != ComponentType::kLinear) {
|
||||
return false;
|
||||
}
|
||||
|
||||
linears_[components_[index].index] = linear;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Path::UpdateQuadraticComponentAtIndex(
|
||||
size_t index,
|
||||
const QuadraticPathComponent& quadratic) {
|
||||
if (index >= components_.size()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (components_[index].type != ComponentType::kQuadratic) {
|
||||
return false;
|
||||
}
|
||||
|
||||
quads_[components_[index].index] = quadratic;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Path::UpdateCubicComponentAtIndex(size_t index,
|
||||
CubicPathComponent& cubic) {
|
||||
if (index >= components_.size()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (components_[index].type != ComponentType::kCubic) {
|
||||
return false;
|
||||
}
|
||||
|
||||
cubics_[components_[index].index] = cubic;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Path::UpdateContourComponentAtIndex(size_t index,
|
||||
const ContourComponent& move) {
|
||||
if (index >= components_.size()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (components_[index].type != ComponentType::kContour) {
|
||||
return false;
|
||||
}
|
||||
|
||||
contours_[components_[index].index] = move;
|
||||
return true;
|
||||
}
|
||||
|
||||
Path::Polyline Path::CreatePolyline(Scalar scale) const {
|
||||
Polyline polyline;
|
||||
|
||||
|
||||
@@ -173,17 +173,6 @@ class Path {
|
||||
|
||||
void Shift(Point shift);
|
||||
|
||||
bool UpdateLinearComponentAtIndex(size_t index,
|
||||
const LinearPathComponent& linear);
|
||||
|
||||
bool UpdateQuadraticComponentAtIndex(size_t index,
|
||||
const QuadraticPathComponent& quadratic);
|
||||
|
||||
bool UpdateCubicComponentAtIndex(size_t index, CubicPathComponent& cubic);
|
||||
|
||||
bool UpdateContourComponentAtIndex(size_t index,
|
||||
const ContourComponent& contour);
|
||||
|
||||
struct ComponentIndexPair {
|
||||
ComponentType type = ComponentType::kLinear;
|
||||
size_t index = 0;
|
||||
|
||||
@@ -76,38 +76,6 @@ PathBuilder& PathBuilder::QuadraticCurveTo(Point controlPoint,
|
||||
return *this;
|
||||
}
|
||||
|
||||
Point PathBuilder::ReflectedQuadraticControlPoint1() const {
|
||||
/*
|
||||
* If there is no previous command or if the previous command was not a
|
||||
* quadratic, assume the control point is coincident with the current point.
|
||||
*/
|
||||
if (prototype_.GetComponentCount() == 0) {
|
||||
return current_;
|
||||
}
|
||||
|
||||
QuadraticPathComponent quad;
|
||||
if (!prototype_.GetQuadraticComponentAtIndex(
|
||||
prototype_.GetComponentCount() - 1, quad)) {
|
||||
return current_;
|
||||
}
|
||||
|
||||
/*
|
||||
* The control point is assumed to be the reflection of the control point on
|
||||
* the previous command relative to the current point.
|
||||
*/
|
||||
return (current_ * 2.0) - quad.cp;
|
||||
}
|
||||
|
||||
PathBuilder& PathBuilder::SmoothQuadraticCurveTo(Point point, bool relative) {
|
||||
point = relative ? current_ + point : point;
|
||||
/*
|
||||
* The reflected control point is absolute and we made the endpoint absolute
|
||||
* too. So there the last argument is always false (i.e, not relative).
|
||||
*/
|
||||
QuadraticCurveTo(point, ReflectedQuadraticControlPoint1(), false);
|
||||
return *this;
|
||||
}
|
||||
|
||||
PathBuilder& PathBuilder::SetConvexity(Convexity value) {
|
||||
convexity_ = value;
|
||||
return *this;
|
||||
@@ -125,44 +93,6 @@ PathBuilder& PathBuilder::CubicCurveTo(Point controlPoint1,
|
||||
return *this;
|
||||
}
|
||||
|
||||
Point PathBuilder::ReflectedCubicControlPoint1() const {
|
||||
/*
|
||||
* If there is no previous command or if the previous command was not a
|
||||
* cubic, assume the first control point is coincident with the current
|
||||
* point.
|
||||
*/
|
||||
if (prototype_.GetComponentCount() == 0) {
|
||||
return current_;
|
||||
}
|
||||
|
||||
CubicPathComponent cubic;
|
||||
if (!prototype_.GetCubicComponentAtIndex(prototype_.GetComponentCount() - 1,
|
||||
cubic)) {
|
||||
return current_;
|
||||
}
|
||||
|
||||
/*
|
||||
* The first control point is assumed to be the reflection of the second
|
||||
* control point on the previous command relative to the current point.
|
||||
*/
|
||||
return (current_ * 2.0) - cubic.cp2;
|
||||
}
|
||||
|
||||
PathBuilder& PathBuilder::SmoothCubicCurveTo(Point controlPoint2,
|
||||
Point point,
|
||||
bool relative) {
|
||||
auto controlPoint1 = ReflectedCubicControlPoint1();
|
||||
controlPoint2 = relative ? current_ + controlPoint2 : controlPoint2;
|
||||
auto endpoint = relative ? current_ + point : point;
|
||||
|
||||
CubicCurveTo(endpoint, // endpoint
|
||||
controlPoint1, // control point 1
|
||||
controlPoint2, // control point 2
|
||||
false // relative since all points are already absolute
|
||||
);
|
||||
return *this;
|
||||
}
|
||||
|
||||
PathBuilder& PathBuilder::AddQuadraticCurve(Point p1, Point cp, Point p2) {
|
||||
MoveTo(p1);
|
||||
prototype_.AddQuadraticComponent(p1, cp, p2);
|
||||
|
||||
@@ -55,8 +55,6 @@ class PathBuilder {
|
||||
Point point,
|
||||
bool relative = false);
|
||||
|
||||
PathBuilder& SmoothQuadraticCurveTo(Point point, bool relative = false);
|
||||
|
||||
/// @brief Insert a cubic curve from the curren position to `point` using the
|
||||
/// control points `controlPoint1` and `controlPoint2`.
|
||||
///
|
||||
@@ -67,10 +65,6 @@ class PathBuilder {
|
||||
Point point,
|
||||
bool relative = false);
|
||||
|
||||
PathBuilder& SmoothCubicCurveTo(Point controlPoint2,
|
||||
Point point,
|
||||
bool relative = false);
|
||||
|
||||
PathBuilder& AddRect(Rect rect);
|
||||
|
||||
PathBuilder& AddCircle(const Point& center, Scalar radius);
|
||||
@@ -165,10 +159,6 @@ class PathBuilder {
|
||||
|
||||
PathBuilder& AddRoundedRectBottomLeft(Rect rect, RoundingRadii radii);
|
||||
|
||||
Point ReflectedQuadraticControlPoint1() const;
|
||||
|
||||
Point ReflectedCubicControlPoint1() const;
|
||||
|
||||
PathBuilder(const PathBuilder&) = delete;
|
||||
PathBuilder& operator=(const PathBuilder&&) = delete;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user