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=2ec66880966a6133ddd9331ce7323438
5cb93a386Sopenharmony_ciREG_FIDDLE(Path_getVerbs, 256, 256, true, 0) {
6cb93a386Sopenharmony_civoid draw(SkCanvas* canvas) {
7cb93a386Sopenharmony_ci    auto debugster = [](const char* prefix, const SkPath& path, uint8_t* verbs, int max) -> void {
8cb93a386Sopenharmony_ci         int count = path.getVerbs(verbs, max);
9cb93a386Sopenharmony_ci         SkDebugf("%s verb count: %d  ", prefix, count);
10cb93a386Sopenharmony_ci         const char* verbStr[] = { "move", "line", "quad", "conic", "cubic", "close" };
11cb93a386Sopenharmony_ci         for (int i = 0; i < std::min(count, max) && verbs; ++i) {
12cb93a386Sopenharmony_ci             SkDebugf("%s ", verbStr[verbs[i]]);
13cb93a386Sopenharmony_ci         }
14cb93a386Sopenharmony_ci         SkDebugf("\n");
15cb93a386Sopenharmony_ci    };
16cb93a386Sopenharmony_ci    SkPath path;
17cb93a386Sopenharmony_ci    path.lineTo(20, 20);
18cb93a386Sopenharmony_ci    path.lineTo(-10, -10);
19cb93a386Sopenharmony_ci    uint8_t verbs[3];
20cb93a386Sopenharmony_ci    debugster("no verbs",  path, nullptr, 0);
21cb93a386Sopenharmony_ci    debugster("zero max",  path, verbs, 0);
22cb93a386Sopenharmony_ci    debugster("too small",  path, verbs, 2);
23cb93a386Sopenharmony_ci    debugster("just right",  path, verbs, path.countVerbs());
24cb93a386Sopenharmony_ci}
25cb93a386Sopenharmony_ci}  // END FIDDLE
26