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 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
360 drawInfo.setVertexCount(vertexOffset); | 360 drawInfo.setVertexCount(vertexOffset); |
361 if (isIndexed) { | 361 if (isIndexed) { |
362 drawInfo.setIndexBuffer(indexBuffer); | 362 drawInfo.setIndexBuffer(indexBuffer); |
363 drawInfo.setStartIndex(firstIndex); | 363 drawInfo.setStartIndex(firstIndex); |
364 drawInfo.setIndexCount(indexOffset); | 364 drawInfo.setIndexCount(indexOffset); |
365 } else { | 365 } else { |
366 drawInfo.setStartIndex(0); | 366 drawInfo.setStartIndex(0); |
367 drawInfo.setIndexCount(0); | 367 drawInfo.setIndexCount(0); |
368 } | 368 } |
369 batchTarget->draw(drawInfo); | 369 batchTarget->draw(drawInfo); |
| 370 |
| 371 // put back reserves |
| 372 batchTarget->putBackIndices((size_t)(maxIndices - indexOffset)); |
| 373 batchTarget->putBackVertices((size_t)(maxVertices - vertexOffset), (size
_t)vertexStride); |
370 } | 374 } |
371 | 375 |
372 SkSTArray<1, Geometry, true>* geoData() { return &fGeoData; } | 376 SkSTArray<1, Geometry, true>* geoData() { return &fGeoData; } |
373 | 377 |
374 private: | 378 private: |
375 DefaultPathBatch(const Geometry& geometry, uint8_t coverage, const SkMatrix&
viewMatrix, | 379 DefaultPathBatch(const Geometry& geometry, uint8_t coverage, const SkMatrix&
viewMatrix, |
376 bool isHairline) { | 380 bool isHairline) { |
377 this->initClassID<DefaultPathBatch>(); | 381 this->initClassID<DefaultPathBatch>(); |
378 fBatch.fCoverage = coverage; | 382 fBatch.fCoverage = coverage; |
379 fBatch.fIsHairline = isHairline; | 383 fBatch.fIsHairline = isHairline; |
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
726 | 730 |
727 void GrDefaultPathRenderer::onStencilPath(GrDrawTarget* target, | 731 void GrDefaultPathRenderer::onStencilPath(GrDrawTarget* target, |
728 GrPipelineBuilder* pipelineBuilder, | 732 GrPipelineBuilder* pipelineBuilder, |
729 const SkMatrix& viewMatrix, | 733 const SkMatrix& viewMatrix, |
730 const SkPath& path, | 734 const SkPath& path, |
731 const SkStrokeRec& stroke) { | 735 const SkStrokeRec& stroke) { |
732 SkASSERT(SkPath::kInverseEvenOdd_FillType != path.getFillType()); | 736 SkASSERT(SkPath::kInverseEvenOdd_FillType != path.getFillType()); |
733 SkASSERT(SkPath::kInverseWinding_FillType != path.getFillType()); | 737 SkASSERT(SkPath::kInverseWinding_FillType != path.getFillType()); |
734 this->internalDrawPath(target, pipelineBuilder, GrColor_WHITE, viewMatrix, p
ath, stroke, true); | 738 this->internalDrawPath(target, pipelineBuilder, GrColor_WHITE, viewMatrix, p
ath, stroke, true); |
735 } | 739 } |
OLD | NEW |