blob: 979fe8abf117969fc7c478a0686a3d4bd4b1b85b [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:
Florin Malitab3418102020-10-15 18:10:29 -040016 static sk_sp<SkSVGPath> Make() { return sk_sp<SkSVGPath>(new SkSVGPath()); }
17
18 void setPath(const SkPath& path) { fPath = path; }
19
20protected:
21 void onSetAttribute(SkSVGAttribute, const SkSVGValue&) override;
22
23 void onDraw(SkCanvas*, const SkSVGLengthContext&, const SkPaint&,
24 SkPathFillType) const override;
25
26 SkPath onAsPath(const SkSVGRenderContext&) const override;
27
28private:
29 SkSVGPath();
30
31 mutable SkPath fPath; // mutated in onDraw(), to apply inherited fill types.
32
33 using INHERITED = SkSVGShape;
34};
35
36#endif // SkSVGPath_DEFINED