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

Side by Side Diff: skia/sgl/SkPtrRecorder.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/sgl/SkProcSpriteBlitter.cpp ('k') | skia/sgl/SkRasterizer.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 "SkPtrRecorder.h"
2 #include "SkTSearch.h"
3
4 void SkPtrRecorder::reset() {
5 Pair* p = fList.begin();
6 Pair* stop = fList.end();
7 while (p < stop) {
8 this->decPtr(p->fPtr);
9 p += 1;
10 }
11 fList.reset();
12 }
13
14 int SkPtrRecorder::Cmp(const Pair& a, const Pair& b) {
15 return (char*)a.fPtr - (char*)b.fPtr;
16 }
17
18 uint32_t SkPtrRecorder::recordPtr(void* ptr) {
19 if (NULL == ptr) {
20 return 0;
21 }
22
23 int count = fList.count();
24 Pair pair;
25 pair.fPtr = ptr;
26
27 int index = SkTSearch<Pair>(fList.begin(), count, pair, sizeof(pair), &Cmp);
28 if (index < 0) {
29 index = ~index; // turn it back into an index for insertion
30 this->incPtr(ptr);
31 pair.fIndex = count + 1;
32 *fList.insert(index) = pair;
33 return count + 1;
34 } else {
35 return fList[index].fIndex;
36 }
37 }
38
39 void SkPtrRecorder::getPtrs(void* array[]) const {
40 int count = fList.count();
41 if (count > 0) {
42 SkASSERT(array);
43 const Pair* p = fList.begin();
44 // p->fIndex is base-1, so we need to subtract to find its slot
45 for (int i = 0; i < count; i++) {
46 int index = p[i].fIndex - 1;
47 SkASSERT((unsigned)index < (unsigned)count);
48 array[index] = p[i].fPtr;
49 }
50 }
51 }
52
53
OLDNEW
« no previous file with comments | « skia/sgl/SkProcSpriteBlitter.cpp ('k') | skia/sgl/SkRasterizer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698