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...) 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; | 332 const GrIndexBuffer* indexBuffer = NULL; |
333 int firstIndex; | 333 int firstIndex = 0; |
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...) 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); | |
377 if (isIndexed) { | 373 if (isIndexed) { |
378 drawInfo.setIndexBuffer(indexBuffer); | 374 drawInfo.initIndexed(primitiveType, vertexBuffer, indexBuffer, first
Vertex, firstIndex, |
379 drawInfo.setStartIndex(firstIndex); | 375 vertexOffset, indexOffset); |
380 drawInfo.setIndexCount(indexOffset); | |
381 } else { | 376 } else { |
382 drawInfo.setStartIndex(0); | 377 drawInfo.init(primitiveType, vertexBuffer, firstVertex, vertexOffset
); |
383 drawInfo.setIndexCount(0); | |
384 } | 378 } |
385 batchTarget->draw(drawInfo); | 379 batchTarget->draw(drawInfo); |
386 | 380 |
387 // put back reserves | 381 // put back reserves |
388 batchTarget->putBackIndices((size_t)(maxIndices - indexOffset)); | 382 batchTarget->putBackIndices((size_t)(maxIndices - indexOffset)); |
389 batchTarget->putBackVertices((size_t)(maxVertices - vertexOffset), (size
_t)vertexStride); | 383 batchTarget->putBackVertices((size_t)(maxVertices - vertexOffset), (size
_t)vertexStride); |
390 } | 384 } |
391 | 385 |
392 SkSTArray<1, Geometry, true>* geoData() { return &fGeoData; } | 386 SkSTArray<1, Geometry, true>* geoData() { return &fGeoData; } |
393 | 387 |
(...skipping 353 matching lines...) Loading... |
747 | 741 |
748 void GrDefaultPathRenderer::onStencilPath(GrDrawTarget* target, | 742 void GrDefaultPathRenderer::onStencilPath(GrDrawTarget* target, |
749 GrPipelineBuilder* pipelineBuilder, | 743 GrPipelineBuilder* pipelineBuilder, |
750 const SkMatrix& viewMatrix, | 744 const SkMatrix& viewMatrix, |
751 const SkPath& path, | 745 const SkPath& path, |
752 const GrStrokeInfo& stroke) { | 746 const GrStrokeInfo& stroke) { |
753 SkASSERT(SkPath::kInverseEvenOdd_FillType != path.getFillType()); | 747 SkASSERT(SkPath::kInverseEvenOdd_FillType != path.getFillType()); |
754 SkASSERT(SkPath::kInverseWinding_FillType != path.getFillType()); | 748 SkASSERT(SkPath::kInverseWinding_FillType != path.getFillType()); |
755 this->internalDrawPath(target, pipelineBuilder, GrColor_WHITE, viewMatrix, p
ath, stroke, true); | 749 this->internalDrawPath(target, pipelineBuilder, GrColor_WHITE, viewMatrix, p
ath, stroke, true); |
756 } | 750 } |
OLD | NEW |