Index: src/utils/SkBitSet.cpp |
diff --git a/src/utils/SkBitSet.cpp b/src/utils/SkBitSet.cpp |
index 36ff6cbb01c8afcb20ad2043e12b3a53ceca82c7..63d18ff2f3d4593e3c34d4fcf147e37d68eace10 100755 |
--- a/src/utils/SkBitSet.cpp |
+++ b/src/utils/SkBitSet.cpp |
@@ -14,8 +14,7 @@ SkBitSet::SkBitSet(int numberOfBits) |
SkASSERT(numberOfBits > 0); |
// Round up size to 32-bit boundary. |
fDwordCount = (numberOfBits + 31) / 32; |
- fBitData.set(malloc(fDwordCount * sizeof(uint32_t))); |
- clearAll(); |
+ fBitData.set(sk_calloc_throw(fDwordCount * sizeof(uint32_t))); |
} |
SkBitSet::SkBitSet(const SkBitSet& source) |
@@ -30,7 +29,7 @@ SkBitSet& SkBitSet::operator=(const SkBitSet& rhs) { |
fBitCount = rhs.fBitCount; |
fBitData.free(); |
fDwordCount = rhs.fDwordCount; |
- fBitData.set(malloc(fDwordCount * sizeof(uint32_t))); |
+ fBitData.set(sk_malloc_throw(fDwordCount * sizeof(uint32_t))); |
memcpy(fBitData.get(), rhs.fBitData.get(), fDwordCount * sizeof(uint32_t)); |
return *this; |
} |
@@ -56,25 +55,11 @@ void SkBitSet::clearAll() { |
} |
} |
-void SkBitSet::setBit(int index, bool value) { |
- uint32_t mask = 1 << (index % 32); |
- if (value) { |
- *(internalGet(index)) |= mask; |
- } else { |
- *(internalGet(index)) &= ~mask; |
- } |
-} |
- |
-bool SkBitSet::isBitSet(int index) const { |
- uint32_t mask = 1 << (index % 32); |
- return 0 != (*internalGet(index) & mask); |
-} |
- |
bool SkBitSet::orBits(const SkBitSet& source) { |
if (fBitCount != source.fBitCount) { |
return false; |
} |
- uint32_t* targetBitmap = internalGet(0); |
+ uint32_t* targetBitmap = this->internalGet(0); |
uint32_t* sourceBitmap = source.internalGet(0); |
for (size_t i = 0; i < fDwordCount; ++i) { |
targetBitmap[i] |= sourceBitmap[i]; |