blob: 176b83873eeb972c160c003e95e28e4bffd93df9 [file] [log] [blame]
fmalita6ceef3d2016-07-26 18:46:34 -07001/*
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 "SkPath.h"
fmalitabffc2562016-08-03 10:21:11 -070012#include "SkSVGShape.h"
fmalita6ceef3d2016-07-26 18:46:34 -070013
fmalitabffc2562016-08-03 10:21:11 -070014class SkSVGPath final : public SkSVGShape {
fmalita6ceef3d2016-07-26 18:46:34 -070015public:
Brian Salomond3b65972017-03-22 12:05:03 -040016 ~SkSVGPath() override = default;
fmalita6ceef3d2016-07-26 18:46:34 -070017 static sk_sp<SkSVGPath> Make() { return sk_sp<SkSVGPath>(new SkSVGPath()); }
18
fmalita6ceef3d2016-07-26 18:46:34 -070019 void setPath(const SkPath& path) { fPath = path; }
20
21protected:
fmalita6ceef3d2016-07-26 18:46:34 -070022 void onSetAttribute(SkSVGAttribute, const SkSVGValue&) override;
23
Florin Malitae932d4b2016-12-01 13:35:11 -050024 void onDraw(SkCanvas*, const SkSVGLengthContext&, const SkPaint&,
25 SkPath::FillType) const override;
fmalitabffc2562016-08-03 10:21:11 -070026
Florin Malitace8840e2016-12-08 09:26:47 -050027 SkPath onAsPath(const SkSVGRenderContext&) const override;
28
fmalita6ceef3d2016-07-26 18:46:34 -070029private:
30 SkSVGPath();
31
Florin Malitae932d4b2016-12-01 13:35:11 -050032 mutable SkPath fPath; // mutated in onDraw(), to apply inherited fill types.
fmalita6ceef3d2016-07-26 18:46:34 -070033
fmalitabffc2562016-08-03 10:21:11 -070034 typedef SkSVGShape INHERITED;
fmalita6ceef3d2016-07-26 18:46:34 -070035};
36
37#endif // SkSVGPath_DEFINED