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=cedd6233848198e1fca4d1e14816baaf
5cb93a386Sopenharmony_ciREG_FIDDLE(Paint_getFillPath, 256, 192, false, 0) {
6cb93a386Sopenharmony_civoid draw(SkCanvas* canvas) {
7cb93a386Sopenharmony_ci    SkPaint strokePaint;
8cb93a386Sopenharmony_ci    strokePaint.setAntiAlias(true);
9cb93a386Sopenharmony_ci    strokePaint.setStyle(SkPaint::kStroke_Style);
10cb93a386Sopenharmony_ci    strokePaint.setStrokeWidth(.1f);
11cb93a386Sopenharmony_ci    SkPath strokePath;
12cb93a386Sopenharmony_ci    strokePath.moveTo(.08f, .08f);
13cb93a386Sopenharmony_ci    strokePath.quadTo(.09f, .08f, .17f, .17f);
14cb93a386Sopenharmony_ci    SkPath fillPath;
15cb93a386Sopenharmony_ci    SkPaint outlinePaint(strokePaint);
16cb93a386Sopenharmony_ci    outlinePaint.setStrokeWidth(2);
17cb93a386Sopenharmony_ci    SkMatrix scale = SkMatrix::Scale(300, 300);
18cb93a386Sopenharmony_ci    for (SkScalar precision : { 0.01f, .1f, 1.f, 10.f, 100.f } ) {
19cb93a386Sopenharmony_ci        strokePaint.getFillPath(strokePath, &fillPath, nullptr, precision);
20cb93a386Sopenharmony_ci        fillPath.transform(scale);
21cb93a386Sopenharmony_ci        canvas->drawPath(fillPath, outlinePaint);
22cb93a386Sopenharmony_ci        canvas->translate(60, 0);
23cb93a386Sopenharmony_ci        if (1.f == precision) canvas->translate(-180, 100);
24cb93a386Sopenharmony_ci    }
25cb93a386Sopenharmony_ci    strokePath.transform(scale);
26cb93a386Sopenharmony_ci    strokePaint.setStrokeWidth(30);
27cb93a386Sopenharmony_ci    canvas->drawPath(strokePath, strokePaint);
28cb93a386Sopenharmony_ci}
29cb93a386Sopenharmony_ci}  // END FIDDLE
30