| 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 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 }; | 24 }; |
| 25 | 25 |
| 26 class SkSVGNode : public SkRefCnt { | 26 class SkSVGNode : public SkRefCnt { |
| 27 public: | 27 public: |
| 28 virtual ~SkSVGNode(); | 28 virtual ~SkSVGNode(); |
| 29 | 29 |
| 30 SkSVGTag tag() const { return fTag; } | 30 SkSVGTag tag() const { return fTag; } |
| 31 | 31 |
| 32 virtual void appendChild(sk_sp<SkSVGNode>) = 0; | 32 virtual void appendChild(sk_sp<SkSVGNode>) = 0; |
| 33 | 33 |
| 34 void render(SkCanvas*, const SkSVGRenderContext&) const; | 34 void render(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 // Called before onRender(), to apply local attributes to the context. Unli
ke onRender(), |
| 42 // onPrepareToRender() bubbles up the inheritance chain: overriders should a
lways call |
| 43 // INHERITED::onPrepareToRender(), unless they intend to short-circuit rende
ring |
| 44 // (return false). |
| 45 // Implementations are expected to return true if rendering is to continue,
or false if |
| 46 // the node/subtree rendering is disabled. |
| 47 virtual bool onPrepareToRender(SkSVGRenderContext*) const; |
| 48 |
| 49 virtual void onRender(const SkSVGRenderContext&) const = 0; |
| 42 | 50 |
| 43 virtual void onSetAttribute(SkSVGAttribute, const SkSVGValue&); | 51 virtual void onSetAttribute(SkSVGAttribute, const SkSVGValue&); |
| 44 | 52 |
| 45 virtual const SkMatrix& onLocalMatrix() const; | |
| 46 | |
| 47 private: | 53 private: |
| 48 SkSVGTag fTag; | 54 SkSVGTag fTag; |
| 49 | 55 |
| 50 // FIXME: this should be sparse | 56 // FIXME: this should be sparse |
| 51 SkSVGPresentationAttributes fPresentationAttributes; | 57 SkSVGPresentationAttributes fPresentationAttributes; |
| 52 | 58 |
| 53 typedef SkRefCnt INHERITED; | 59 typedef SkRefCnt INHERITED; |
| 54 }; | 60 }; |
| 55 | 61 |
| 56 #endif // SkSVGNode_DEFINED | 62 #endif // SkSVGNode_DEFINED |
| OLD | NEW |