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

Side by Side Diff: src/gpu/GrAAConvexPathRenderer.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 | « gm/convexpolyeffect.cpp ('k') | src/gpu/GrAAHairLinePathRenderer.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 /* 2 /*
3 * Copyright 2012 Google Inc. 3 * Copyright 2012 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 #include "GrAAConvexPathRenderer.h" 9 #include "GrAAConvexPathRenderer.h"
10 10
(...skipping 766 matching lines...) Expand 10 before | Expand all | Expand 10 after
777 777
778 const GrVertexBuffer* vertexBuffer; 778 const GrVertexBuffer* vertexBuffer;
779 int firstVertex; 779 int firstVertex;
780 780
781 size_t vertexStride = quadProcessor->getVertexStride(); 781 size_t vertexStride = quadProcessor->getVertexStride();
782 void *vertices = batchTarget->vertexPool()->makeSpace(vertexStride, 782 void *vertices = batchTarget->vertexPool()->makeSpace(vertexStride,
783 vertexCount, 783 vertexCount,
784 &vertexBuffer, 784 &vertexBuffer,
785 &firstVertex); 785 &firstVertex);
786 786
787 if (!vertices) {
788 SkDebugf("Could not allocate vertices\n");
789 return;
790 }
791
787 const GrIndexBuffer* indexBuffer; 792 const GrIndexBuffer* indexBuffer;
788 int firstIndex; 793 int firstIndex;
789 794
790 void *indices = batchTarget->indexPool()->makeSpace(indexCount, 795 void *indices = batchTarget->indexPool()->makeSpace(indexCount,
791 &indexBuffer, 796 &indexBuffer,
792 &firstIndex); 797 &firstIndex);
793 798
799 if (!indices) {
800 SkDebugf("Could not allocate indices\n");
801 return;
802 }
803
794 QuadVertex* verts = reinterpret_cast<QuadVertex*>(vertices); 804 QuadVertex* verts = reinterpret_cast<QuadVertex*>(vertices);
795 uint16_t* idxs = reinterpret_cast<uint16_t*>(indices); 805 uint16_t* idxs = reinterpret_cast<uint16_t*>(indices);
796 806
797 SkSTArray<kPreallocDrawCnt, Draw, true> draws; 807 SkSTArray<kPreallocDrawCnt, Draw, true> draws;
798 create_vertices(segments, fanPt, &draws, verts, idxs); 808 create_vertices(segments, fanPt, &draws, verts, idxs);
799 809
800 GrDrawTarget::DrawInfo info; 810 GrDrawTarget::DrawInfo info;
801 info.setVertexBuffer(vertexBuffer); 811 info.setVertexBuffer(vertexBuffer);
802 info.setIndexBuffer(indexBuffer); 812 info.setIndexBuffer(indexBuffer);
803 info.setPrimitiveType(kTriangles_GrPrimitiveType); 813 info.setPrimitiveType(kTriangles_GrPrimitiveType);
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
875 geometry.fColor = color; 885 geometry.fColor = color;
876 geometry.fViewMatrix = vm; 886 geometry.fViewMatrix = vm;
877 geometry.fPath = path; 887 geometry.fPath = path;
878 888
879 SkAutoTUnref<GrBatch> batch(AAConvexPathBatch::Create(geometry)); 889 SkAutoTUnref<GrBatch> batch(AAConvexPathBatch::Create(geometry));
880 target->drawBatch(pipelineBuilder, batch, &devRect); 890 target->drawBatch(pipelineBuilder, batch, &devRect);
881 891
882 return true; 892 return true;
883 893
884 } 894 }
OLDNEW
« no previous file with comments | « gm/convexpolyeffect.cpp ('k') | src/gpu/GrAAHairLinePathRenderer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698