| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2016 Google Inc. | 2 * Copyright 2016 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #ifndef SkSVGNode_DEFINED | 8 #ifndef SkSVGNode_DEFINED |
| 9 #define SkSVGNode_DEFINED | 9 #define SkSVGNode_DEFINED |
| 10 | 10 |
| 11 #include "SkRefCnt.h" | 11 #include "SkRefCnt.h" |
| 12 #include "SkSVGAttribute.h" | 12 #include "SkSVGAttribute.h" |
| 13 | 13 |
| 14 class SkCanvas; | 14 class SkCanvas; |
| 15 class SkMatrix; | 15 class SkMatrix; |
| 16 class SkSVGRenderContext; | 16 class SkSVGRenderContext; |
| 17 class SkSVGValue; | 17 class SkSVGValue; |
| 18 | 18 |
| 19 enum class SkSVGTag { | 19 enum class SkSVGTag { |
| 20 kG, | 20 kG, |
| 21 kPath, | 21 kPath, |
| 22 kRect, |
| 22 kSvg | 23 kSvg |
| 23 }; | 24 }; |
| 24 | 25 |
| 25 class SkSVGNode : public SkRefCnt { | 26 class SkSVGNode : public SkRefCnt { |
| 26 public: | 27 public: |
| 27 virtual ~SkSVGNode(); | 28 virtual ~SkSVGNode(); |
| 28 | 29 |
| 29 SkSVGTag tag() const { return fTag; } | 30 SkSVGTag tag() const { return fTag; } |
| 30 | 31 |
| 31 virtual void appendChild(sk_sp<SkSVGNode>) = 0; | 32 virtual void appendChild(sk_sp<SkSVGNode>) = 0; |
| 32 | 33 |
| 33 void render(SkCanvas*) const; | |
| 34 void render(SkCanvas*, const SkSVGRenderContext&) const; | 34 void render(SkCanvas*, const SkSVGRenderContext&) const; |
| 35 | 35 |
| 36 void setAttribute(SkSVGAttribute, const SkSVGValue&); | 36 void setAttribute(SkSVGAttribute, const SkSVGValue&); |
| 37 | 37 |
| 38 protected: | 38 protected: |
| 39 SkSVGNode(SkSVGTag); | 39 SkSVGNode(SkSVGTag); |
| 40 | 40 |
| 41 virtual void onRender(SkCanvas*, const SkSVGRenderContext&) const = 0; | 41 virtual void onRender(SkCanvas*, const SkSVGRenderContext&) const = 0; |
| 42 | 42 |
| 43 virtual void onSetAttribute(SkSVGAttribute, const SkSVGValue&); | 43 virtual void onSetAttribute(SkSVGAttribute, const SkSVGValue&); |
| 44 | 44 |
| 45 virtual const SkMatrix& onLocalMatrix() const; | 45 virtual const SkMatrix& onLocalMatrix() const; |
| 46 | 46 |
| 47 private: | 47 private: |
| 48 SkSVGTag fTag; | 48 SkSVGTag fTag; |
| 49 | 49 |
| 50 // FIXME: this should be sparse | 50 // FIXME: this should be sparse |
| 51 SkSVGPresentationAttributes fPresentationAttributes; | 51 SkSVGPresentationAttributes fPresentationAttributes; |
| 52 | 52 |
| 53 typedef SkRefCnt INHERITED; | 53 typedef SkRefCnt INHERITED; |
| 54 }; | 54 }; |
| 55 | 55 |
| 56 #endif // SkSVGNode_DEFINED | 56 #endif // SkSVGNode_DEFINED |
| OLD | NEW |