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" |
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
322 void* vertices = batchTarget->vertexPool()->makeSpace(vertexStride, | 322 void* vertices = batchTarget->vertexPool()->makeSpace(vertexStride, |
323 maxVertices, | 323 maxVertices, |
324 &vertexBuffer, | 324 &vertexBuffer, |
325 &firstVertex); | 325 &firstVertex); |
326 | 326 |
327 if (!vertices) { | 327 if (!vertices) { |
328 SkDebugf("Could not allocate vertices\n"); | 328 SkDebugf("Could not allocate vertices\n"); |
329 return; | 329 return; |
330 } | 330 } |
331 | 331 |
332 const GrIndexBuffer* indexBuffer = NULL; | 332 const GrIndexBuffer* indexBuffer; |
333 int firstIndex = 0; | 333 int firstIndex; |
334 | 334 |
335 void* indices = NULL; | 335 void* indices = NULL; |
336 if (isIndexed) { | 336 if (isIndexed) { |
337 indices = batchTarget->indexPool()->makeSpace(maxIndices, | 337 indices = batchTarget->indexPool()->makeSpace(maxIndices, |
338 &indexBuffer, | 338 &indexBuffer, |
339 &firstIndex); | 339 &firstIndex); |
340 | 340 |
341 if (!indices) { | 341 if (!indices) { |
342 SkDebugf("Could not allocate indices\n"); | 342 SkDebugf("Could not allocate indices\n"); |
343 return; | 343 return; |
(...skipping 19 matching lines...) Expand all Loading... |
363 isIndexed)) { | 363 isIndexed)) { |
364 return; | 364 return; |
365 } | 365 } |
366 | 366 |
367 vertexOffset += vertexCnt; | 367 vertexOffset += vertexCnt; |
368 indexOffset += indexCnt; | 368 indexOffset += indexCnt; |
369 SkASSERT(vertexOffset <= maxVertices && indexOffset <= maxIndices); | 369 SkASSERT(vertexOffset <= maxVertices && indexOffset <= maxIndices); |
370 } | 370 } |
371 | 371 |
372 GrDrawTarget::DrawInfo drawInfo; | 372 GrDrawTarget::DrawInfo drawInfo; |
| 373 drawInfo.setPrimitiveType(primitiveType); |
| 374 drawInfo.setVertexBuffer(vertexBuffer); |
| 375 drawInfo.setStartVertex(firstVertex); |
| 376 drawInfo.setVertexCount(vertexOffset); |
373 if (isIndexed) { | 377 if (isIndexed) { |
374 drawInfo.initIndexed(primitiveType, vertexBuffer, indexBuffer, first
Vertex, firstIndex, | 378 drawInfo.setIndexBuffer(indexBuffer); |
375 vertexOffset, indexOffset); | 379 drawInfo.setStartIndex(firstIndex); |
| 380 drawInfo.setIndexCount(indexOffset); |
376 } else { | 381 } else { |
377 drawInfo.init(primitiveType, vertexBuffer, firstVertex, vertexOffset
); | 382 drawInfo.setStartIndex(0); |
| 383 drawInfo.setIndexCount(0); |
378 } | 384 } |
379 batchTarget->draw(drawInfo); | 385 batchTarget->draw(drawInfo); |
380 | 386 |
381 // put back reserves | 387 // put back reserves |
382 batchTarget->putBackIndices((size_t)(maxIndices - indexOffset)); | 388 batchTarget->putBackIndices((size_t)(maxIndices - indexOffset)); |
383 batchTarget->putBackVertices((size_t)(maxVertices - vertexOffset), (size
_t)vertexStride); | 389 batchTarget->putBackVertices((size_t)(maxVertices - vertexOffset), (size
_t)vertexStride); |
384 } | 390 } |
385 | 391 |
386 SkSTArray<1, Geometry, true>* geoData() { return &fGeoData; } | 392 SkSTArray<1, Geometry, true>* geoData() { return &fGeoData; } |
387 | 393 |
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
741 | 747 |
742 void GrDefaultPathRenderer::onStencilPath(GrDrawTarget* target, | 748 void GrDefaultPathRenderer::onStencilPath(GrDrawTarget* target, |
743 GrPipelineBuilder* pipelineBuilder, | 749 GrPipelineBuilder* pipelineBuilder, |
744 const SkMatrix& viewMatrix, | 750 const SkMatrix& viewMatrix, |
745 const SkPath& path, | 751 const SkPath& path, |
746 const GrStrokeInfo& stroke) { | 752 const GrStrokeInfo& stroke) { |
747 SkASSERT(SkPath::kInverseEvenOdd_FillType != path.getFillType()); | 753 SkASSERT(SkPath::kInverseEvenOdd_FillType != path.getFillType()); |
748 SkASSERT(SkPath::kInverseWinding_FillType != path.getFillType()); | 754 SkASSERT(SkPath::kInverseWinding_FillType != path.getFillType()); |
749 this->internalDrawPath(target, pipelineBuilder, GrColor_WHITE, viewMatrix, p
ath, stroke, true); | 755 this->internalDrawPath(target, pipelineBuilder, GrColor_WHITE, viewMatrix, p
ath, stroke, true); |
750 } | 756 } |
OLD | NEW |