1/* 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" 12#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 SkPath::FillType) 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 typedef SkSVGShape INHERITED; 35}; 36 37#endif // SkSVGPath_DEFINED 38