29 SkDoOnce() { fDidOnce =
false; }
31 SkDoOnce(SkDoOnce&) =
delete;
32 SkDoOnce& operator=(SkDoOnce&) =
delete;
34 bool needToDo()
const {
return !fDidOnce; }
35 bool alreadyDone()
const {
return fDidOnce; }
55 if (fOnce.alreadyDone()) {
61 fPaths.push_back(
b.moveTo(0, 0)
62 .quadTo(50, 100, 0, 100)
66 fPaths.push_back(
b.moveTo(0, 50)
67 .quadTo(50, 0, 100, 50)
68 .quadTo(50, 100, 0, 50)
81 static constexpr int kLength = 100;
82 static constexpr int kPtsPerSide = (1 << 12);
85 for (
int i = 1;
i < kPtsPerSide; ++
i) {
88 for (
int i = 0;
i < kPtsPerSide; ++
i) {
91 for (
int i = kPtsPerSide;
i > 0; --
i) {
94 for (
int i = kPtsPerSide;
i > 0; --
i) {
97 fPaths.push_back(
b.detach());
100 fPaths.push_back(
SkPath::Polygon({{0,0}, {100,1}, {98,100}, {3,96}},
false));
106 fPaths.push_back(
b.cubicTo( 1, 1, 10, 90, 0, 100).detach());
107 fPaths.push_back(
b.cubicTo(100, 50, 20, 100, 0, 0).detach());
111 fPaths.push_back(
b.moveTo(10, 10)
112 .cubicTo(10, 10, 10, 0, 20, 0)
114 .cubicTo(40, 0, 50, 0, 50, 10)
118 fPaths.push_back(
b.moveTo(10, 10)
119 .cubicTo(10, 0, 10, 0, 20, 0)
121 .cubicTo(50, 0, 50, 0, 50, 10)
125 fPaths.push_back(
b.moveTo(0, 228.0f/8)
126 .cubicTo( 628.0f/ 8, 82.0f/8,
127 1255.0f/ 8, 141.0f/8,
128 1883.0f/ 8, 202.0f/8)
132 fPaths.push_back(
b.moveTo(10, 0)
133 .cubicTo(0, 1, 30, 1, 20, 0)
137 fPaths.push_back(
b.moveTo(0, 0)
138 .cubicTo(10, 1, 30, 1, 20, 0)
142 fPaths.push_back(
b.moveTo(10, 0)
143 .cubicTo(0, 1, 20, 1, 30, 0)
147 fPaths.push_back(
b.moveTo(8.59375f, 45)
148 .quadTo(16.9921875f, 45,
151 .lineTo(8.59375f, 45)
155 fPaths.push_back(
b.moveTo(0, 25)
157 .quadTo(50, 50, 50, 50)
161 fPaths.push_back(
b.moveTo(0, 25)
163 .cubicTo(50, 0, 50, 50, 50, 50)
167 fPaths.push_back(
b.moveTo(0, 25)
169 .quadTo(50, 49.95f, 50, 50)
173 fPaths.push_back(
b.moveTo(0, 25)
175 .cubicTo(50, 49.95f, 50, 49.97f, 50, 50)
179 fPaths.push_back(
b.moveTo(0, 25)
182 .cubicTo(50, 50, 50, 50, 50, 50)
189 fPaths.push_back(
b.moveTo(50, 50)
190 .quadTo(50, 50, 50, 50)
194 fPaths.push_back(
b.moveTo(50, 50)
195 .cubicTo(50, 50, 50, 50, 50, 50)
199 fPaths.push_back(
b.moveTo(0, 0)
206 fPaths.push_back(
b.moveTo(0, 0)
211 fPaths.push_back(
b.lineTo(100, 100).detach());
212 fPaths.push_back(
b.quadTo(100, 100, 0, 0).detach());
213 fPaths.push_back(
b.quadTo(100, 100, 50, 50).detach());
214 fPaths.push_back(
b.quadTo(50, 50, 100, 100).detach());
215 fPaths.push_back(
b.cubicTo(0, 0, 0, 0, 100, 100).detach());
218 fPaths.push_back(
b.moveTo(16.875f, 192.594f)
219 .cubicTo(45.625f, 192.594f, 74.375f, 192.594f, 103.125f, 192.594f)
220 .cubicTo(88.75f, 167.708f, 74.375f, 142.823f, 60, 117.938f)
221 .cubicTo(45.625f, 142.823f, 31.25f, 167.708f, 16.875f, 192.594f)
225 m.setAll(0.1f, 0, -1, 0, 0.115207f, -2.64977f, 0, 0, 1);
226 fPaths.back().transform(
m);
237 paint.setAntiAlias(
true);
242 canvas->
scale(2.0f/3, 2.0f/3);
244 for (
int i = 0;
i < fPaths.size(); ++
i) {
248 200.0f * (
i / 5) + 9.0f/10);
265DEF_GM(
return new ConvexPathsGM; )
void translate(SkScalar dx, SkScalar dy)
void drawPath(const SkPath &path, const SkPaint &paint)
void scale(SkScalar sx, SkScalar sy)
static SkPath RRect(const SkRRect &, SkPathDirection dir=SkPathDirection::kCW)
static SkPath Rect(const SkRect &, SkPathDirection=SkPathDirection::kCW, unsigned startIndex=0)
static SkPath Circle(SkScalar center_x, SkScalar center_y, SkScalar radius, SkPathDirection dir=SkPathDirection::kCW)
static SkPath Oval(const SkRect &, SkPathDirection=SkPathDirection::kCW)
static SkPath Polygon(const SkPoint pts[], int count, bool isClosed, SkPathFillType=SkPathFillType::kWinding, bool isVolatile=false)
static SkPath Line(const SkPoint a, const SkPoint b)
static SkRRect MakeRectXY(const SkRect &rect, SkScalar xRad, SkScalar yRad)
virtual SkISize getISize()=0
virtual void onOnceBeforeDraw()
virtual SkString getName() const =0
virtual DrawResult onDraw(SkCanvas *, SkString *errorMsg)
static constexpr SkRect MakeXYWH(float x, float y, float w, float h)