• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #ifndef SkPathHeap_DEFINED
2 #define SkPathHeap_DEFINED
3 
4 #include "SkRefCnt.h"
5 #include "SkChunkAlloc.h"
6 #include "SkTDArray.h"
7 
8 class SkPath;
9 class SkFlattenableReadBuffer;
10 class SkFlattenableWriteBuffer;
11 
12 class SkPathHeap : public SkRefCnt {
13 public:
14             SkPathHeap();
15             SkPathHeap(SkFlattenableReadBuffer&);
16     virtual ~SkPathHeap();
17 
18     /** Copy the path into the heap, and return the new total number of paths.
19         Thus, the returned value will be index+1, where index is the index of
20         this newly added (copied) path.
21      */
22     int append(const SkPath&);
23 
24     // called during picture-playback
count()25     int count() const { return fPaths.count(); }
26     const SkPath& operator[](int index) const {
27         return *fPaths[index];
28     }
29 
30     void flatten(SkFlattenableWriteBuffer&) const;
31 
32 private:
33     // we store the paths in the heap (placement new)
34     SkChunkAlloc        fHeap;
35     // we just store ptrs into fHeap here
36     SkTDArray<SkPath*>  fPaths;
37 };
38 
39 #endif
40 
41