diff options
-rw-r--r-- | gm/beziereffects.cpp | 10 | ||||
-rw-r--r-- | gm/convexpolyeffect.cpp | 5 | ||||
-rw-r--r-- | src/gpu/GrAAConvexPathRenderer.cpp | 10 | ||||
-rw-r--r-- | src/gpu/GrAAHairLinePathRenderer.cpp | 15 | ||||
-rw-r--r-- | src/gpu/GrAARectRenderer.cpp | 19 | ||||
-rwxr-xr-x | src/gpu/GrContext.cpp | 15 | ||||
-rw-r--r-- | src/gpu/GrDefaultPathRenderer.cpp | 10 | ||||
-rw-r--r-- | src/gpu/GrInOrderDrawBuffer.cpp | 5 | ||||
-rw-r--r-- | src/gpu/GrOvalRenderer.cpp | 25 | ||||
-rw-r--r-- | src/gpu/GrTessellatingPathRenderer.cpp | 6 | ||||
-rw-r--r-- | src/gpu/effects/GrDashingEffect.cpp | 5 |
11 files changed, 123 insertions, 2 deletions
diff --git a/gm/beziereffects.cpp b/gm/beziereffects.cpp index 45c6341848..d86a8b8163 100644 --- a/gm/beziereffects.cpp +++ b/gm/beziereffects.cpp @@ -76,6 +76,11 @@ private: &vertexBuffer, &firstVertex); + if (!vertices || !batchTarget->quadIndexBuffer()) { + SkDebugf("Could not allocate buffers\n"); + return; + } + SkASSERT(vertexStride == sizeof(Vertex)); Vertex* verts = reinterpret_cast<Vertex*>(vertices); @@ -478,6 +483,11 @@ private: &vertexBuffer, &firstVertex); + if (!vertices || !batchTarget->quadIndexBuffer()) { + SkDebugf("Could not allocate buffers\n"); + return; + } + SkASSERT(vertexStride == sizeof(Vertex)); Vertex* verts = reinterpret_cast<Vertex*>(vertices); diff --git a/gm/convexpolyeffect.cpp b/gm/convexpolyeffect.cpp index 0a3be28c73..f3335c94e5 100644 --- a/gm/convexpolyeffect.cpp +++ b/gm/convexpolyeffect.cpp @@ -62,6 +62,11 @@ private: &vertexBuffer, &firstVertex); + if (!vertices || !batchTarget->quadIndexBuffer()) { + SkDebugf("Could not allocate buffers\n"); + return; + } + SkASSERT(vertexStride == sizeof(SkPoint)); SkPoint* verts = reinterpret_cast<SkPoint*>(vertices); diff --git a/src/gpu/GrAAConvexPathRenderer.cpp b/src/gpu/GrAAConvexPathRenderer.cpp index 3ab8af5c37..317f9a0f8d 100644 --- a/src/gpu/GrAAConvexPathRenderer.cpp +++ b/src/gpu/GrAAConvexPathRenderer.cpp @@ -784,6 +784,11 @@ public: &vertexBuffer, &firstVertex); + if (!vertices) { + SkDebugf("Could not allocate vertices\n"); + return; + } + const GrIndexBuffer* indexBuffer; int firstIndex; @@ -791,6 +796,11 @@ public: &indexBuffer, &firstIndex); + if (!indices) { + SkDebugf("Could not allocate indices\n"); + return; + } + QuadVertex* verts = reinterpret_cast<QuadVertex*>(vertices); uint16_t* idxs = reinterpret_cast<uint16_t*>(indices); diff --git a/src/gpu/GrAAHairLinePathRenderer.cpp b/src/gpu/GrAAHairLinePathRenderer.cpp index 57c3b5a2c3..26cf607021 100644 --- a/src/gpu/GrAAHairLinePathRenderer.cpp +++ b/src/gpu/GrAAHairLinePathRenderer.cpp @@ -895,6 +895,11 @@ void AAHairlineBatch::generateGeometry(GrBatchTarget* batchTarget, const GrPipel &vertexBuffer, &firstVertex); + if (!vertices) { + SkDebugf("Could not allocate vertices\n"); + return; + } + SkASSERT(lineGP->getVertexStride() == sizeof(LineVertex)); LineVertex* verts = reinterpret_cast<LineVertex*>(vertices); @@ -934,6 +939,11 @@ void AAHairlineBatch::generateGeometry(GrBatchTarget* batchTarget, const GrPipel &vertexBuffer, &firstVertex); + if (!vertices) { + SkDebugf("Could not allocate vertices\n"); + return; + } + // Setup vertices BezierVertex* verts = reinterpret_cast<BezierVertex*>(vertices); @@ -1021,6 +1031,11 @@ bool GrAAHairLinePathRenderer::onDrawPath(GrDrawTarget* target, const SkPath& path, const SkStrokeRec& stroke, bool) { + if (!fLinesIndexBuffer || !fQuadsIndexBuffer) { + SkDebugf("unable to allocate indices\n"); + return false; + } + SkScalar hairlineCoverage; uint8_t newCoverage = 0xff; if (IsStrokeHairlineOrEquivalent(stroke, viewMatrix, &hairlineCoverage)) { diff --git a/src/gpu/GrAARectRenderer.cpp b/src/gpu/GrAARectRenderer.cpp index 7c34c25abd..6affc927ac 100644 --- a/src/gpu/GrAARectRenderer.cpp +++ b/src/gpu/GrAARectRenderer.cpp @@ -134,6 +134,11 @@ public: &vertexBuffer, &firstVertex); + if (!vertices) { + SkDebugf("Could not allocate vertices\n"); + return; + } + for (int i = 0; i < instanceCount; i++) { const Geometry& args = fGeoData[i]; this->generateAAFillRectGeometry(vertices, @@ -445,13 +450,18 @@ void GrAARectRenderer::geometryFillAARect(GrDrawTarget* target, const SkMatrix& viewMatrix, const SkRect& rect, const SkRect& devRect) { - if (NULL == fAAFillRectIndexBuffer) { + if (!fAAFillRectIndexBuffer) { fAAFillRectIndexBuffer = fGpu->createInstancedIndexBuffer(gFillAARectIdx, kIndicesPerAAFillRect, kNumAAFillRectsInIndexBuffer, kVertsPerAAFillRect); } + if (!fAAFillRectIndexBuffer) { + SkDebugf("Unable to create index buffer\n"); + return; + } + AAFillRectBatch::Geometry geometry; geometry.fRect = rect; geometry.fViewMatrix = viewMatrix; @@ -623,6 +633,11 @@ public: &vertexBuffer, &firstVertex); + if (!vertices) { + SkDebugf("Could not allocate vertices\n"); + return; + } + for (int i = 0; i < instanceCount; i++) { const Geometry& args = fGeoData[i]; this->generateAAStrokeRectGeometry(vertices, @@ -846,7 +861,7 @@ void GrAARectRenderer::geometryStrokeAARect(GrDrawTarget* target, const SkRect& devInside, bool miterStroke) { GrIndexBuffer* indexBuffer = this->aaStrokeRectIndexBuffer(miterStroke); - if (NULL == indexBuffer) { + if (!indexBuffer) { SkDebugf("Failed to create index buffer!\n"); return; } diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp index ac44644de8..78f29e73bc 100755 --- a/src/gpu/GrContext.cpp +++ b/src/gpu/GrContext.cpp @@ -567,6 +567,11 @@ public: &vertexBuffer, &firstVertex); + if (!vertices) { + SkDebugf("Could not allocate vertices\n"); + return; + } + SkPoint* vertex = reinterpret_cast<SkPoint*>(vertices); GrPrimitiveType primType; @@ -900,6 +905,11 @@ public: &vertexBuffer, &firstVertex); + if (!vertices) { + SkDebugf("Could not allocate vertices\n"); + return; + } + const GrIndexBuffer* indexBuffer; int firstIndex; @@ -908,6 +918,11 @@ public: indices = batchTarget->indexPool()->makeSpace(this->indexCount(), &indexBuffer, &firstIndex); + + if (!indices) { + SkDebugf("Could not allocate indices\n"); + return; + } } int indexOffset = 0; diff --git a/src/gpu/GrDefaultPathRenderer.cpp b/src/gpu/GrDefaultPathRenderer.cpp index 302aad7795..9619e2ad44 100644 --- a/src/gpu/GrDefaultPathRenderer.cpp +++ b/src/gpu/GrDefaultPathRenderer.cpp @@ -323,6 +323,11 @@ public: &vertexBuffer, &firstVertex); + if (!vertices) { + SkDebugf("Could not allocate vertices\n"); + return; + } + const GrIndexBuffer* indexBuffer; int firstIndex; @@ -331,6 +336,11 @@ public: indices = batchTarget->indexPool()->makeSpace(maxIndices, &indexBuffer, &firstIndex); + + if (!indices) { + SkDebugf("Could not allocate indices\n"); + return; + } } // fill buffers diff --git a/src/gpu/GrInOrderDrawBuffer.cpp b/src/gpu/GrInOrderDrawBuffer.cpp index 2584635802..4d8fa5e1d9 100644 --- a/src/gpu/GrInOrderDrawBuffer.cpp +++ b/src/gpu/GrInOrderDrawBuffer.cpp @@ -147,6 +147,11 @@ public: &vertexBuffer, &firstVertex); + if (!vertices || !batchTarget->quadIndexBuffer()) { + SkDebugf("Could not allocate buffers\n"); + return; + } + for (int i = 0; i < instanceCount; i++) { const Geometry& args = fGeoData[i]; diff --git a/src/gpu/GrOvalRenderer.cpp b/src/gpu/GrOvalRenderer.cpp index fc8c18410c..20ae77cb52 100644 --- a/src/gpu/GrOvalRenderer.cpp +++ b/src/gpu/GrOvalRenderer.cpp @@ -762,6 +762,11 @@ public: &vertexBuffer, &firstVertex); + if (!vertices || !batchTarget->quadIndexBuffer()) { + SkDebugf("Could not allocate buffers\n"); + return; + } + CircleVertex* verts = reinterpret_cast<CircleVertex*>(vertices); for (int i = 0; i < instanceCount; i++) { @@ -1012,6 +1017,11 @@ public: &vertexBuffer, &firstVertex); + if (!vertices || !batchTarget->quadIndexBuffer()) { + SkDebugf("Could not allocate buffers\n"); + return; + } + EllipseVertex* verts = reinterpret_cast<EllipseVertex*>(vertices); for (int i = 0; i < instanceCount; i++) { @@ -1303,6 +1313,11 @@ public: &vertexBuffer, &firstVertex); + if (!vertices || !batchTarget->quadIndexBuffer()) { + SkDebugf("Could not allocate buffers\n"); + return; + } + DIEllipseVertex* verts = reinterpret_cast<DIEllipseVertex*>(vertices); for (int i = 0; i < instanceCount; i++) { @@ -1692,6 +1707,11 @@ public: &vertexBuffer, &firstVertex); + if (!vertices) { + SkDebugf("Could not allocate vertices\n"); + return; + } + CircleVertex* verts = reinterpret_cast<CircleVertex*>(vertices); for (int i = 0; i < instanceCount; i++) { @@ -1896,6 +1916,11 @@ public: &vertexBuffer, &firstVertex); + if (!vertices) { + SkDebugf("Could not allocate vertices\n"); + return; + } + EllipseVertex* verts = reinterpret_cast<EllipseVertex*>(vertices); for (int i = 0; i < instanceCount; i++) { diff --git a/src/gpu/GrTessellatingPathRenderer.cpp b/src/gpu/GrTessellatingPathRenderer.cpp index 955e6c12e2..1170e1cc99 100644 --- a/src/gpu/GrTessellatingPathRenderer.cpp +++ b/src/gpu/GrTessellatingPathRenderer.cpp @@ -1515,6 +1515,12 @@ public: count, &vertexBuffer, &firstVertex); + + if (!vertices) { + SkDebugf("Could not allocate vertices\n"); + return; + } + LOG("emitting %d verts\n", count); void* end = polys_to_triangles(polys, fillType, vertices); int actualCount = static_cast<int>( diff --git a/src/gpu/effects/GrDashingEffect.cpp b/src/gpu/effects/GrDashingEffect.cpp index fc3fc670ff..eb0467cef4 100644 --- a/src/gpu/effects/GrDashingEffect.cpp +++ b/src/gpu/effects/GrDashingEffect.cpp @@ -536,6 +536,11 @@ public: &vertexBuffer, &firstVertex); + if (!vertices || !batchTarget->quadIndexBuffer()) { + SkDebugf("Could not allocate buffers\n"); + return; + } + int curVIdx = 0; int rectIndex = 0; for (int i = 0; i < instanceCount; i++) { |