28 contours.closeContourIfNeeded();
29 contours.moveToStartOfContour(pts[0]);
32 contours.addPointToCurrentContour(pts[1]);
44 contours.closeContourIfNeeded();
48 SK_ABORT(
"The while loop above failed.");
53 contours.closeContourIfNeeded();
64 top = std::min(p.y, r.
fTop),
66 bottom = std::max(p.y, r.
fBottom);
70Point Contours::RoundSkPoint(
SkPoint p) {
74bool Contours::currentContourIsEmpty()
const {
75 int32_t lastEnd = fContours.empty() ? 0 : fContours.back().end;
76 return lastEnd ==
SkToS32(fPoints.size());
79void Contours::addPointToCurrentContour(
SkPoint p) {
80 if (this->currentContourIsEmpty()) {
81 fPoints.push_back(fContourStart);
82 fContourBounds =
extend_rect(fContourBounds, fContourStart);
84 Point point = RoundSkPoint(p);
85 fPoints.push_back(point);
86 fContourBounds =
extend_rect(fContourBounds, point);
89void Contours::moveToStartOfContour(
SkPoint p) {
90 fContourStart = RoundSkPoint(p);
93void Contours::closeContourIfNeeded() {
94 if (this->currentContourIsEmpty()) {
98 fContours.push_back({fContourBounds,
SkToS32(fPoints.size())});
99 fContourBounds = kEmptyRect;
#define SK_ABORT(message,...)
static bool left(const SkPoint &p0, const SkPoint &p1)
static bool right(const SkPoint &p0, const SkPoint &p1)
#define SkScalarRoundToInt(x)
constexpr int32_t SkToS32(S x)
Verb next(SkPoint pts[4])
std::vector< myers::Segment > segments() const
static constexpr double kScaleFactor
static Contours Make(SkPath path)
static SkIRect extend_rect(SkIRect r, Point p)
int32_t fBottom
larger y-axis bounds
int32_t fTop
smaller y-axis bounds
int32_t fLeft
smaller x-axis bounds
int32_t fRight
larger x-axis bounds