OLD | NEW |
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 Loading... |
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 Loading... |
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 } |
OLD | NEW |