1// Copyright 2019 Google LLC.
2// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
3#include "tools/fiddle/examples.h"
4// HASH=cedd6233848198e1fca4d1e14816baaf
5REG_FIDDLE(Paint_getFillPath, 256, 192, false, 0) {
6void draw(SkCanvas* canvas) {
7    SkPaint strokePaint;
8    strokePaint.setAntiAlias(true);
9    strokePaint.setStyle(SkPaint::kStroke_Style);
10    strokePaint.setStrokeWidth(.1f);
11    SkPath strokePath;
12    strokePath.moveTo(.08f, .08f);
13    strokePath.quadTo(.09f, .08f, .17f, .17f);
14    SkPath fillPath;
15    SkPaint outlinePaint(strokePaint);
16    outlinePaint.setStrokeWidth(2);
17    SkMatrix scale = SkMatrix::Scale(300, 300);
18    for (SkScalar precision : { 0.01f, .1f, 1.f, 10.f, 100.f } ) {
19        strokePaint.getFillPath(strokePath, &fillPath, nullptr, precision);
20        fillPath.transform(scale);
21        canvas->drawPath(fillPath, outlinePaint);
22        canvas->translate(60, 0);
23        if (1.f == precision) canvas->translate(-180, 100);
24    }
25    strokePath.transform(scale);
26    strokePaint.setStrokeWidth(30);
27    canvas->drawPath(strokePath, strokePaint);
28}
29}  // END FIDDLE
30