| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #include "GrDefaultPathRenderer.h" | 8 #include "GrDefaultPathRenderer.h" |
| 9 | 9 |
| 10 #include "GrBatch.h" | 10 #include "GrBatch.h" |
| 11 #include "GrBatchTarget.h" | 11 #include "GrBatchTarget.h" |
| 12 #include "GrBatchTest.h" | 12 #include "GrBatchTest.h" |
| 13 #include "GrBufferAllocPool.h" | |
| 14 #include "GrContext.h" | 13 #include "GrContext.h" |
| 15 #include "GrDefaultGeoProcFactory.h" | 14 #include "GrDefaultGeoProcFactory.h" |
| 16 #include "GrPathUtils.h" | 15 #include "GrPathUtils.h" |
| 17 #include "GrPipelineBuilder.h" | 16 #include "GrPipelineBuilder.h" |
| 18 #include "GrVertices.h" | 17 #include "GrVertices.h" |
| 19 #include "SkGeometry.h" | 18 #include "SkGeometry.h" |
| 20 #include "SkString.h" | 19 #include "SkString.h" |
| 21 #include "SkStrokeRec.h" | 20 #include "SkStrokeRec.h" |
| 22 #include "SkTLazy.h" | 21 #include "SkTLazy.h" |
| 23 #include "SkTraceEvent.h" | 22 #include "SkTraceEvent.h" |
| (...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 313 primitiveType = kTriangles_GrPrimitiveType; | 312 primitiveType = kTriangles_GrPrimitiveType; |
| 314 } else { | 313 } else { |
| 315 primitiveType = kTriangleFan_GrPrimitiveType; | 314 primitiveType = kTriangleFan_GrPrimitiveType; |
| 316 } | 315 } |
| 317 } | 316 } |
| 318 | 317 |
| 319 // allocate vertex / index buffers | 318 // allocate vertex / index buffers |
| 320 const GrVertexBuffer* vertexBuffer; | 319 const GrVertexBuffer* vertexBuffer; |
| 321 int firstVertex; | 320 int firstVertex; |
| 322 | 321 |
| 323 void* verts = batchTarget->vertexPool()->makeSpace(vertexStride, | 322 void* verts = batchTarget->makeVertSpace(vertexStride, maxVertices, |
| 324 maxVertices, | 323 &vertexBuffer, &firstVertex); |
| 325 &vertexBuffer, | |
| 326 &firstVertex); | |
| 327 | 324 |
| 328 if (!verts) { | 325 if (!verts) { |
| 329 SkDebugf("Could not allocate vertices\n"); | 326 SkDebugf("Could not allocate vertices\n"); |
| 330 return; | 327 return; |
| 331 } | 328 } |
| 332 | 329 |
| 333 const GrIndexBuffer* indexBuffer = NULL; | 330 const GrIndexBuffer* indexBuffer = NULL; |
| 334 int firstIndex = 0; | 331 int firstIndex = 0; |
| 335 | 332 |
| 336 void* indices = NULL; | 333 void* indices = NULL; |
| 337 if (isIndexed) { | 334 if (isIndexed) { |
| 338 indices = batchTarget->indexPool()->makeSpace(maxIndices, | 335 indices = batchTarget->makeIndexSpace(maxIndices, &indexBuffer, &fir
stIndex); |
| 339 &indexBuffer, | |
| 340 &firstIndex); | |
| 341 | 336 |
| 342 if (!indices) { | 337 if (!indices) { |
| 343 SkDebugf("Could not allocate indices\n"); | 338 SkDebugf("Could not allocate indices\n"); |
| 344 return; | 339 return; |
| 345 } | 340 } |
| 346 } | 341 } |
| 347 | 342 |
| 348 // fill buffers | 343 // fill buffers |
| 349 int vertexOffset = 0; | 344 int vertexOffset = 0; |
| 350 int indexOffset = 0; | 345 int indexOffset = 0; |
| (...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 772 geometry.fColor = color; | 767 geometry.fColor = color; |
| 773 geometry.fPath = path; | 768 geometry.fPath = path; |
| 774 geometry.fTolerance = srcSpaceTol; | 769 geometry.fTolerance = srcSpaceTol; |
| 775 | 770 |
| 776 viewMatrix.mapRect(&bounds); | 771 viewMatrix.mapRect(&bounds); |
| 777 uint8_t coverage = GrRandomCoverage(random); | 772 uint8_t coverage = GrRandomCoverage(random); |
| 778 return DefaultPathBatch::Create(geometry, coverage, viewMatrix, true, bounds
); | 773 return DefaultPathBatch::Create(geometry, coverage, viewMatrix, true, bounds
); |
| 779 } | 774 } |
| 780 | 775 |
| 781 #endif | 776 #endif |
| OLD | NEW |