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

Side by Side Diff: src/utils/SkBitSet.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/utils/SkBase64.cpp ('k') | src/utils/SkBoundaryPatch.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 8
9 9
10 #include "SkBitSet.h" 10 #include "SkBitSet.h"
11 11
12 SkBitSet::SkBitSet(int numberOfBits) 12 SkBitSet::SkBitSet(int numberOfBits)
13 : fBitData(NULL), fDwordCount(0), fBitCount(numberOfBits) { 13 : fBitData(nullptr), fDwordCount(0), fBitCount(numberOfBits) {
14 SkASSERT(numberOfBits > 0); 14 SkASSERT(numberOfBits > 0);
15 // Round up size to 32-bit boundary. 15 // Round up size to 32-bit boundary.
16 fDwordCount = (numberOfBits + 31) / 32; 16 fDwordCount = (numberOfBits + 31) / 32;
17 fBitData.set(sk_calloc_throw(fDwordCount * sizeof(uint32_t))); 17 fBitData.set(sk_calloc_throw(fDwordCount * sizeof(uint32_t)));
18 } 18 }
19 19
20 SkBitSet::SkBitSet(const SkBitSet& source) 20 SkBitSet::SkBitSet(const SkBitSet& source)
21 : fBitData(NULL), fDwordCount(0), fBitCount(0) { 21 : fBitData(nullptr), fDwordCount(0), fBitCount(0) {
22 *this = source; 22 *this = source;
23 } 23 }
24 24
25 SkBitSet& SkBitSet::operator=(const SkBitSet& rhs) { 25 SkBitSet& SkBitSet::operator=(const SkBitSet& rhs) {
26 if (this == &rhs) { 26 if (this == &rhs) {
27 return *this; 27 return *this;
28 } 28 }
29 fBitCount = rhs.fBitCount; 29 fBitCount = rhs.fBitCount;
30 fBitData.free(); 30 fBitData.free();
31 fDwordCount = rhs.fDwordCount; 31 fDwordCount = rhs.fDwordCount;
32 fBitData.set(sk_malloc_throw(fDwordCount * sizeof(uint32_t))); 32 fBitData.set(sk_malloc_throw(fDwordCount * sizeof(uint32_t)));
33 memcpy(fBitData.get(), rhs.fBitData.get(), fDwordCount * sizeof(uint32_t)); 33 memcpy(fBitData.get(), rhs.fBitData.get(), fDwordCount * sizeof(uint32_t));
34 return *this; 34 return *this;
35 } 35 }
36 36
37 bool SkBitSet::operator==(const SkBitSet& rhs) { 37 bool SkBitSet::operator==(const SkBitSet& rhs) {
38 if (fBitCount == rhs.fBitCount) { 38 if (fBitCount == rhs.fBitCount) {
39 if (fBitData.get() != NULL) { 39 if (fBitData.get() != nullptr) {
40 return (memcmp(fBitData.get(), rhs.fBitData.get(), 40 return (memcmp(fBitData.get(), rhs.fBitData.get(),
41 fDwordCount * sizeof(uint32_t)) == 0); 41 fDwordCount * sizeof(uint32_t)) == 0);
42 } 42 }
43 return true; 43 return true;
44 } 44 }
45 return false; 45 return false;
46 } 46 }
47 47
48 bool SkBitSet::operator!=(const SkBitSet& rhs) { 48 bool SkBitSet::operator!=(const SkBitSet& rhs) {
49 return !(*this == rhs); 49 return !(*this == rhs);
50 } 50 }
51 51
52 void SkBitSet::clearAll() { 52 void SkBitSet::clearAll() {
53 if (fBitData.get() != NULL) { 53 if (fBitData.get() != nullptr) {
54 sk_bzero(fBitData.get(), fDwordCount * sizeof(uint32_t)); 54 sk_bzero(fBitData.get(), fDwordCount * sizeof(uint32_t));
55 } 55 }
56 } 56 }
57 57
58 bool SkBitSet::orBits(const SkBitSet& source) { 58 bool SkBitSet::orBits(const SkBitSet& source) {
59 if (fBitCount != source.fBitCount) { 59 if (fBitCount != source.fBitCount) {
60 return false; 60 return false;
61 } 61 }
62 uint32_t* targetBitmap = this->internalGet(0); 62 uint32_t* targetBitmap = this->internalGet(0);
63 uint32_t* sourceBitmap = source.internalGet(0); 63 uint32_t* sourceBitmap = source.internalGet(0);
64 for (size_t i = 0; i < fDwordCount; ++i) { 64 for (size_t i = 0; i < fDwordCount; ++i) {
65 targetBitmap[i] |= sourceBitmap[i]; 65 targetBitmap[i] |= sourceBitmap[i];
66 } 66 }
67 return true; 67 return true;
68 } 68 }
OLDNEW
« no previous file with comments | « src/utils/SkBase64.cpp ('k') | src/utils/SkBoundaryPatch.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698