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