OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2015 Google Inc. | 3 * Copyright 2015 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 "GrAALinearizingConvexPathRenderer.h" | 9 #include "GrAALinearizingConvexPathRenderer.h" |
10 | 10 |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 fBatch.fCoverageIgnored = !overrides.readsCoverage(); | 157 fBatch.fCoverageIgnored = !overrides.readsCoverage(); |
158 fBatch.fLinesOnly = SkPath::kLine_SegmentMask == fGeoData[0].fPath.getSe
gmentMasks(); | 158 fBatch.fLinesOnly = SkPath::kLine_SegmentMask == fGeoData[0].fPath.getSe
gmentMasks(); |
159 fBatch.fCanTweakAlphaForCoverage = overrides.canTweakAlphaForCoverage(); | 159 fBatch.fCanTweakAlphaForCoverage = overrides.canTweakAlphaForCoverage(); |
160 } | 160 } |
161 | 161 |
162 void draw(GrVertexBatch::Target* target, const GrPipeline* pipeline, int ver
texCount, | 162 void draw(GrVertexBatch::Target* target, const GrPipeline* pipeline, int ver
texCount, |
163 size_t vertexStride, void* vertices, int indexCount, uint16_t* ind
ices) const { | 163 size_t vertexStride, void* vertices, int indexCount, uint16_t* ind
ices) const { |
164 if (vertexCount == 0 || indexCount == 0) { | 164 if (vertexCount == 0 || indexCount == 0) { |
165 return; | 165 return; |
166 } | 166 } |
167 const GrBuffer* vertexBuffer; | 167 const GrVertexBuffer* vertexBuffer; |
168 GrMesh mesh; | 168 GrMesh mesh; |
169 int firstVertex; | 169 int firstVertex; |
170 void* verts = target->makeVertexSpace(vertexStride, vertexCount, &vertex
Buffer, | 170 void* verts = target->makeVertexSpace(vertexStride, vertexCount, &vertex
Buffer, |
171 &firstVertex); | 171 &firstVertex); |
172 if (!verts) { | 172 if (!verts) { |
173 SkDebugf("Could not allocate vertices\n"); | 173 SkDebugf("Could not allocate vertices\n"); |
174 return; | 174 return; |
175 } | 175 } |
176 memcpy(verts, vertices, vertexCount * vertexStride); | 176 memcpy(verts, vertices, vertexCount * vertexStride); |
177 | 177 |
178 const GrBuffer* indexBuffer; | 178 const GrIndexBuffer* indexBuffer; |
179 int firstIndex; | 179 int firstIndex; |
180 uint16_t* idxs = target->makeIndexSpace(indexCount, &indexBuffer, &first
Index); | 180 uint16_t* idxs = target->makeIndexSpace(indexCount, &indexBuffer, &first
Index); |
181 if (!idxs) { | 181 if (!idxs) { |
182 SkDebugf("Could not allocate indices\n"); | 182 SkDebugf("Could not allocate indices\n"); |
183 return; | 183 return; |
184 } | 184 } |
185 memcpy(idxs, indices, indexCount * sizeof(uint16_t)); | 185 memcpy(idxs, indices, indexCount * sizeof(uint16_t)); |
186 mesh.initIndexed(kTriangles_GrPrimitiveType, vertexBuffer, indexBuffer,
firstVertex, | 186 mesh.initIndexed(kTriangles_GrPrimitiveType, vertexBuffer, indexBuffer,
firstVertex, |
187 firstIndex, vertexCount, indexCount); | 187 firstIndex, vertexCount, indexCount); |
188 target->draw(mesh); | 188 target->draw(mesh); |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
348 DRAW_BATCH_TEST_DEFINE(AAFlatteningConvexPathBatch) { | 348 DRAW_BATCH_TEST_DEFINE(AAFlatteningConvexPathBatch) { |
349 AAFlatteningConvexPathBatch::Geometry geometry; | 349 AAFlatteningConvexPathBatch::Geometry geometry; |
350 geometry.fColor = GrRandomColor(random); | 350 geometry.fColor = GrRandomColor(random); |
351 geometry.fViewMatrix = GrTest::TestMatrixInvertible(random); | 351 geometry.fViewMatrix = GrTest::TestMatrixInvertible(random); |
352 geometry.fPath = GrTest::TestPathConvex(random); | 352 geometry.fPath = GrTest::TestPathConvex(random); |
353 | 353 |
354 return AAFlatteningConvexPathBatch::Create(geometry); | 354 return AAFlatteningConvexPathBatch::Create(geometry); |
355 } | 355 } |
356 | 356 |
357 #endif | 357 #endif |
OLD | NEW |