122template <
typename Edge>
126 return edge->fDX == 0
127 && edge->fEdgeType == Edge::kLine_Type;
135 if (edge->
setLine(pts[0], pts[1], fClipShift)) {
149 if (edge->
setLine(pts[0], pts[1])) {
177 if (edge->
setCubic(pts, fClipShift)) {
191 char* arg_edge,
char** arg_edgePtr) {
192 auto edge = (
SkEdge*) arg_edge;
193 auto edgePtr = (
SkEdge**)arg_edgePtr;
195 if (edge->
setLine(pts[0], pts[1], fClipShift)) {
197 ? this->combineVertical(edge, edgePtr[-1])
203 char* arg_edge,
char** arg_edgePtr) {
207 if (edge->
setLine(pts[0], pts[1])) {
209 ? this->combineVertical(edge, edgePtr[-1])
235int SkEdgeBuilder::buildPoly(
const SkPath& path,
const SkIRect* iclip,
bool canCullToTheRight) {
236 size_t maxEdgeCount = path.countPoints();
249 char* edge = this->
allocEdges(maxEdgeCount, &edgeSize);
259 while (
auto e = iter.next()) {
261 case SkPathEdgeIter::Edge::kLine: {
265 for (
int i = 0; i < lineCount; i++) {
266 switch( this->
addPolyLine(lines + i, edge, edgePtr) ) {
281 while (
auto e = iter.next()) {
283 case SkPathEdgeIter::Edge::kLine: {
298 SkASSERT((
size_t)(edge - edgeStart) <= maxEdgeCount * edgeSize);
303int SkEdgeBuilder::build(
const SkPath& path,
const SkIRect* iclip,
bool canCullToTheRight) {
306 bool is_finite =
true;
314 } rec = {
this,
true };
318 Rec* rec = (Rec*)ctx;
325 rec->fIsFinite =
false;
336 is_finite = rec.fIsFinite;
338 auto handle_quad = [
this](
const SkPoint pts[3]) {
341 for (
int i = 0; i <= n; i++) {
345 while (
auto e = iter.next()) {
347 case SkPathEdgeIter::Edge::kLine:
350 case SkPathEdgeIter::Edge::kQuad: {
354 case SkPathEdgeIter::Edge::kConic: {
356 e.fPts, iter.conicWeight(), conicTol);
357 for (
int i = 0; i < quadder.
countQuads(); ++i) {
358 handle_quad(quadPts);
362 case SkPathEdgeIter::Edge::kCubic: {
365 for (
int i = 0; i <= n; i++) {
380 const bool canCullToTheRight = !path.isConvex();
385 ? this->buildPoly(path, shiftedClip, canCullToTheRight)
386 : this->
build (path, shiftedClip, canCullToTheRight);
391 if (!canCullToTheRight) {
#define SkDEBUGFAIL(message)
static bool is_vertical(const Edge *edge)
static bool SkIsFinite(T x, Pack... values)
int SkChopCubicAtYExtrema(const SkPoint src[4], SkPoint dst[10])
int SkChopQuadAtYExtrema(const SkPoint src[3], SkPoint dst[5])
bool approximately_equal(double x, double y)
static SkPath clip(const SkPath &path, const SkHalfPlane &plane)
static int32_t SkAbs32(int32_t value)
constexpr int SkToInt(S x)
void addLine(const SkPoint pts[]) override
SkRect recoverClip(const SkIRect &) const override
void addCubic(const SkPoint pts[]) override
Combine addPolyLine(const SkPoint pts[], char *edge, char **edgePtr) override
void addQuad(const SkPoint pts[]) override
char * allocEdges(size_t, size_t *) override
T * makeArrayDefault(size_t count)
auto make(Ctor &&ctor) -> decltype(ctor(nullptr))
const SkPoint * computeQuads(const SkConic &conic, SkScalar tol)
Combine addPolyLine(const SkPoint pts[], char *edge, char **edgePtr) override
char * allocEdges(size_t, size_t *) override
SkRect recoverClip(const SkIRect &) const override
void addQuad(const SkPoint pts[]) override
void addCubic(const SkPoint pts[]) override
void addLine(const SkPoint pts[]) override
virtual void addLine(const SkPoint pts[])=0
virtual SkRect recoverClip(const SkIRect &) const =0
SkTDArray< void * > fList
virtual void addCubic(const SkPoint pts[])=0
virtual void addQuad(const SkPoint pts[])=0
SkSTArenaAlloc< 512 > fAlloc
int buildEdges(const SkPath &path, const SkIRect *shiftedClip)
virtual char * allocEdges(size_t n, size_t *sizeof_edge)=0
virtual Combine addPolyLine(const SkPoint pts[], char *edge, char **edgePtr)=0
static void ClipPath(const SkPath &path, const SkRect &clip, bool canCullToTheRight, void(*consume)(SkEdgeClipper *, bool newCtr, void *ctx), void *ctx)
SkPath::Verb next(SkPoint pts[])
static int ClipLine(const SkPoint pts[2], const SkRect &clip, SkPoint lines[kMaxPoints], bool canCullToTheRight)
@ kMaxClippedLineSegments
static int PtsInIter(unsigned verb)
size_t mul(size_t x, size_t y)
void push_back(const T &v)
bool setCubic(const SkPoint pts[4], bool sortY=true)
bool setLine(const SkPoint &p0, const SkPoint &p1)
bool setQuadratic(const SkPoint pts[3])
int setCubic(const SkPoint pts[4], int shiftUp)
int setLine(const SkPoint &p0, const SkPoint &p1, const SkIRect *clip, int shiftUp)
int setQuadratic(const SkPoint pts[3], int shiftUp)
static SkRect Make(const SkISize &size)