blob: e3b0f7a84fc281f056010b04a5aba5f779c0bda8 (
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
38
39
40
41
42
43
44
45
46
47
48
49
50
|
/*
* Copyright 2011 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#ifndef SkPathHeap_DEFINED
#define SkPathHeap_DEFINED
#include "SkRefCnt.h"
#include "SkChunkAlloc.h"
#include "SkTDArray.h"
class SkPath;
class SkReadBuffer;
class SkWriteBuffer;
class SkPathHeap : public SkRefCnt {
public:
SK_DECLARE_INST_COUNT(SkPathHeap)
SkPathHeap();
SkPathHeap(SkReadBuffer&);
virtual ~SkPathHeap();
/** Copy the path into the heap, and return the new total number of paths.
Thus, the returned value will be index+1, where index is the index of
this newly added (copied) path.
*/
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(SkWriteBuffer&) const;
private:
// we store the paths in the heap (placement new)
SkChunkAlloc fHeap;
// we just store ptrs into fHeap here
SkTDArray<SkPath*> fPaths;
typedef SkRefCnt INHERITED;
};
#endif
|