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