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 806 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
817 return; | 817 return; |
818 } | 818 } |
819 | 819 |
820 QuadVertex* verts = reinterpret_cast<QuadVertex*>(vertices); | 820 QuadVertex* verts = reinterpret_cast<QuadVertex*>(vertices); |
821 uint16_t* idxs = reinterpret_cast<uint16_t*>(indices); | 821 uint16_t* idxs = reinterpret_cast<uint16_t*>(indices); |
822 | 822 |
823 SkSTArray<kPreallocDrawCnt, Draw, true> draws; | 823 SkSTArray<kPreallocDrawCnt, Draw, true> draws; |
824 create_vertices(segments, fanPt, &draws, verts, idxs); | 824 create_vertices(segments, fanPt, &draws, verts, idxs); |
825 | 825 |
826 GrDrawTarget::DrawInfo info; | 826 GrDrawTarget::DrawInfo info; |
| 827 info.setVertexBuffer(vertexBuffer); |
| 828 info.setIndexBuffer(indexBuffer); |
| 829 info.setPrimitiveType(kTriangles_GrPrimitiveType); |
| 830 info.setStartIndex(firstIndex); |
827 | 831 |
| 832 int vOffset = 0; |
828 for (int i = 0; i < draws.count(); ++i) { | 833 for (int i = 0; i < draws.count(); ++i) { |
829 const Draw& draw = draws[i]; | 834 const Draw& draw = draws[i]; |
830 info.initIndexed(kTriangles_GrPrimitiveType, vertexBuffer, index
Buffer, firstVertex, | 835 info.setStartVertex(vOffset + firstVertex); |
831 firstIndex, draw.fVertexCnt, draw.fIndexCnt); | 836 info.setVertexCount(draw.fVertexCnt); |
| 837 info.setIndexCount(draw.fIndexCnt); |
832 batchTarget->draw(info); | 838 batchTarget->draw(info); |
833 firstVertex += draw.fVertexCnt; | 839 vOffset += draw.fVertexCnt; |
834 firstIndex += draw.fIndexCnt; | |
835 } | 840 } |
836 } | 841 } |
837 } | 842 } |
838 | 843 |
839 SkSTArray<1, Geometry, true>* geoData() { return &fGeoData; } | 844 SkSTArray<1, Geometry, true>* geoData() { return &fGeoData; } |
840 | 845 |
841 private: | 846 private: |
842 AAConvexPathBatch(const Geometry& geometry) { | 847 AAConvexPathBatch(const Geometry& geometry) { |
843 this->initClassID<AAConvexPathBatch>(); | 848 this->initClassID<AAConvexPathBatch>(); |
844 fGeoData.push_back(geometry); | 849 fGeoData.push_back(geometry); |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
895 geometry.fColor = color; | 900 geometry.fColor = color; |
896 geometry.fViewMatrix = vm; | 901 geometry.fViewMatrix = vm; |
897 geometry.fPath = path; | 902 geometry.fPath = path; |
898 | 903 |
899 SkAutoTUnref<GrBatch> batch(AAConvexPathBatch::Create(geometry)); | 904 SkAutoTUnref<GrBatch> batch(AAConvexPathBatch::Create(geometry)); |
900 target->drawBatch(pipelineBuilder, batch); | 905 target->drawBatch(pipelineBuilder, batch); |
901 | 906 |
902 return true; | 907 return true; |
903 | 908 |
904 } | 909 } |
OLD | NEW |