Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(503)

Side by Side Diff: skia/picture/SkPathHeap.cpp

Issue 113827: Remove the remainder of the skia source code from the Chromium repo.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « skia/picture/SkPathHeap.h ('k') | skia/picture/SkPicture.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 #include "SkPathHeap.h"
2 #include "SkPath.h"
3 #include "SkStream.h"
4 #include "SkFlattenable.h"
5 #include <new>
6
7 #define kPathCount 64
8
9 SkPathHeap::SkPathHeap() : fHeap(kPathCount * sizeof(SkPath)) {
10 }
11
12 SkPathHeap::SkPathHeap(SkFlattenableReadBuffer& buffer)
13 : fHeap(kPathCount * sizeof(SkPath)) {
14 int count = buffer.readS32();
15
16 fPaths.setCount(count);
17 SkPath** ptr = fPaths.begin();
18 SkPath* p = (SkPath*)fHeap.allocThrow(count * sizeof(SkPath));
19
20 for (int i = 0; i < count; i++) {
21 new (p) SkPath;
22 p->unflatten(buffer);
23 *ptr++ = p; // record the pointer
24 p++; // move to the next storage location
25 }
26 }
27
28 SkPathHeap::~SkPathHeap() {
29 SkPath** iter = fPaths.begin();
30 SkPath** stop = fPaths.end();
31 while (iter < stop) {
32 (*iter)->~SkPath();
33 iter++;
34 }
35 }
36
37 int SkPathHeap::append(const SkPath& path) {
38 SkPath* p = (SkPath*)fHeap.allocThrow(sizeof(SkPath));
39 new (p) SkPath(path);
40 *fPaths.append() = p;
41 return fPaths.count();
42 }
43
44 void SkPathHeap::flatten(SkFlattenableWriteBuffer& buffer) const {
45 int count = fPaths.count();
46
47 buffer.write32(count);
48 SkPath** iter = fPaths.begin();
49 SkPath** stop = fPaths.end();
50 while (iter < stop) {
51 (*iter)->flatten(buffer);
52 iter++;
53 }
54 }
55
OLDNEW
« no previous file with comments | « skia/picture/SkPathHeap.h ('k') | skia/picture/SkPicture.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698