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 by | |
44 // returning false. | |
robertphillips
2016/08/08 13:55:28
// Returning false does what now?
f(malita)
2016/08/08 17:13:29
Added more comments.
| |
45 virtual bool onPrepareToRender(SkSVGRenderContext*) const; | |
46 | |
47 virtual void onRender(const SkSVGRenderContext&) const = 0; | |
42 | 48 |
43 virtual void onSetAttribute(SkSVGAttribute, const SkSVGValue&); | 49 virtual void onSetAttribute(SkSVGAttribute, const SkSVGValue&); |
44 | 50 |
45 virtual const SkMatrix& onLocalMatrix() const; | |
46 | |
47 private: | 51 private: |
48 SkSVGTag fTag; | 52 SkSVGTag fTag; |
49 | 53 |
50 // FIXME: this should be sparse | 54 // FIXME: this should be sparse |
51 SkSVGPresentationAttributes fPresentationAttributes; | 55 SkSVGPresentationAttributes fPresentationAttributes; |
52 | 56 |
53 typedef SkRefCnt INHERITED; | 57 typedef SkRefCnt INHERITED; |
54 }; | 58 }; |
55 | 59 |
56 #endif // SkSVGNode_DEFINED | 60 #endif // SkSVGNode_DEFINED |
OLD | NEW |