Rename existing nonpreserving reallocs to reset, add reset to SkAutoMalloc, use reset in GrBufferAllocPool
Review URL: http://codereview.appspot.com/4951058/
git-svn-id: http://skia.googlecode.com/svn/trunk@2215 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/gpu/src/GrAtlas.cpp b/gpu/src/GrAtlas.cpp
index 285ded4..0838895 100644
--- a/gpu/src/GrAtlas.cpp
+++ b/gpu/src/GrAtlas.cpp
@@ -95,7 +95,7 @@
if (BORDER) {
const int bpp = GrMaskFormatBytesPerPixel(fMaskFormat);
const size_t dstRB = dstW * bpp;
- uint8_t* dst = (uint8_t*)storage.realloc(dstH * dstRB);
+ uint8_t* dst = (uint8_t*)storage.reset(dstH * dstRB);
Gr_bzero(dst, dstRB); // zero top row
dst += dstRB;
for (int y = 0; y < height; y++) {
diff --git a/gpu/src/GrBufferAllocPool.cpp b/gpu/src/GrBufferAllocPool.cpp
index 5b49350..667e437 100644
--- a/gpu/src/GrBufferAllocPool.cpp
+++ b/gpu/src/GrBufferAllocPool.cpp
@@ -91,7 +91,7 @@
fFirstPreallocBuffer = (fFirstPreallocBuffer + fPreallocBuffersInUse) %
fPreallocBuffers.count();
}
- fCpuData.alloc(fGpu->supportsBufferLocking() ? 0 : fMinBlockSize);
+ fCpuData.reset(fGpu->supportsBufferLocking() ? 0 : fMinBlockSize);
GrAssert(0 == fPreallocBuffersInUse);
VALIDATE();
}
@@ -283,7 +283,7 @@
}
if (NULL == fBufferPtr) {
- fBufferPtr = fCpuData.alloc(size);
+ fBufferPtr = fCpuData.reset(size);
}
VALIDATE(true);
diff --git a/gpu/src/GrDefaultPathRenderer.cpp b/gpu/src/GrDefaultPathRenderer.cpp
index 79d6e25..b70b863 100644
--- a/gpu/src/GrDefaultPathRenderer.cpp
+++ b/gpu/src/GrDefaultPathRenderer.cpp
@@ -193,7 +193,7 @@
}
void GrDefaultPathRenderer::pathWillClear() {
- fSubpathVertCount.realloc(0);
+ fSubpathVertCount.reset(0);
fTarget->resetVertexSource();
if (fUseIndexedDraw) {
fTarget->resetIndexSource();
@@ -278,7 +278,7 @@
idx = idxBase;
}
- fSubpathVertCount.realloc(fSubpathCount);
+ fSubpathVertCount.reset(fSubpathCount);
GrPoint pts[4];
diff --git a/gpu/src/GrGLTexture.cpp b/gpu/src/GrGLTexture.cpp
index be7a0f1..e302694 100644
--- a/gpu/src/GrGLTexture.cpp
+++ b/gpu/src/GrGLTexture.cpp
@@ -151,7 +151,7 @@
if (flipY) {
src += (height - 1) * rowBytes;
}
- char* dst = (char*)tempStorage.realloc(trimSize);
+ char* dst = (char*)tempStorage.reset(trimSize);
for (int y = 0; y < height; y++) {
memcpy(dst, src, trimRowBytes);
if (flipY) {
diff --git a/gpu/src/GrGpuGL.cpp b/gpu/src/GrGpuGL.cpp
index c3b5f97..92d836d 100644
--- a/gpu/src/GrGpuGL.cpp
+++ b/gpu/src/GrGpuGL.cpp
@@ -788,7 +788,7 @@
if (flipY) {
src += (desc.fContentHeight - 1) * rowBytes;
}
- char* dst = (char*)tempStorage.realloc(trimSize);
+ char* dst = (char*)tempStorage.reset(trimSize);
for (int y = 0; y < desc.fContentHeight; y++) {
memcpy(dst, src, trimRowBytes);
if (flipY) {