move GrMalloc, GrFree, Gr_bzero to their sk equivalents
BUG=
R=bsalomon@google.com
Review URL: https://codereview.chromium.org/23566022
git-svn-id: http://skia.googlecode.com/svn/trunk/src@11486 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/gpu/GrAllocPool.cpp b/gpu/GrAllocPool.cpp
index 127511f..d7b5531 100644
--- a/gpu/GrAllocPool.cpp
+++ b/gpu/GrAllocPool.cpp
@@ -20,7 +20,7 @@
static Block* Create(size_t size, Block* next) {
SkASSERT(size >= GrAllocPool_MIN_BLOCK_SIZE);
- Block* block = (Block*)GrMalloc(sizeof(Block) + size);
+ Block* block = (Block*)sk_malloc_throw(sizeof(Block) + size);
block->fNext = next;
block->fPtr = (char*)block + sizeof(Block);
block->fBytesFree = size;
@@ -69,7 +69,7 @@
Block* block = fBlock;
while (block) {
Block* next = block->fNext;
- GrFree(block);
+ sk_free(block);
block = next;
}
fBlock = NULL;
@@ -94,7 +94,7 @@
bytes = fBlock->release(bytes);
if (fBlock->empty()) {
Block* next = fBlock->fNext;
- GrFree(fBlock);
+ sk_free(fBlock);
fBlock = next;
SkDEBUGCODE(fBlocksAllocated -= 1;)
}
diff --git a/gpu/GrAllocator.h b/gpu/GrAllocator.h
index 57ca03c..23bb6b7 100755
--- a/gpu/GrAllocator.h
+++ b/gpu/GrAllocator.h
@@ -49,9 +49,9 @@
// we always have at least one block
if (0 == indexInBlock) {
if (0 != fCount) {
- fBlocks.push_back() = GrMalloc(fBlockSize);
+ fBlocks.push_back() = sk_malloc_throw(fBlockSize);
} else if (fOwnFirstBlock) {
- fBlocks[0] = GrMalloc(fBlockSize);
+ fBlocks[0] = sk_malloc_throw(fBlockSize);
}
}
void* ret = (char*)fBlocks[fCount/fItemsPerBlock] +
@@ -67,10 +67,10 @@
int blockCount = GrMax((unsigned)1,
GrUIDivRoundUp(fCount, fItemsPerBlock));
for (int i = 1; i < blockCount; ++i) {
- GrFree(fBlocks[i]);
+ sk_free(fBlocks[i]);
}
if (fOwnFirstBlock) {
- GrFree(fBlocks[0]);
+ sk_free(fBlocks[0]);
fBlocks[0] = NULL;
}
fBlocks.pop_back_n(blockCount-1);
diff --git a/gpu/GrAtlas.cpp b/gpu/GrAtlas.cpp
index 29f2a54..b3340a0 100644
--- a/gpu/GrAtlas.cpp
+++ b/gpu/GrAtlas.cpp
@@ -125,7 +125,7 @@
if (BORDER) {
const size_t dstRB = dstW * fBytesPerPixel;
uint8_t* dst = (uint8_t*)storage.reset(dstH * dstRB);
- Gr_bzero(dst, dstRB); // zero top row
+ sk_bzero(dst, dstRB); // zero top row
dst += dstRB;
for (int y = 0; y < height; y++) {
dst = zerofill(dst, fBytesPerPixel); // zero left edge
@@ -134,7 +134,7 @@
dst = zerofill(dst, fBytesPerPixel); // zero right edge
image = (const void*)((const char*)image + width * fBytesPerPixel);
}
- Gr_bzero(dst, dstRB); // zero bottom row
+ sk_bzero(dst, dstRB); // zero bottom row
image = storage.get();
}
adjustForPlot(loc, fPlot);
diff --git a/gpu/GrGpu.cpp b/gpu/GrGpu.cpp
index a4aa00e..910c571 100644
--- a/gpu/GrGpu.cpp
+++ b/gpu/GrGpu.cpp
@@ -276,14 +276,14 @@
fill_indices(indices, MAX_QUADS);
fQuadIndexBuffer->unlock();
} else {
- indices = (uint16_t*)GrMalloc(SIZE);
+ indices = (uint16_t*)sk_malloc_throw(SIZE);
fill_indices(indices, MAX_QUADS);
if (!fQuadIndexBuffer->updateData(indices, SIZE)) {
fQuadIndexBuffer->unref();
fQuadIndexBuffer = NULL;
GrCrash("Can't get indices into buffer!");
}
- GrFree(indices);
+ sk_free(indices);
}
}
}
diff --git a/gpu/GrMemoryPool.cpp b/gpu/GrMemoryPool.cpp
index 83b02bd..deb7d1a 100644
--- a/gpu/GrMemoryPool.cpp
+++ b/gpu/GrMemoryPool.cpp
@@ -104,7 +104,7 @@
GrMemoryPool::BlockHeader* GrMemoryPool::CreateBlock(size_t size) {
BlockHeader* block =
- reinterpret_cast<BlockHeader*>(GrMalloc(size + kHeaderSize));
+ reinterpret_cast<BlockHeader*>(sk_malloc_throw(size + kHeaderSize));
// we assume malloc gives us aligned memory
SkASSERT(!(reinterpret_cast<intptr_t>(block) % kAlignment));
block->fLiveCount = 0;
@@ -115,7 +115,7 @@
}
void GrMemoryPool::DeleteBlock(BlockHeader* block) {
- GrFree(block);
+ sk_free(block);
}
void GrMemoryPool::validate() {
diff --git a/gpu/GrPlotMgr.h b/gpu/GrPlotMgr.h
index 3aa8cf6..6ea6086 100644
--- a/gpu/GrPlotMgr.h
+++ b/gpu/GrPlotMgr.h
@@ -32,7 +32,7 @@
}
void reset() {
- Gr_bzero(fBusy, fDim.fX * fDim.fY);
+ sk_bzero(fBusy, fDim.fX * fDim.fY);
}
bool newPlot(GrIPoint16* loc) {
diff --git a/gpu/GrRectanizer.cpp b/gpu/GrRectanizer.cpp
index 6f4b49e..7b49530 100644
--- a/gpu/GrRectanizer.cpp
+++ b/gpu/GrRectanizer.cpp
@@ -18,7 +18,7 @@
GrRectanizerPow2(int w, int h) : GrRectanizer(w, h) {
fNextStripY = 0;
fAreaSoFar = 0;
- Gr_bzero(fRows, sizeof(fRows));
+ sk_bzero(fRows, sizeof(fRows));
}
virtual ~GrRectanizerPow2() {
diff --git a/gpu/GrRectanizer_fifo.cpp b/gpu/GrRectanizer_fifo.cpp
index 0c36f49..9dd8086 100644
--- a/gpu/GrRectanizer_fifo.cpp
+++ b/gpu/GrRectanizer_fifo.cpp
@@ -18,7 +18,7 @@
GrRectanizerFIFO(int w, int h) : GrRectanizer(w, h) {
fNextStripY = 0;
fAreaSoFar = 0;
- Gr_bzero(fRows, sizeof(fRows));
+ sk_bzero(fRows, sizeof(fRows));
}
virtual ~GrRectanizerFIFO() {
diff --git a/gpu/GrTHashCache.h b/gpu/GrTHashCache.h
index c614b1d..a9b4918 100644
--- a/gpu/GrTHashCache.h
+++ b/gpu/GrTHashCache.h
@@ -34,7 +34,7 @@
*/
template <typename T, typename Key, size_t kHashBits> class GrTHashTable {
public:
- GrTHashTable() { Gr_bzero(fHash, sizeof(fHash)); }
+ GrTHashTable() { sk_bzero(fHash, sizeof(fHash)); }
~GrTHashTable() {}
int count() const { return fSorted.count(); }
@@ -210,19 +210,19 @@
template <typename T, typename Key, size_t kHashBits>
void GrTHashTable<T, Key, kHashBits>::removeAll() {
fSorted.reset();
- Gr_bzero(fHash, sizeof(fHash));
+ sk_bzero(fHash, sizeof(fHash));
}
template <typename T, typename Key, size_t kHashBits>
void GrTHashTable<T, Key, kHashBits>::deleteAll() {
fSorted.deleteAll();
- Gr_bzero(fHash, sizeof(fHash));
+ sk_bzero(fHash, sizeof(fHash));
}
template <typename T, typename Key, size_t kHashBits>
void GrTHashTable<T, Key, kHashBits>::unrefAll() {
fSorted.unrefAll();
- Gr_bzero(fHash, sizeof(fHash));
+ sk_bzero(fHash, sizeof(fHash));
}
#ifdef SK_DEBUG