2016-07-27 01:46:34 +00:00
|
|
|
/*
|
|
|
|
* Copyright 2016 Google Inc.
|
|
|
|
*
|
|
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
|
|
* found in the LICENSE file.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef SkSVGPath_DEFINED
|
|
|
|
#define SkSVGPath_DEFINED
|
|
|
|
|
|
|
|
#include "SkPath.h"
|
2016-08-03 17:21:11 +00:00
|
|
|
#include "SkSVGShape.h"
|
2016-07-27 01:46:34 +00:00
|
|
|
|
2016-08-03 17:21:11 +00:00
|
|
|
class SkSVGPath final : public SkSVGShape {
|
2016-07-27 01:46:34 +00:00
|
|
|
public:
|
2017-03-22 16:05:03 +00:00
|
|
|
~SkSVGPath() override = default;
|
2016-07-27 01:46:34 +00:00
|
|
|
static sk_sp<SkSVGPath> Make() { return sk_sp<SkSVGPath>(new SkSVGPath()); }
|
|
|
|
|
|
|
|
void setPath(const SkPath& path) { fPath = path; }
|
|
|
|
|
|
|
|
protected:
|
|
|
|
void onSetAttribute(SkSVGAttribute, const SkSVGValue&) override;
|
|
|
|
|
2016-12-01 18:35:11 +00:00
|
|
|
void onDraw(SkCanvas*, const SkSVGLengthContext&, const SkPaint&,
|
|
|
|
SkPath::FillType) const override;
|
2016-08-03 17:21:11 +00:00
|
|
|
|
2016-12-08 14:26:47 +00:00
|
|
|
SkPath onAsPath(const SkSVGRenderContext&) const override;
|
|
|
|
|
2016-07-27 01:46:34 +00:00
|
|
|
private:
|
|
|
|
SkSVGPath();
|
|
|
|
|
2016-12-01 18:35:11 +00:00
|
|
|
mutable SkPath fPath; // mutated in onDraw(), to apply inherited fill types.
|
2016-07-27 01:46:34 +00:00
|
|
|
|
2016-08-03 17:21:11 +00:00
|
|
|
typedef SkSVGShape INHERITED;
|
2016-07-27 01:46:34 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // SkSVGPath_DEFINED
|