1cb93a386Sopenharmony_ci// Copyright 2019 Google LLC.
2cb93a386Sopenharmony_ci// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
3cb93a386Sopenharmony_ci#include "tools/fiddle/examples.h"
4cb93a386Sopenharmony_ci// HASH=6fb11419e99297fe2fe666c296117fb9
5cb93a386Sopenharmony_ciREG_FIDDLE(Conic_Weight_c, 256, 256, true, 0) {
6cb93a386Sopenharmony_civoid draw(SkCanvas* canvas) {
7cb93a386Sopenharmony_ci    const char* verbNames[] = { "move", "line", "quad", "conic", "cubic", "close", "done" };
8cb93a386Sopenharmony_ci    const int pointCount[]  = {     1 ,     2 ,     3 ,      3 ,      4 ,      1 ,     0  };
9cb93a386Sopenharmony_ci    SkPath path;
10cb93a386Sopenharmony_ci    path.conicTo(20, 0, 20, 20, SK_ScalarInfinity);
11cb93a386Sopenharmony_ci    SkPath::Iter iter(path, false);
12cb93a386Sopenharmony_ci    SkPath::Verb verb;
13cb93a386Sopenharmony_ci    do {
14cb93a386Sopenharmony_ci       SkPoint points[4];
15cb93a386Sopenharmony_ci       verb = iter.next(points);
16cb93a386Sopenharmony_ci       SkDebugf("%s ", verbNames[(int) verb]);
17cb93a386Sopenharmony_ci       for (int i = 0; i < pointCount[(int) verb]; ++i) {
18cb93a386Sopenharmony_ci            SkDebugf("{%g, %g}, ", points[i].fX, points[i].fY);
19cb93a386Sopenharmony_ci       }
20cb93a386Sopenharmony_ci       if (SkPath::kConic_Verb == verb) {
21cb93a386Sopenharmony_ci           SkDebugf("weight = %g", iter.conicWeight());
22cb93a386Sopenharmony_ci       }
23cb93a386Sopenharmony_ci       SkDebugf("\n");
24cb93a386Sopenharmony_ci    } while (SkPath::kDone_Verb != verb);
25cb93a386Sopenharmony_ci}
26cb93a386Sopenharmony_ci}  // END FIDDLE
27