| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2014 Google Inc. | 3 * Copyright 2014 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 "GrAADistanceFieldPathRenderer.h" | 9 #include "GrAADistanceFieldPathRenderer.h" |
| 10 | 10 |
| (...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 500 // TODO remove this when batch is everywhere | 500 // TODO remove this when batch is everywhere |
| 501 GrPipelineInfo init; | 501 GrPipelineInfo init; |
| 502 init.fColorIgnored = fBatch.fColorIgnored; | 502 init.fColorIgnored = fBatch.fColorIgnored; |
| 503 init.fOverrideColor = GrColor_ILLEGAL; | 503 init.fOverrideColor = GrColor_ILLEGAL; |
| 504 init.fCoverageIgnored = fBatch.fCoverageIgnored; | 504 init.fCoverageIgnored = fBatch.fCoverageIgnored; |
| 505 init.fUsesLocalCoords = this->usesLocalCoords(); | 505 init.fUsesLocalCoords = this->usesLocalCoords(); |
| 506 dfProcessor->initBatchTracker(batchTarget->currentBatchTracker(), init); | 506 dfProcessor->initBatchTracker(batchTarget->currentBatchTracker(), init); |
| 507 } | 507 } |
| 508 | 508 |
| 509 void flush(GrBatchTarget* batchTarget, FlushInfo* flushInfo) { | 509 void flush(GrBatchTarget* batchTarget, FlushInfo* flushInfo) { |
| 510 GrDrawTarget::DrawInfo drawInfo; | 510 GrVertices vertices; |
| 511 int instancesToFlush = flushInfo->fInstancesToFlush; | 511 int instancesToFlush = flushInfo->fInstancesToFlush; |
| 512 int maxInstancesPerDraw = flushInfo->fIndexBuffer->maxQuads(); | 512 int maxInstancesPerDraw = flushInfo->fIndexBuffer->maxQuads(); |
| 513 drawInfo.initInstanced(kTriangles_GrPrimitiveType, flushInfo->fVertexBuf
fer, | 513 vertices.initInstanced(kTriangles_GrPrimitiveType, flushInfo->fVertexBuf
fer, |
| 514 flushInfo->fIndexBuffer, flushInfo->fVertexOffset, kVerticesPerQuad, | 514 flushInfo->fIndexBuffer, flushInfo->fVertexOffset, kVerticesPerQuad, |
| 515 kIndicesPerQuad, &instancesToFlush, maxInstancesPerDraw); | 515 kIndicesPerQuad, &instancesToFlush, maxInstancesPerDraw); |
| 516 do { | 516 do { |
| 517 batchTarget->draw(drawInfo); | 517 batchTarget->draw(vertices); |
| 518 } while (drawInfo.nextInstances(&instancesToFlush, maxInstancesPerDraw))
; | 518 } while (vertices.nextInstances(&instancesToFlush, maxInstancesPerDraw))
; |
| 519 flushInfo->fVertexOffset += kVerticesPerQuad * flushInfo->fInstancesToFl
ush; | 519 flushInfo->fVertexOffset += kVerticesPerQuad * flushInfo->fInstancesToFl
ush; |
| 520 flushInfo->fInstancesToFlush = 0; | 520 flushInfo->fInstancesToFlush = 0; |
| 521 } | 521 } |
| 522 | 522 |
| 523 GrColor color() const { return fBatch.fColor; } | 523 GrColor color() const { return fBatch.fColor; } |
| 524 const SkMatrix& viewMatrix() const { return fBatch.fViewMatrix; } | 524 const SkMatrix& viewMatrix() const { return fBatch.fViewMatrix; } |
| 525 bool usesLocalCoords() const { return fBatch.fUsesLocalCoords; } | 525 bool usesLocalCoords() const { return fBatch.fUsesLocalCoords; } |
| 526 | 526 |
| 527 bool onCombineIfPossible(GrBatch* t) override { | 527 bool onCombineIfPossible(GrBatch* t) override { |
| 528 AADistanceFieldPathBatch* that = t->cast<AADistanceFieldPathBatch>(); | 528 AADistanceFieldPathBatch* that = t->cast<AADistanceFieldPathBatch>(); |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 596 geometry.fPath = path; | 596 geometry.fPath = path; |
| 597 geometry.fAntiAlias = antiAlias; | 597 geometry.fAntiAlias = antiAlias; |
| 598 | 598 |
| 599 SkAutoTUnref<GrBatch> batch(AADistanceFieldPathBatch::Create(geometry, color
, viewMatrix, | 599 SkAutoTUnref<GrBatch> batch(AADistanceFieldPathBatch::Create(geometry, color
, viewMatrix, |
| 600 fAtlas, &fPathC
ache, &fPathList)); | 600 fAtlas, &fPathC
ache, &fPathList)); |
| 601 target->drawBatch(pipelineBuilder, batch); | 601 target->drawBatch(pipelineBuilder, batch); |
| 602 | 602 |
| 603 return true; | 603 return true; |
| 604 } | 604 } |
| 605 | 605 |
| OLD | NEW |