Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(216)

Unified Diff: src/gpu/GrAARectRenderer.cpp

Issue 979343002: handle null vertex or index buffers in batch (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: cleanup Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/GrAAHairLinePathRenderer.cpp ('k') | src/gpu/GrContext.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrAARectRenderer.cpp
diff --git a/src/gpu/GrAARectRenderer.cpp b/src/gpu/GrAARectRenderer.cpp
index 7c34c25abd405dfd64a7c51ab61dd3e54627174a..6affc927ac6de376cd25c9f8c5bbc8b2fa97eb5b 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;
}
« no previous file with comments | « src/gpu/GrAAHairLinePathRenderer.cpp ('k') | src/gpu/GrContext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698