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

Side by Side Diff: src/gpu/GrDefaultPathRenderer.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, 9 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 unified diff | Download patch
« no previous file with comments | « src/gpu/GrContext.cpp ('k') | src/gpu/GrInOrderDrawBuffer.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2011 Google Inc. 2 * Copyright 2011 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "GrDefaultPathRenderer.h" 8 #include "GrDefaultPathRenderer.h"
9 9
10 #include "GrBatch.h" 10 #include "GrBatch.h"
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after
316 316
317 // allocate vertex / index buffers 317 // allocate vertex / index buffers
318 const GrVertexBuffer* vertexBuffer; 318 const GrVertexBuffer* vertexBuffer;
319 int firstVertex; 319 int firstVertex;
320 320
321 void* vertices = batchTarget->vertexPool()->makeSpace(vertexStride, 321 void* vertices = batchTarget->vertexPool()->makeSpace(vertexStride,
322 maxVertices, 322 maxVertices,
323 &vertexBuffer, 323 &vertexBuffer,
324 &firstVertex); 324 &firstVertex);
325 325
326 if (!vertices) {
327 SkDebugf("Could not allocate vertices\n");
328 return;
329 }
330
326 const GrIndexBuffer* indexBuffer; 331 const GrIndexBuffer* indexBuffer;
327 int firstIndex; 332 int firstIndex;
328 333
329 void* indices = NULL; 334 void* indices = NULL;
330 if (isIndexed) { 335 if (isIndexed) {
331 indices = batchTarget->indexPool()->makeSpace(maxIndices, 336 indices = batchTarget->indexPool()->makeSpace(maxIndices,
332 &indexBuffer, 337 &indexBuffer,
333 &firstIndex); 338 &firstIndex);
339
340 if (!indices) {
341 SkDebugf("Could not allocate indices\n");
342 return;
343 }
334 } 344 }
335 345
336 // fill buffers 346 // fill buffers
337 int vertexOffset = 0; 347 int vertexOffset = 0;
338 int indexOffset = 0; 348 int indexOffset = 0;
339 for (int i = 0; i < instanceCount; i++) { 349 for (int i = 0; i < instanceCount; i++) {
340 Geometry& args = fGeoData[i]; 350 Geometry& args = fGeoData[i];
341 351
342 int vertexCnt = 0; 352 int vertexCnt = 0;
343 int indexCnt = 0; 353 int indexCnt = 0;
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after
735 745
736 void GrDefaultPathRenderer::onStencilPath(GrDrawTarget* target, 746 void GrDefaultPathRenderer::onStencilPath(GrDrawTarget* target,
737 GrPipelineBuilder* pipelineBuilder, 747 GrPipelineBuilder* pipelineBuilder,
738 const SkMatrix& viewMatrix, 748 const SkMatrix& viewMatrix,
739 const SkPath& path, 749 const SkPath& path,
740 const SkStrokeRec& stroke) { 750 const SkStrokeRec& stroke) {
741 SkASSERT(SkPath::kInverseEvenOdd_FillType != path.getFillType()); 751 SkASSERT(SkPath::kInverseEvenOdd_FillType != path.getFillType());
742 SkASSERT(SkPath::kInverseWinding_FillType != path.getFillType()); 752 SkASSERT(SkPath::kInverseWinding_FillType != path.getFillType());
743 this->internalDrawPath(target, pipelineBuilder, GrColor_WHITE, viewMatrix, p ath, stroke, true); 753 this->internalDrawPath(target, pipelineBuilder, GrColor_WHITE, viewMatrix, p ath, stroke, true);
744 } 754 }
OLDNEW
« no previous file with comments | « src/gpu/GrContext.cpp ('k') | src/gpu/GrInOrderDrawBuffer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698