aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-09-26 19:56:51 +0000
committerGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-09-26 19:56:51 +0000
commit939ca7ce860c5e80a4fdccc0dba5f7bfa29fef22 (patch)
tree58e1f8a0928368c9e97ef402f7c8a65dd69447f8 /src
parentbaed71fbfeee030184af74eb7e8622e99952bbf8 (diff)
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@11486 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src')
-rw-r--r--src/gpu/GrAllocPool.cpp6
-rwxr-xr-xsrc/gpu/GrAllocator.h8
-rw-r--r--src/gpu/GrAtlas.cpp4
-rw-r--r--src/gpu/GrGpu.cpp4
-rw-r--r--src/gpu/GrMemoryPool.cpp4
-rw-r--r--src/gpu/GrPlotMgr.h2
-rw-r--r--src/gpu/GrRectanizer.cpp2
-rw-r--r--src/gpu/GrRectanizer_fifo.cpp2
-rw-r--r--src/gpu/GrTHashCache.h8
9 files changed, 20 insertions, 20 deletions
diff --git a/src/gpu/GrAllocPool.cpp b/src/gpu/GrAllocPool.cpp
index 127511f164..d7b553176d 100644
--- a/src/gpu/GrAllocPool.cpp
+++ b/src/gpu/GrAllocPool.cpp
@@ -20,7 +20,7 @@ struct GrAllocPool::Block {
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 @@ void GrAllocPool::reset() {
Block* block = fBlock;
while (block) {
Block* next = block->fNext;
- GrFree(block);
+ sk_free(block);
block = next;
}
fBlock = NULL;
@@ -94,7 +94,7 @@ void GrAllocPool::release(size_t bytes) {
bytes = fBlock->release(bytes);
if (fBlock->empty()) {
Block* next = fBlock->fNext;
- GrFree(fBlock);
+ sk_free(fBlock);
fBlock = next;
SkDEBUGCODE(fBlocksAllocated -= 1;)
}
diff --git a/src/gpu/GrAllocator.h b/src/gpu/GrAllocator.h
index 57ca03cd32..23bb6b76c9 100755
--- a/src/gpu/GrAllocator.h
+++ b/src/gpu/GrAllocator.h
@@ -49,9 +49,9 @@ public:
// 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 @@ public:
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/src/gpu/GrAtlas.cpp b/src/gpu/GrAtlas.cpp
index 29f2a54ed7..b3340a02d9 100644
--- a/src/gpu/GrAtlas.cpp
+++ b/src/gpu/GrAtlas.cpp
@@ -125,7 +125,7 @@ bool GrAtlas::addSubImage(int width, int height, const void* image,
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 @@ bool GrAtlas::addSubImage(int width, int height, const void* image,
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/src/gpu/GrGpu.cpp b/src/gpu/GrGpu.cpp
index a4aa00eac1..910c57146b 100644
--- a/src/gpu/GrGpu.cpp
+++ b/src/gpu/GrGpu.cpp
@@ -276,14 +276,14 @@ const GrIndexBuffer* GrGpu::getQuadIndexBuffer() const {
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/src/gpu/GrMemoryPool.cpp b/src/gpu/GrMemoryPool.cpp
index 83b02bd9e5..deb7d1a814 100644
--- a/src/gpu/GrMemoryPool.cpp
+++ b/src/gpu/GrMemoryPool.cpp
@@ -104,7 +104,7 @@ void GrMemoryPool::release(void* p) {
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 @@ GrMemoryPool::BlockHeader* GrMemoryPool::CreateBlock(size_t size) {
}
void GrMemoryPool::DeleteBlock(BlockHeader* block) {
- GrFree(block);
+ sk_free(block);
}
void GrMemoryPool::validate() {
diff --git a/src/gpu/GrPlotMgr.h b/src/gpu/GrPlotMgr.h
index 3aa8cf6c8a..6ea6086b06 100644
--- a/src/gpu/GrPlotMgr.h
+++ b/src/gpu/GrPlotMgr.h
@@ -32,7 +32,7 @@ public:
}
void reset() {
- Gr_bzero(fBusy, fDim.fX * fDim.fY);
+ sk_bzero(fBusy, fDim.fX * fDim.fY);
}
bool newPlot(GrIPoint16* loc) {
diff --git a/src/gpu/GrRectanizer.cpp b/src/gpu/GrRectanizer.cpp
index 6f4b49e1ae..7b49530366 100644
--- a/src/gpu/GrRectanizer.cpp
+++ b/src/gpu/GrRectanizer.cpp
@@ -18,7 +18,7 @@ public:
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/src/gpu/GrRectanizer_fifo.cpp b/src/gpu/GrRectanizer_fifo.cpp
index 0c36f49bf6..9dd808618b 100644
--- a/src/gpu/GrRectanizer_fifo.cpp
+++ b/src/gpu/GrRectanizer_fifo.cpp
@@ -18,7 +18,7 @@ public:
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/src/gpu/GrTHashCache.h b/src/gpu/GrTHashCache.h
index c614b1dd7c..a9b4918b3d 100644
--- a/src/gpu/GrTHashCache.h
+++ b/src/gpu/GrTHashCache.h
@@ -34,7 +34,7 @@ public:
*/
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 @@ T* GrTHashTable<T, Key, kHashBits>::removeAt(int elemIndex, uint32_t hash) {
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