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 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 memcpy(verts, vertices, vertexCount * vertexStride); | 176 memcpy(verts, vertices, vertexCount * vertexStride); |
177 | 177 |
178 const GrIndexBuffer* 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 info.initIndexed(kTriangles_GrPrimitiveType, vertexBuffer, indexBuffer,
firstVertex, | 186 info.initIndexed(vertexBuffer, indexBuffer, firstVertex, |
187 firstIndex, vertexCount, indexCount); | 187 firstIndex, vertexCount, indexCount); |
188 target->draw(info); | 188 target->draw(info); |
189 } | 189 } |
190 | 190 |
191 void onPrepareDraws(Target* target) const override { | 191 void onPrepareDraws(Target* target) const override { |
192 bool canTweakAlphaForCoverage = this->canTweakAlphaForCoverage(); | 192 bool canTweakAlphaForCoverage = this->canTweakAlphaForCoverage(); |
193 | 193 |
194 // Setup GrGeometryProcessor | 194 // Setup GrGeometryProcessor |
195 SkAutoTUnref<const GrGeometryProcessor> gp(create_fill_gp(canTweakAlphaF
orCoverage, | 195 SkAutoTUnref<const GrGeometryProcessor> gp(create_fill_gp(canTweakAlphaF
orCoverage, |
196 this->viewMatr
ix(), | 196 this->viewMatr
ix(), |
197 this->usesLoca
lCoords(), | 197 this->usesLoca
lCoords(), |
198 this->coverage
Ignored())); | 198 this->coverage
Ignored())); |
199 if (!gp) { | 199 if (!gp) { |
200 SkDebugf("Couldn't create a GrGeometryProcessor\n"); | 200 SkDebugf("Couldn't create a GrGeometryProcessor\n"); |
201 return; | 201 return; |
202 } | 202 } |
203 | 203 |
204 target->initDraw(gp, this->pipeline()); | 204 target->initDraw(gp, kTriangles_GrPrimitiveType); |
205 | 205 |
206 size_t vertexStride = gp->getVertexStride(); | 206 size_t vertexStride = gp->getVertexStride(); |
207 | 207 |
208 SkASSERT(canTweakAlphaForCoverage ? | 208 SkASSERT(canTweakAlphaForCoverage ? |
209 vertexStride == sizeof(GrDefaultGeoProcFactory::PositionColorAt
tr) : | 209 vertexStride == sizeof(GrDefaultGeoProcFactory::PositionColorAt
tr) : |
210 vertexStride == sizeof(GrDefaultGeoProcFactory::PositionColorCo
verageAttr)); | 210 vertexStride == sizeof(GrDefaultGeoProcFactory::PositionColorCo
verageAttr)); |
211 | 211 |
212 int instanceCount = fGeoData.count(); | 212 int instanceCount = fGeoData.count(); |
213 | 213 |
214 int vertexCount = 0; | 214 int vertexCount = 0; |
(...skipping 133 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 |