aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkPathHeap.h
blob: b8f3bd3abbbea31deff2191cc5ea24868ac8733a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#ifndef SkPathHeap_DEFINED
#define SkPathHeap_DEFINED

#include "SkRefCnt.h"
#include "SkChunkAlloc.h"
#include "SkTDArray.h"

class SkPath;
class SkFlattenableReadBuffer;
class SkFlattenableWriteBuffer;

class SkPathHeap : public SkRefCnt {
public:
            SkPathHeap();
            SkPathHeap(SkFlattenableReadBuffer&);
    virtual ~SkPathHeap();

    // called during picture-record
    int append(const SkPath&);
    
    // called during picture-playback
    int count() const { return fPaths.count(); }
    const SkPath& operator[](int index) const {
        return *fPaths[index];
    }
    
    void flatten(SkFlattenableWriteBuffer&) const;
        
private:
    // we store the paths in the heap (placement new)
    SkChunkAlloc        fHeap;
    // we just store ptrs into fHeap here
    SkTDArray<SkPath*>  fPaths;
};

#endif