• 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     // called during picture-record
19     int append(const SkPath&);
20 
21     // called during picture-playback
count()22     int count() const { return fPaths.count(); }
23     const SkPath& operator[](int index) const {
24         return *fPaths[index];
25     }
26 
27     void flatten(SkFlattenableWriteBuffer&) const;
28 
29 private:
30     // we store the paths in the heap (placement new)
31     SkChunkAlloc        fHeap;
32     // we just store ptrs into fHeap here
33     SkTDArray<SkPath*>  fPaths;
34 };
35 
36 #endif
37 
38