aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu
diff options
context:
space:
mode:
authorGravatar mtklein <mtklein@chromium.org>2015-08-26 05:43:22 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2015-08-26 05:43:22 -0700
commit002c2ce66be69d41632c9603ce62c50f04156518 (patch)
treeb0f63a5bfa81f739cd183805b657229189884b96 /src/gpu
parent24243446cdf7b7e4e132c2a0c387c7723777e0c7 (diff)
stray malloc/free -> sk_malloc/sk_free
BUG=skia: TBR=bungeman@google.com Review URL: https://codereview.chromium.org/1315123002
Diffstat (limited to 'src/gpu')
-rw-r--r--src/gpu/GrAALinearizingConvexPathRenderer.cpp30
1 files changed, 15 insertions, 15 deletions
diff --git a/src/gpu/GrAALinearizingConvexPathRenderer.cpp b/src/gpu/GrAALinearizingConvexPathRenderer.cpp
index 899c6b1ef1..db9e91c935 100644
--- a/src/gpu/GrAALinearizingConvexPathRenderer.cpp
+++ b/src/gpu/GrAALinearizingConvexPathRenderer.cpp
@@ -54,7 +54,7 @@ bool GrAALinearizingConvexPathRenderer::onCanDrawPath(const CanDrawPathArgs& arg
return false;
}
SkScalar strokeWidth = args.fViewMatrix->getMaxScale() * args.fStroke->getWidth();
- return strokeWidth >= 1.0f && strokeWidth <= kMaxStrokeWidth && !args.fStroke->isDashed() &&
+ return strokeWidth >= 1.0f && strokeWidth <= kMaxStrokeWidth && !args.fStroke->isDashed() &&
SkPathPriv::LastVerbIsClose(*args.fPath) &&
args.fStroke->getJoin() != SkPaint::Join::kRound_Join;
}
@@ -85,7 +85,7 @@ static void extract_verts(const GrAAConvexTessellator& tess,
*reinterpret_cast<GrColor*>(verts + i * vertexStride) = scaledColor;
} else {
*reinterpret_cast<GrColor*>(verts + i * vertexStride) = color;
- *reinterpret_cast<float*>(verts + i * vertexStride + sizeof(GrColor)) =
+ *reinterpret_cast<float*>(verts + i * vertexStride + sizeof(GrColor)) =
tess.coverage(i);
}
}
@@ -159,7 +159,7 @@ private:
fBatch.fCanTweakAlphaForCoverage = opt.canTweakAlphaForCoverage();
}
- void draw(GrVertexBatch::Target* target, const GrPipeline* pipeline, int vertexCount,
+ void draw(GrVertexBatch::Target* target, const GrPipeline* pipeline, int vertexCount,
size_t vertexStride, void* vertices, int indexCount, uint16_t* indices) {
if (vertexCount == 0 || indexCount == 0) {
return;
@@ -167,7 +167,7 @@ private:
const GrVertexBuffer* vertexBuffer;
GrVertices info;
int firstVertex;
- void* verts = target->makeVertexSpace(vertexStride, vertexCount, &vertexBuffer,
+ void* verts = target->makeVertexSpace(vertexStride, vertexCount, &vertexBuffer,
&firstVertex);
if (!verts) {
SkDebugf("Could not allocate vertices\n");
@@ -183,11 +183,11 @@ private:
return;
}
memcpy(idxs, indices, indexCount * sizeof(uint16_t));
- info.initIndexed(kTriangles_GrPrimitiveType, vertexBuffer, indexBuffer, firstVertex,
+ info.initIndexed(kTriangles_GrPrimitiveType, vertexBuffer, indexBuffer, firstVertex,
firstIndex, vertexCount, indexCount);
target->draw(info);
}
-
+
void onPrepareDraws(Target* target) override {
bool canTweakAlphaForCoverage = this->canTweakAlphaForCoverage();
@@ -215,8 +215,8 @@ private:
int indexCount = 0;
int maxVertices = DEFAULT_BUFFER_SIZE;
int maxIndices = DEFAULT_BUFFER_SIZE;
- uint8_t* vertices = (uint8_t*) malloc(maxVertices * vertexStride);
- uint16_t* indices = (uint16_t*) malloc(maxIndices * sizeof(uint16_t));
+ uint8_t* vertices = (uint8_t*) sk_malloc_throw(maxVertices * vertexStride);
+ uint16_t* indices = (uint16_t*) sk_malloc_throw(maxIndices * sizeof(uint16_t));
for (int i = 0; i < instanceCount; i++) {
Geometry& args = fGeoData[i];
GrAAConvexTessellator tess(args.fStrokeWidth, args.fJoin, args.fMiterLimit);
@@ -228,9 +228,9 @@ private:
int currentIndices = tess.numIndices();
SkASSERT(currentIndices <= UINT16_MAX);
if (indexCount + currentIndices > UINT16_MAX) {
- // if we added the current instance, we would overflow the indices we can store in a
+ // if we added the current instance, we would overflow the indices we can store in a
// uint16_t. Draw what we've got so far and reset.
- draw(target, this->pipeline(), vertexCount, vertexStride, vertices, indexCount,
+ draw(target, this->pipeline(), vertexCount, vertexStride, vertices, indexCount,
indices);
vertexCount = 0;
indexCount = 0;
@@ -238,22 +238,22 @@ private:
int currentVertices = tess.numPts();
if (vertexCount + currentVertices > maxVertices) {
maxVertices = SkTMax(vertexCount + currentVertices, maxVertices * 2);
- vertices = (uint8_t*) realloc(vertices, maxVertices * vertexStride);
+ vertices = (uint8_t*) sk_realloc_throw(vertices, maxVertices * vertexStride);
}
if (indexCount + currentIndices > maxIndices) {
maxIndices = SkTMax(indexCount + currentIndices, maxIndices * 2);
- indices = (uint16_t*) realloc(indices, maxIndices * sizeof(uint16_t));
+ indices = (uint16_t*) sk_realloc_throw(indices, maxIndices * sizeof(uint16_t));
}
- extract_verts(tess, vertices + vertexStride * vertexCount, vertexStride, args.fColor,
+ extract_verts(tess, vertices + vertexStride * vertexCount, vertexStride, args.fColor,
vertexCount, indices + indexCount, canTweakAlphaForCoverage);
vertexCount += currentVertices;
indexCount += currentIndices;
}
draw(target, this->pipeline(), vertexCount, vertexStride, vertices, indexCount,
indices);
- free(vertices);
- free(indices);
+ sk_free(vertices);
+ sk_free(indices);
}
SkSTArray<1, Geometry, true>* geoData() { return &fGeoData; }