Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
SkPathWriter.h
Go to the documentation of this file.
1/*
2 * Copyright 2012 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7#ifndef SkPathWriter_DEFINED
8#define SkPathWriter_DEFINED
9
10#include "include/core/SkPath.h"
15
16class SkOpPtT;
17
18// Construct the path one contour at a time.
19// If the contour is closed, copy it to the final output.
20// Otherwise, keep the partial contour for later assembly.
21
23public:
24 SkPathWriter(SkPath& path);
25 void assemble();
26 void conicTo(const SkPoint& pt1, const SkOpPtT* pt2, SkScalar weight);
27 void cubicTo(const SkPoint& pt1, const SkPoint& pt2, const SkOpPtT* pt3);
28 bool deferredLine(const SkOpPtT* pt);
29 void deferredMove(const SkOpPtT* pt);
30 void finishContour();
31 bool hasMove() const { return !fFirstPtT; }
32 void init();
33 bool isClosed() const;
34 const SkPath* nativePath() const { return fPathPtr; }
35 void quadTo(const SkPoint& pt1, const SkOpPtT* pt2);
36
37private:
38 bool changedSlopes(const SkOpPtT* pt) const;
39 void close();
40 const SkTDArray<const SkOpPtT*>& endPtTs() const { return fEndPtTs; }
41 void lineTo();
42 bool matchedLast(const SkOpPtT*) const;
43 void moveTo();
44 const skia_private::TArray<SkPath>& partials() const { return fPartials; }
45 bool someAssemblyRequired();
46 SkPoint update(const SkOpPtT* pt);
47
48 SkPath fCurrent; // contour under construction
49 skia_private::TArray<SkPath> fPartials; // contours with mismatched starts and ends
50 SkTDArray<const SkOpPtT*> fEndPtTs; // possible pt values for partial starts and ends
51 SkPath* fPathPtr; // closed contours are written here
52 const SkOpPtT* fDefer[2]; // [0] deferred move, [1] deferred line
53 const SkOpPtT* fFirstPtT; // first in current contour
54};
55
56#endif /* defined(__PathOps__SkPathWriter__) */
void finishContour()
void deferredMove(const SkOpPtT *pt)
bool isClosed() const
const SkPath * nativePath() const
void conicTo(const SkPoint &pt1, const SkOpPtT *pt2, SkScalar weight)
bool hasMove() const
void cubicTo(const SkPoint &pt1, const SkPoint &pt2, const SkOpPtT *pt3)
bool deferredLine(const SkOpPtT *pt)
void quadTo(const SkPoint &pt1, const SkOpPtT *pt2)
float SkScalar
Definition extension.cpp:12