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 474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
485 kIndicesPerQuad, flushInfo->fInstancesToFlush, maxInstancesPerDraw); | 485 kIndicesPerQuad, flushInfo->fInstancesToFlush, maxInstancesPerDraw); |
486 batchTarget->draw(vertices); | 486 batchTarget->draw(vertices); |
487 flushInfo->fVertexOffset += kVerticesPerQuad * flushInfo->fInstancesToFl
ush; | 487 flushInfo->fVertexOffset += kVerticesPerQuad * flushInfo->fInstancesToFl
ush; |
488 flushInfo->fInstancesToFlush = 0; | 488 flushInfo->fInstancesToFlush = 0; |
489 } | 489 } |
490 | 490 |
491 GrColor color() const { return fBatch.fColor; } | 491 GrColor color() const { return fBatch.fColor; } |
492 const SkMatrix& viewMatrix() const { return fBatch.fViewMatrix; } | 492 const SkMatrix& viewMatrix() const { return fBatch.fViewMatrix; } |
493 bool usesLocalCoords() const { return fBatch.fUsesLocalCoords; } | 493 bool usesLocalCoords() const { return fBatch.fUsesLocalCoords; } |
494 | 494 |
495 bool onCombineIfPossible(GrBatch* t) override { | 495 bool onCombineIfPossible(GrBatch* t, const GrCaps& caps) override { |
496 if (!this->pipeline()->isEqual(*t->pipeline())) { | 496 if (!GrPipeline::CanCombine(*this->pipeline(), this->bounds(), *t->pipel
ine(), t->bounds(), |
| 497 caps)) { |
497 return false; | 498 return false; |
498 } | 499 } |
499 | 500 |
500 AADistanceFieldPathBatch* that = t->cast<AADistanceFieldPathBatch>(); | 501 AADistanceFieldPathBatch* that = t->cast<AADistanceFieldPathBatch>(); |
501 | 502 |
502 // TODO we could actually probably do a bunch of this work on the CPU, i
e map viewMatrix, | 503 // TODO we could actually probably do a bunch of this work on the CPU, i
e map viewMatrix, |
503 // maybe upload color via attribute | 504 // maybe upload color via attribute |
504 if (this->color() != that->color()) { | 505 if (this->color() != that->color()) { |
505 return false; | 506 return false; |
506 } | 507 } |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
625 geometry.fPath = GrTest::TestPath(random); | 626 geometry.fPath = GrTest::TestPath(random); |
626 geometry.fAntiAlias = random->nextBool(); | 627 geometry.fAntiAlias = random->nextBool(); |
627 | 628 |
628 return AADistanceFieldPathBatch::Create(geometry, color, viewMatrix, | 629 return AADistanceFieldPathBatch::Create(geometry, color, viewMatrix, |
629 gTestStruct.fAtlas, | 630 gTestStruct.fAtlas, |
630 &gTestStruct.fPathCache, | 631 &gTestStruct.fPathCache, |
631 &gTestStruct.fPathList); | 632 &gTestStruct.fPathList); |
632 } | 633 } |
633 | 634 |
634 #endif | 635 #endif |
OLD | NEW |