| 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 17 matching lines...) Expand all Loading... |
| 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(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 void setFill(const SkSVGPaint&); |
| 39 void setFillOpacity(const SkSVGNumberType&); |
| 40 void setStroke(const SkSVGPaint&); |
| 41 void setStrokeOpacity(const SkSVGNumberType&); |
| 42 void setStrokeWidth(const SkSVGLength&); |
| 43 |
| 38 protected: | 44 protected: |
| 39 SkSVGNode(SkSVGTag); | 45 SkSVGNode(SkSVGTag); |
| 40 | 46 |
| 41 // Called before onRender(), to apply local attributes to the context. Unli
ke onRender(), | 47 // 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 | 48 // onPrepareToRender() bubbles up the inheritance chain: overriders should a
lways call |
| 43 // INHERITED::onPrepareToRender(), unless they intend to short-circuit rende
ring | 49 // INHERITED::onPrepareToRender(), unless they intend to short-circuit rende
ring |
| 44 // (return false). | 50 // (return false). |
| 45 // Implementations are expected to return true if rendering is to continue,
or false if | 51 // Implementations are expected to return true if rendering is to continue,
or false if |
| 46 // the node/subtree rendering is disabled. | 52 // the node/subtree rendering is disabled. |
| 47 virtual bool onPrepareToRender(SkSVGRenderContext*) const; | 53 virtual bool onPrepareToRender(SkSVGRenderContext*) const; |
| 48 | 54 |
| 49 virtual void onRender(const SkSVGRenderContext&) const = 0; | 55 virtual void onRender(const SkSVGRenderContext&) const = 0; |
| 50 | 56 |
| 51 virtual void onSetAttribute(SkSVGAttribute, const SkSVGValue&); | 57 virtual void onSetAttribute(SkSVGAttribute, const SkSVGValue&); |
| 52 | 58 |
| 53 private: | 59 private: |
| 54 SkSVGTag fTag; | 60 SkSVGTag fTag; |
| 55 | 61 |
| 56 // FIXME: this should be sparse | 62 // FIXME: this should be sparse |
| 57 SkSVGPresentationAttributes fPresentationAttributes; | 63 SkSVGPresentationAttributes fPresentationAttributes; |
| 58 | 64 |
| 59 typedef SkRefCnt INHERITED; | 65 typedef SkRefCnt INHERITED; |
| 60 }; | 66 }; |
| 61 | 67 |
| 62 #endif // SkSVGNode_DEFINED | 68 #endif // SkSVGNode_DEFINED |
| OLD | NEW |