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)
83 kPtsPerSide = (1 << 12),
86 for (
int i = 1; i < kPtsPerSide; ++i) {
89 for (
int i = 0; i < kPtsPerSide; ++i) {
92 for (
int i = kPtsPerSide; i > 0; --i) {
95 for (
int i = kPtsPerSide; i > 0; --i) {
98 fPaths.push_back(
b.detach());
101 fPaths.push_back(
SkPath::Polygon({{0,0}, {100,1}, {98,100}, {3,96}},
false));
107 fPaths.push_back(
b.cubicTo( 1, 1, 10, 90, 0, 100).detach());
108 fPaths.push_back(
b.cubicTo(100, 50, 20, 100, 0, 0).detach());
112 fPaths.push_back(
b.moveTo(10, 10)
113 .cubicTo(10, 10, 10, 0, 20, 0)
115 .cubicTo(40, 0, 50, 0, 50, 10)
119 fPaths.push_back(
b.moveTo(10, 10)
120 .cubicTo(10, 0, 10, 0, 20, 0)
122 .cubicTo(50, 0, 50, 0, 50, 10)
126 fPaths.push_back(
b.moveTo(0, 228.0f/8)
127 .cubicTo( 628.0f/ 8, 82.0f/8,
128 1255.0f/ 8, 141.0f/8,
129 1883.0f/ 8, 202.0f/8)
133 fPaths.push_back(
b.moveTo(10, 0)
134 .cubicTo(0, 1, 30, 1, 20, 0)
138 fPaths.push_back(
b.moveTo(0, 0)
139 .cubicTo(10, 1, 30, 1, 20, 0)
143 fPaths.push_back(
b.moveTo(10, 0)
144 .cubicTo(0, 1, 20, 1, 30, 0)
148 fPaths.push_back(
b.moveTo(8.59375f, 45)
149 .quadTo(16.9921875f, 45,
152 .lineTo(8.59375f, 45)
156 fPaths.push_back(
b.moveTo(0, 25)
158 .quadTo(50, 50, 50, 50)
162 fPaths.push_back(
b.moveTo(0, 25)
164 .cubicTo(50, 0, 50, 50, 50, 50)
168 fPaths.push_back(
b.moveTo(0, 25)
170 .quadTo(50, 49.95f, 50, 50)
174 fPaths.push_back(
b.moveTo(0, 25)
176 .cubicTo(50, 49.95f, 50, 49.97f, 50, 50)
180 fPaths.push_back(
b.moveTo(0, 25)
183 .cubicTo(50, 50, 50, 50, 50, 50)
190 fPaths.push_back(
b.moveTo(50, 50)
191 .quadTo(50, 50, 50, 50)
195 fPaths.push_back(
b.moveTo(50, 50)
196 .cubicTo(50, 50, 50, 50, 50, 50)
200 fPaths.push_back(
b.moveTo(0, 0)
207 fPaths.push_back(
b.moveTo(0, 0)
212 fPaths.push_back(
b.lineTo(100, 100).detach());
213 fPaths.push_back(
b.quadTo(100, 100, 0, 0).detach());
214 fPaths.push_back(
b.quadTo(100, 100, 50, 50).detach());
215 fPaths.push_back(
b.quadTo(50, 50, 100, 100).detach());
216 fPaths.push_back(
b.cubicTo(0, 0, 0, 0, 100, 100).detach());
219 fPaths.push_back(
b.moveTo(16.875f, 192.594f)
220 .cubicTo(45.625f, 192.594f, 74.375f, 192.594f, 103.125f, 192.594f)
221 .cubicTo(88.75f, 167.708f, 74.375f, 142.823f, 60, 117.938f)
222 .cubicTo(45.625f, 142.823f, 31.25f, 167.708f, 16.875f, 192.594f)
226 m.setAll(0.1f, 0, -1, 0, 0.115207f, -2.64977f, 0, 0, 1);
227 fPaths.back().transform(m);
238 paint.setAntiAlias(
true);
243 canvas->
scale(2.0f/3, 2.0f/3);
245 for (
int i = 0; i < fPaths.size(); ++i) {
248 canvas->
translate(200.0f * (i % 5) + 1.0f/10,
249 200.0f * (i / 5) + 9.0f/10);
266DEF_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)