OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 #ifndef SkPathHeap_DEFINED | 8 #ifndef SkPathHeap_DEFINED |
9 #define SkPathHeap_DEFINED | 9 #define SkPathHeap_DEFINED |
10 | 10 |
11 #include "SkRefCnt.h" | 11 #include "SkRefCnt.h" |
12 #include "SkChunkAlloc.h" | 12 #include "SkChunkAlloc.h" |
13 #include "SkTDArray.h" | 13 #include "SkTDArray.h" |
14 | 14 |
15 class SkPath; | 15 class SkPath; |
16 class SkFlattenableReadBuffer; | 16 class SkReadBuffer; |
17 class SkFlattenableWriteBuffer; | 17 class SkWriteBuffer; |
18 | 18 |
19 class SkPathHeap : public SkRefCnt { | 19 class SkPathHeap : public SkRefCnt { |
20 public: | 20 public: |
21 SK_DECLARE_INST_COUNT(SkPathHeap) | 21 SK_DECLARE_INST_COUNT(SkPathHeap) |
22 | 22 |
23 SkPathHeap(); | 23 SkPathHeap(); |
24 SkPathHeap(SkFlattenableReadBuffer&); | 24 SkPathHeap(SkReadBuffer&); |
25 virtual ~SkPathHeap(); | 25 virtual ~SkPathHeap(); |
26 | 26 |
27 /** Copy the path into the heap, and return the new total number of paths. | 27 /** Copy the path into the heap, and return the new total number of paths. |
28 Thus, the returned value will be index+1, where index is the index of | 28 Thus, the returned value will be index+1, where index is the index of |
29 this newly added (copied) path. | 29 this newly added (copied) path. |
30 */ | 30 */ |
31 int append(const SkPath&); | 31 int append(const SkPath&); |
32 | 32 |
33 // called during picture-playback | 33 // called during picture-playback |
34 int count() const { return fPaths.count(); } | 34 int count() const { return fPaths.count(); } |
35 const SkPath& operator[](int index) const { | 35 const SkPath& operator[](int index) const { |
36 return *fPaths[index]; | 36 return *fPaths[index]; |
37 } | 37 } |
38 | 38 |
39 void flatten(SkFlattenableWriteBuffer&) const; | 39 void flatten(SkWriteBuffer&) const; |
40 | 40 |
41 private: | 41 private: |
42 // we store the paths in the heap (placement new) | 42 // we store the paths in the heap (placement new) |
43 SkChunkAlloc fHeap; | 43 SkChunkAlloc fHeap; |
44 // we just store ptrs into fHeap here | 44 // we just store ptrs into fHeap here |
45 SkTDArray<SkPath*> fPaths; | 45 SkTDArray<SkPath*> fPaths; |
46 | 46 |
47 typedef SkRefCnt INHERITED; | 47 typedef SkRefCnt INHERITED; |
48 }; | 48 }; |
49 | 49 |
50 #endif | 50 #endif |
OLD | NEW |