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 483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
494 batchTarget->draw(vertices); | 494 batchTarget->draw(vertices); |
495 flushInfo->fVertexOffset += kVerticesPerQuad * flushInfo->fInstancesToFl
ush; | 495 flushInfo->fVertexOffset += kVerticesPerQuad * flushInfo->fInstancesToFl
ush; |
496 flushInfo->fInstancesToFlush = 0; | 496 flushInfo->fInstancesToFlush = 0; |
497 } | 497 } |
498 | 498 |
499 GrColor color() const { return fBatch.fColor; } | 499 GrColor color() const { return fBatch.fColor; } |
500 const SkMatrix& viewMatrix() const { return fBatch.fViewMatrix; } | 500 const SkMatrix& viewMatrix() const { return fBatch.fViewMatrix; } |
501 bool usesLocalCoords() const { return fBatch.fUsesLocalCoords; } | 501 bool usesLocalCoords() const { return fBatch.fUsesLocalCoords; } |
502 | 502 |
503 bool onCombineIfPossible(GrBatch* t) override { | 503 bool onCombineIfPossible(GrBatch* t) override { |
| 504 if (!this->pipeline()->isEqual(*t->pipeline())) { |
| 505 return false; |
| 506 } |
| 507 |
504 AADistanceFieldPathBatch* that = t->cast<AADistanceFieldPathBatch>(); | 508 AADistanceFieldPathBatch* that = t->cast<AADistanceFieldPathBatch>(); |
505 | 509 |
506 // TODO we could actually probably do a bunch of this work on the CPU, i
e map viewMatrix, | 510 // TODO we could actually probably do a bunch of this work on the CPU, i
e map viewMatrix, |
507 // maybe upload color via attribute | 511 // maybe upload color via attribute |
508 if (this->color() != that->color()) { | 512 if (this->color() != that->color()) { |
509 return false; | 513 return false; |
510 } | 514 } |
511 | 515 |
512 if (!this->viewMatrix().cheapEqualTo(that->viewMatrix())) { | 516 if (!this->viewMatrix().cheapEqualTo(that->viewMatrix())) { |
513 return false; | 517 return false; |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
651 geometry.fPath = GrTest::TestPath(random); | 655 geometry.fPath = GrTest::TestPath(random); |
652 geometry.fAntiAlias = random->nextBool(); | 656 geometry.fAntiAlias = random->nextBool(); |
653 | 657 |
654 return AADistanceFieldPathBatch::Create(geometry, color, viewMatrix, | 658 return AADistanceFieldPathBatch::Create(geometry, color, viewMatrix, |
655 gTestStruct.fAtlas, | 659 gTestStruct.fAtlas, |
656 &gTestStruct.fPathCache, | 660 &gTestStruct.fPathCache, |
657 &gTestStruct.fPathList); | 661 &gTestStruct.fPathList); |
658 } | 662 } |
659 | 663 |
660 #endif | 664 #endif |
OLD | NEW |