blob: 169837e3cc52b5e9f98ceafed1d64b0d29fda2f3 [file] [log] [blame]
Florin Malitab3418102020-10-15 18:10:29 -04001/*
2 * Copyright 2016 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8#ifndef SkSVGPath_DEFINED
9#define SkSVGPath_DEFINED
10
11#include "include/core/SkPath.h"
12#include "modules/svg/include/SkSVGShape.h"
13
14class SkSVGPath final : public SkSVGShape {
15public:
16 ~SkSVGPath() override = default;
17 static sk_sp<SkSVGPath> Make() { return sk_sp<SkSVGPath>(new SkSVGPath()); }
18
19 void setPath(const SkPath& path) { fPath = path; }
20
21protected:
22 void onSetAttribute(SkSVGAttribute, const SkSVGValue&) override;
23
24 void onDraw(SkCanvas*, const SkSVGLengthContext&, const SkPaint&,
25 SkPathFillType) const override;
26
27 SkPath onAsPath(const SkSVGRenderContext&) const override;
28
29private:
30 SkSVGPath();
31
32 mutable SkPath fPath; // mutated in onDraw(), to apply inherited fill types.
33
34 using INHERITED = SkSVGShape;
35};
36
37#endif // SkSVGPath_DEFINED