| 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 |
| 11 #include "GrBatch.h" | 11 #include "GrBatch.h" |
| 12 #include "GrBatchTarget.h" | 12 #include "GrBatchTarget.h" |
| 13 #include "GrBufferAllocPool.h" | |
| 14 #include "GrContext.h" | 13 #include "GrContext.h" |
| 15 #include "GrDrawTargetCaps.h" | 14 #include "GrDrawTargetCaps.h" |
| 16 #include "GrGeometryProcessor.h" | 15 #include "GrGeometryProcessor.h" |
| 17 #include "GrInvariantOutput.h" | 16 #include "GrInvariantOutput.h" |
| 18 #include "GrPathUtils.h" | 17 #include "GrPathUtils.h" |
| 19 #include "GrProcessor.h" | 18 #include "GrProcessor.h" |
| 20 #include "GrPipelineBuilder.h" | 19 #include "GrPipelineBuilder.h" |
| 21 #include "GrStrokeInfo.h" | 20 #include "GrStrokeInfo.h" |
| 22 #include "SkGeometry.h" | 21 #include "SkGeometry.h" |
| 23 #include "SkString.h" | 22 #include "SkString.h" |
| (...skipping 764 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 788 | 787 |
| 789 if (!get_segments(args.fPath, *viewMatrix, &segments, &fanPt, &verte
xCount, | 788 if (!get_segments(args.fPath, *viewMatrix, &segments, &fanPt, &verte
xCount, |
| 790 &indexCount)) { | 789 &indexCount)) { |
| 791 continue; | 790 continue; |
| 792 } | 791 } |
| 793 | 792 |
| 794 const GrVertexBuffer* vertexBuffer; | 793 const GrVertexBuffer* vertexBuffer; |
| 795 int firstVertex; | 794 int firstVertex; |
| 796 | 795 |
| 797 size_t vertexStride = quadProcessor->getVertexStride(); | 796 size_t vertexStride = quadProcessor->getVertexStride(); |
| 798 void *vertices = batchTarget->vertexPool()->makeSpace(vertexStride, | 797 void *vertices = batchTarget->makeVertSpace(vertexStride, vertexCoun
t, |
| 799 vertexCount, | 798 &vertexBuffer, &firstVer
tex); |
| 800 &vertexBuffer, | |
| 801 &firstVertex); | |
| 802 | |
| 803 if (!vertices) { | 799 if (!vertices) { |
| 804 SkDebugf("Could not allocate vertices\n"); | 800 SkDebugf("Could not allocate vertices\n"); |
| 805 return; | 801 return; |
| 806 } | 802 } |
| 807 | 803 |
| 808 const GrIndexBuffer* indexBuffer; | 804 const GrIndexBuffer* indexBuffer; |
| 809 int firstIndex; | 805 int firstIndex; |
| 810 | 806 |
| 811 void *indices = batchTarget->indexPool()->makeSpace(indexCount, | 807 uint16_t *idxs = batchTarget->makeIndexSpace(indexCount, &indexBuffe
r, &firstIndex); |
| 812 &indexBuffer, | 808 if (!idxs) { |
| 813 &firstIndex); | |
| 814 | |
| 815 if (!indices) { | |
| 816 SkDebugf("Could not allocate indices\n"); | 809 SkDebugf("Could not allocate indices\n"); |
| 817 return; | 810 return; |
| 818 } | 811 } |
| 819 | 812 |
| 820 QuadVertex* verts = reinterpret_cast<QuadVertex*>(vertices); | 813 QuadVertex* verts = reinterpret_cast<QuadVertex*>(vertices); |
| 821 uint16_t* idxs = reinterpret_cast<uint16_t*>(indices); | |
| 822 | 814 |
| 823 SkSTArray<kPreallocDrawCnt, Draw, true> draws; | 815 SkSTArray<kPreallocDrawCnt, Draw, true> draws; |
| 824 create_vertices(segments, fanPt, &draws, verts, idxs); | 816 create_vertices(segments, fanPt, &draws, verts, idxs); |
| 825 | 817 |
| 826 GrVertices info; | 818 GrVertices info; |
| 827 | 819 |
| 828 for (int i = 0; i < draws.count(); ++i) { | 820 for (int i = 0; i < draws.count(); ++i) { |
| 829 const Draw& draw = draws[i]; | 821 const Draw& draw = draws[i]; |
| 830 info.initIndexed(kTriangles_GrPrimitiveType, vertexBuffer, index
Buffer, firstVertex, | 822 info.initIndexed(kTriangles_GrPrimitiveType, vertexBuffer, index
Buffer, firstVertex, |
| 831 firstIndex, draw.fVertexCnt, draw.fIndexCnt); | 823 firstIndex, draw.fVertexCnt, draw.fIndexCnt); |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 895 geometry.fColor = color; | 887 geometry.fColor = color; |
| 896 geometry.fViewMatrix = vm; | 888 geometry.fViewMatrix = vm; |
| 897 geometry.fPath = path; | 889 geometry.fPath = path; |
| 898 | 890 |
| 899 SkAutoTUnref<GrBatch> batch(AAConvexPathBatch::Create(geometry)); | 891 SkAutoTUnref<GrBatch> batch(AAConvexPathBatch::Create(geometry)); |
| 900 target->drawBatch(pipelineBuilder, batch); | 892 target->drawBatch(pipelineBuilder, batch); |
| 901 | 893 |
| 902 return true; | 894 return true; |
| 903 | 895 |
| 904 } | 896 } |
| OLD | NEW |