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