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

Side by Side Diff: src/core/SkPtrRecorder.cpp

Issue 1316233002: Style Change: NULL->nullptr (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 2015-08-27 (Thursday) 10:25:06 EDT Created 5 years, 3 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
« no previous file with comments | « src/core/SkPtrRecorder.h ('k') | src/core/SkRRect.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2011 Google Inc. 3 * Copyright 2011 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 #include "SkPtrRecorder.h" 8 #include "SkPtrRecorder.h"
9 #include "SkTSearch.h" 9 #include "SkTSearch.h"
10 10
11 void SkPtrSet::reset() { 11 void SkPtrSet::reset() {
12 Pair* p = fList.begin(); 12 Pair* p = fList.begin();
13 Pair* stop = fList.end(); 13 Pair* stop = fList.end();
14 while (p < stop) { 14 while (p < stop) {
15 this->decPtr(p->fPtr); 15 this->decPtr(p->fPtr);
16 p += 1; 16 p += 1;
17 } 17 }
18 fList.reset(); 18 fList.reset();
19 } 19 }
20 20
21 bool SkPtrSet::Less(const Pair& a, const Pair& b) { 21 bool SkPtrSet::Less(const Pair& a, const Pair& b) {
22 return (char*)a.fPtr < (char*)b.fPtr; 22 return (char*)a.fPtr < (char*)b.fPtr;
23 } 23 }
24 24
25 uint32_t SkPtrSet::find(void* ptr) const { 25 uint32_t SkPtrSet::find(void* ptr) const {
26 if (NULL == ptr) { 26 if (nullptr == ptr) {
27 return 0; 27 return 0;
28 } 28 }
29 29
30 int count = fList.count(); 30 int count = fList.count();
31 Pair pair; 31 Pair pair;
32 pair.fPtr = ptr; 32 pair.fPtr = ptr;
33 33
34 int index = SkTSearch<Pair, Less>(fList.begin(), count, pair, sizeof(pair)); 34 int index = SkTSearch<Pair, Less>(fList.begin(), count, pair, sizeof(pair));
35 if (index < 0) { 35 if (index < 0) {
36 return 0; 36 return 0;
37 } 37 }
38 return fList[index].fIndex; 38 return fList[index].fIndex;
39 } 39 }
40 40
41 uint32_t SkPtrSet::add(void* ptr) { 41 uint32_t SkPtrSet::add(void* ptr) {
42 if (NULL == ptr) { 42 if (nullptr == ptr) {
43 return 0; 43 return 0;
44 } 44 }
45 45
46 int count = fList.count(); 46 int count = fList.count();
47 Pair pair; 47 Pair pair;
48 pair.fPtr = ptr; 48 pair.fPtr = ptr;
49 49
50 int index = SkTSearch<Pair, Less>(fList.begin(), count, pair, sizeof(pair)); 50 int index = SkTSearch<Pair, Less>(fList.begin(), count, pair, sizeof(pair));
51 if (index < 0) { 51 if (index < 0) {
52 index = ~index; // turn it back into an index for insertion 52 index = ~index; // turn it back into an index for insertion
(...skipping 12 matching lines...) Expand all
65 SkASSERT(array); 65 SkASSERT(array);
66 const Pair* p = fList.begin(); 66 const Pair* p = fList.begin();
67 // p->fIndex is base-1, so we need to subtract to find its slot 67 // p->fIndex is base-1, so we need to subtract to find its slot
68 for (int i = 0; i < count; i++) { 68 for (int i = 0; i < count; i++) {
69 int index = p[i].fIndex - 1; 69 int index = p[i].fIndex - 1;
70 SkASSERT((unsigned)index < (unsigned)count); 70 SkASSERT((unsigned)index < (unsigned)count);
71 array[index] = p[i].fPtr; 71 array[index] = p[i].fPtr;
72 } 72 }
73 } 73 }
74 } 74 }
OLDNEW
« no previous file with comments | « src/core/SkPtrRecorder.h ('k') | src/core/SkRRect.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698