| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2012 Google Inc. | 3 * Copyright 2012 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 "GrAAConvexPathRenderer.h" | 9 #include "GrAAConvexPathRenderer.h" |
| 10 | 10 |
| (...skipping 507 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 518 * distance with negative being inside, positive outside. The edge is specified
in | 518 * distance with negative being inside, positive outside. The edge is specified
in |
| 519 * window space (y-down). If either the third or fourth component of the interpo
lated | 519 * window space (y-down). If either the third or fourth component of the interpo
lated |
| 520 * vertex coord is > 0 then the pixel is considered outside the edge. This is us
ed to | 520 * vertex coord is > 0 then the pixel is considered outside the edge. This is us
ed to |
| 521 * attempt to trim to a portion of the infinite quad. | 521 * attempt to trim to a portion of the infinite quad. |
| 522 * Requires shader derivative instruction support. | 522 * Requires shader derivative instruction support. |
| 523 */ | 523 */ |
| 524 | 524 |
| 525 class QuadEdgeEffect : public GrGeometryProcessor { | 525 class QuadEdgeEffect : public GrGeometryProcessor { |
| 526 public: | 526 public: |
| 527 | 527 |
| 528 static GrGeometryProcessor* Create(GrColor color, const SkMatrix& localMatri
x, | 528 static GrGeometryProcessor* Create(GrColor color, const SkMatrix& localMatri
x) { |
| 529 bool usesLocalCoords) { | 529 return SkNEW_ARGS(QuadEdgeEffect, (color, localMatrix)); |
| 530 return SkNEW_ARGS(QuadEdgeEffect, (color, localMatrix, usesLocalCoords))
; | |
| 531 } | 530 } |
| 532 | 531 |
| 533 virtual ~QuadEdgeEffect() {} | 532 virtual ~QuadEdgeEffect() {} |
| 534 | 533 |
| 535 const char* name() const override { return "QuadEdge"; } | 534 const char* name() const override { return "QuadEdge"; } |
| 536 | 535 |
| 537 const Attribute* inPosition() const { return fInPosition; } | 536 const Attribute* inPosition() const { return fInPosition; } |
| 538 const Attribute* inQuadEdge() const { return fInQuadEdge; } | 537 const Attribute* inQuadEdge() const { return fInQuadEdge; } |
| 539 GrColor color() const { return fColor; } | 538 GrColor color() const { return fColor; } |
| 540 bool colorIgnored() const { return GrColor_ILLEGAL == fColor; } | |
| 541 const SkMatrix& localMatrix() const { return fLocalMatrix; } | 539 const SkMatrix& localMatrix() const { return fLocalMatrix; } |
| 542 bool usesLocalCoords() const { return fUsesLocalCoords; } | |
| 543 | 540 |
| 544 class GLProcessor : public GrGLGeometryProcessor { | 541 class GLProcessor : public GrGLGeometryProcessor { |
| 545 public: | 542 public: |
| 546 GLProcessor(const GrGeometryProcessor&, | 543 GLProcessor(const GrGeometryProcessor&, |
| 547 const GrBatchTracker&) | 544 const GrBatchTracker&) |
| 548 : fColor(GrColor_ILLEGAL) {} | 545 : fColor(GrColor_ILLEGAL) {} |
| 549 | 546 |
| 550 void onEmitCode(EmitArgs& args, GrGPArgs* gpArgs) override { | 547 void onEmitCode(EmitArgs& args, GrGPArgs* gpArgs) override { |
| 551 const QuadEdgeEffect& qe = args.fGP.cast<QuadEdgeEffect>(); | 548 const QuadEdgeEffect& qe = args.fGP.cast<QuadEdgeEffect>(); |
| 552 GrGLGPBuilder* pb = args.fPB; | 549 GrGLGPBuilder* pb = args.fPB; |
| 553 GrGLVertexBuilder* vsBuilder = pb->getVertexShaderBuilder(); | 550 GrGLVertexBuilder* vsBuilder = pb->getVertexShaderBuilder(); |
| 554 | 551 |
| 555 // emit attributes | 552 // emit attributes |
| 556 vsBuilder->emitAttributes(qe); | 553 vsBuilder->emitAttributes(qe); |
| 557 | 554 |
| 558 GrGLVertToFrag v(kVec4f_GrSLType); | 555 GrGLVertToFrag v(kVec4f_GrSLType); |
| 559 args.fPB->addVarying("QuadEdge", &v); | 556 args.fPB->addVarying("QuadEdge", &v); |
| 560 vsBuilder->codeAppendf("%s = %s;", v.vsOut(), qe.inQuadEdge()->fName
); | 557 vsBuilder->codeAppendf("%s = %s;", v.vsOut(), qe.inQuadEdge()->fName
); |
| 561 | 558 |
| 559 const BatchTracker& local = args.fBT.cast<BatchTracker>(); |
| 560 |
| 562 // Setup pass through color | 561 // Setup pass through color |
| 563 if (!qe.colorIgnored()) { | 562 this->setupColorPassThrough(pb, local.fInputColorType, args.fOutputC
olor, NULL, |
| 564 this->setupUniformColor(pb, args.fOutputColor, &fColorUniform); | 563 &fColorUniform); |
| 565 } | |
| 566 | 564 |
| 567 // Setup position | 565 // Setup position |
| 568 this->setupPosition(pb, gpArgs, qe.inPosition()->fName); | 566 this->setupPosition(pb, gpArgs, qe.inPosition()->fName); |
| 569 | 567 |
| 570 // emit transforms | 568 // emit transforms |
| 571 this->emitTransforms(args.fPB, gpArgs->fPositionVar, qe.inPosition()
->fName, | 569 this->emitTransforms(args.fPB, gpArgs->fPositionVar, qe.inPosition()
->fName, |
| 572 qe.localMatrix(), args.fTransformsIn, args.fTra
nsformsOut); | 570 qe.localMatrix(), args.fTransformsIn, args.fTra
nsformsOut); |
| 573 | 571 |
| 574 GrGLFragmentBuilder* fsBuilder = args.fPB->getFragmentShaderBuilder(
); | 572 GrGLFragmentBuilder* fsBuilder = args.fPB->getFragmentShaderBuilder(
); |
| 575 | 573 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 593 fsBuilder->codeAppendf("edgeAlpha = " | 591 fsBuilder->codeAppendf("edgeAlpha = " |
| 594 "clamp(0.5 - edgeAlpha / length(gF), 0.0, 1.0
);}"); | 592 "clamp(0.5 - edgeAlpha / length(gF), 0.0, 1.0
);}"); |
| 595 | 593 |
| 596 fsBuilder->codeAppendf("%s = vec4(edgeAlpha);", args.fOutputCoverage
); | 594 fsBuilder->codeAppendf("%s = vec4(edgeAlpha);", args.fOutputCoverage
); |
| 597 } | 595 } |
| 598 | 596 |
| 599 static inline void GenKey(const GrGeometryProcessor& gp, | 597 static inline void GenKey(const GrGeometryProcessor& gp, |
| 600 const GrBatchTracker& bt, | 598 const GrBatchTracker& bt, |
| 601 const GrGLSLCaps&, | 599 const GrGLSLCaps&, |
| 602 GrProcessorKeyBuilder* b) { | 600 GrProcessorKeyBuilder* b) { |
| 601 const BatchTracker& local = bt.cast<BatchTracker>(); |
| 603 const QuadEdgeEffect& qee = gp.cast<QuadEdgeEffect>(); | 602 const QuadEdgeEffect& qee = gp.cast<QuadEdgeEffect>(); |
| 604 uint32_t key = 0; | 603 uint32_t key = local.fInputColorType << 16; |
| 605 key |= qee.usesLocalCoords() && qee.localMatrix().hasPerspective() ?
0x1 : 0x0; | 604 key |= local.fUsesLocalCoords && qee.localMatrix().hasPerspective()
? 0x1 : 0x0; |
| 606 key |= qee.colorIgnored() ? 0x2 : 0x0; | |
| 607 b->add32(key); | 605 b->add32(key); |
| 608 } | 606 } |
| 609 | 607 |
| 610 virtual void setData(const GrGLProgramDataManager& pdman, | 608 virtual void setData(const GrGLProgramDataManager& pdman, |
| 611 const GrPrimitiveProcessor& gp, | 609 const GrPrimitiveProcessor& gp, |
| 612 const GrBatchTracker& bt) override { | 610 const GrBatchTracker& bt) override { |
| 613 const QuadEdgeEffect& qe = gp.cast<QuadEdgeEffect>(); | 611 const BatchTracker& local = bt.cast<BatchTracker>(); |
| 614 if (qe.color() != fColor) { | 612 if (kUniform_GrGPInput == local.fInputColorType && local.fColor != f
Color) { |
| 615 GrGLfloat c[4]; | 613 GrGLfloat c[4]; |
| 616 GrColorToRGBAFloat(qe.color(), c); | 614 GrColorToRGBAFloat(local.fColor, c); |
| 617 pdman.set4fv(fColorUniform, 1, c); | 615 pdman.set4fv(fColorUniform, 1, c); |
| 618 fColor = qe.color(); | 616 fColor = local.fColor; |
| 619 } | 617 } |
| 620 } | 618 } |
| 621 | 619 |
| 622 void setTransformData(const GrPrimitiveProcessor& primProc, | 620 void setTransformData(const GrPrimitiveProcessor& primProc, |
| 623 const GrGLProgramDataManager& pdman, | 621 const GrGLProgramDataManager& pdman, |
| 624 int index, | 622 int index, |
| 625 const SkTArray<const GrCoordTransform*, true>& tra
nsforms) override { | 623 const SkTArray<const GrCoordTransform*, true>& tra
nsforms) override { |
| 626 this->setTransformDataHelper<QuadEdgeEffect>(primProc, pdman, index,
transforms); | 624 this->setTransformDataHelper<QuadEdgeEffect>(primProc, pdman, index,
transforms); |
| 627 } | 625 } |
| 628 | 626 |
| 629 private: | 627 private: |
| 630 GrColor fColor; | 628 GrColor fColor; |
| 631 UniformHandle fColorUniform; | 629 UniformHandle fColorUniform; |
| 632 | 630 |
| 633 typedef GrGLGeometryProcessor INHERITED; | 631 typedef GrGLGeometryProcessor INHERITED; |
| 634 }; | 632 }; |
| 635 | 633 |
| 636 virtual void getGLProcessorKey(const GrBatchTracker& bt, | 634 virtual void getGLProcessorKey(const GrBatchTracker& bt, |
| 637 const GrGLSLCaps& caps, | 635 const GrGLSLCaps& caps, |
| 638 GrProcessorKeyBuilder* b) const override { | 636 GrProcessorKeyBuilder* b) const override { |
| 639 GLProcessor::GenKey(*this, bt, caps, b); | 637 GLProcessor::GenKey(*this, bt, caps, b); |
| 640 } | 638 } |
| 641 | 639 |
| 642 virtual GrGLPrimitiveProcessor* createGLInstance(const GrBatchTracker& bt, | 640 virtual GrGLPrimitiveProcessor* createGLInstance(const GrBatchTracker& bt, |
| 643 const GrGLSLCaps&) const ov
erride { | 641 const GrGLSLCaps&) const ov
erride { |
| 644 return SkNEW_ARGS(GLProcessor, (*this, bt)); | 642 return SkNEW_ARGS(GLProcessor, (*this, bt)); |
| 645 } | 643 } |
| 646 | 644 |
| 645 void initBatchTracker(GrBatchTracker* bt, const GrPipelineInfo& init) const
override { |
| 646 BatchTracker* local = bt->cast<BatchTracker>(); |
| 647 local->fInputColorType = GetColorInputType(&local->fColor, this->color()
, init, false); |
| 648 local->fUsesLocalCoords = init.fUsesLocalCoords; |
| 649 } |
| 650 |
| 647 private: | 651 private: |
| 648 QuadEdgeEffect(GrColor color, const SkMatrix& localMatrix, bool usesLocalCoo
rds) | 652 QuadEdgeEffect(GrColor color, const SkMatrix& localMatrix) |
| 649 : fColor(color) | 653 : fColor(color) |
| 650 , fLocalMatrix(localMatrix) | 654 , fLocalMatrix(localMatrix) { |
| 651 , fUsesLocalCoords(usesLocalCoords) { | |
| 652 this->initClassID<QuadEdgeEffect>(); | 655 this->initClassID<QuadEdgeEffect>(); |
| 653 fInPosition = &this->addVertexAttrib(Attribute("inPosition", kVec2f_GrVe
rtexAttribType)); | 656 fInPosition = &this->addVertexAttrib(Attribute("inPosition", kVec2f_GrVe
rtexAttribType)); |
| 654 fInQuadEdge = &this->addVertexAttrib(Attribute("inQuadEdge", kVec4f_GrVe
rtexAttribType)); | 657 fInQuadEdge = &this->addVertexAttrib(Attribute("inQuadEdge", kVec4f_GrVe
rtexAttribType)); |
| 655 } | 658 } |
| 656 | 659 |
| 660 struct BatchTracker { |
| 661 GrGPInput fInputColorType; |
| 662 GrColor fColor; |
| 663 bool fUsesLocalCoords; |
| 664 }; |
| 665 |
| 657 const Attribute* fInPosition; | 666 const Attribute* fInPosition; |
| 658 const Attribute* fInQuadEdge; | 667 const Attribute* fInQuadEdge; |
| 659 GrColor fColor; | 668 GrColor fColor; |
| 660 SkMatrix fLocalMatrix; | 669 SkMatrix fLocalMatrix; |
| 661 bool fUsesLocalCoords; | |
| 662 | 670 |
| 663 GR_DECLARE_GEOMETRY_PROCESSOR_TEST; | 671 GR_DECLARE_GEOMETRY_PROCESSOR_TEST; |
| 664 | 672 |
| 665 typedef GrGeometryProcessor INHERITED; | 673 typedef GrGeometryProcessor INHERITED; |
| 666 }; | 674 }; |
| 667 | 675 |
| 668 GR_DEFINE_GEOMETRY_PROCESSOR_TEST(QuadEdgeEffect); | 676 GR_DEFINE_GEOMETRY_PROCESSOR_TEST(QuadEdgeEffect); |
| 669 | 677 |
| 670 GrGeometryProcessor* QuadEdgeEffect::TestCreate(SkRandom* random, | 678 GrGeometryProcessor* QuadEdgeEffect::TestCreate(SkRandom* random, |
| 671 GrContext*, | 679 GrContext*, |
| 672 const GrDrawTargetCaps& caps, | 680 const GrDrawTargetCaps& caps, |
| 673 GrTexture*[]) { | 681 GrTexture*[]) { |
| 674 // Doesn't work without derivative instructions. | 682 // Doesn't work without derivative instructions. |
| 675 return caps.shaderCaps()->shaderDerivativeSupport() ? | 683 return caps.shaderCaps()->shaderDerivativeSupport() ? |
| 676 QuadEdgeEffect::Create(GrRandomColor(random), | 684 QuadEdgeEffect::Create(GrRandomColor(random), |
| 677 GrTest::TestMatrix(random), | 685 GrTest::TestMatrix(random)) : NULL; |
| 678 random->nextBool()) : NULL; | |
| 679 } | 686 } |
| 680 | 687 |
| 681 /////////////////////////////////////////////////////////////////////////////// | 688 /////////////////////////////////////////////////////////////////////////////// |
| 682 | 689 |
| 683 bool GrAAConvexPathRenderer::canDrawPath(const GrDrawTarget* target, | 690 bool GrAAConvexPathRenderer::canDrawPath(const GrDrawTarget* target, |
| 684 const GrPipelineBuilder*, | 691 const GrPipelineBuilder*, |
| 685 const SkMatrix& viewMatrix, | 692 const SkMatrix& viewMatrix, |
| 686 const SkPath& path, | 693 const SkPath& path, |
| 687 const GrStrokeInfo& stroke, | 694 const GrStrokeInfo& stroke, |
| 688 bool antiAlias) const { | 695 bool antiAlias) const { |
| (...skipping 29 matching lines...) Expand all Loading... |
| 718 tess.depth(i
) + 0.5f; | 725 tess.depth(i
) + 0.5f; |
| 719 } | 726 } |
| 720 } | 727 } |
| 721 | 728 |
| 722 for (int i = 0; i < tess.numIndices(); ++i) { | 729 for (int i = 0; i < tess.numIndices(); ++i) { |
| 723 idxs[i] = tess.index(i); | 730 idxs[i] = tess.index(i); |
| 724 } | 731 } |
| 725 } | 732 } |
| 726 | 733 |
| 727 static const GrGeometryProcessor* create_fill_gp(bool tweakAlphaForCoverage, | 734 static const GrGeometryProcessor* create_fill_gp(bool tweakAlphaForCoverage, |
| 728 const SkMatrix& localMatrix, | 735 const SkMatrix& localMatrix) { |
| 729 bool usesLocalCoords, | |
| 730 bool coverageIgnored) { | |
| 731 uint32_t flags = GrDefaultGeoProcFactory::kColor_GPType; | 736 uint32_t flags = GrDefaultGeoProcFactory::kColor_GPType; |
| 732 if (!tweakAlphaForCoverage) { | 737 if (!tweakAlphaForCoverage) { |
| 733 flags |= GrDefaultGeoProcFactory::kCoverage_GPType; | 738 flags |= GrDefaultGeoProcFactory::kCoverage_GPType; |
| 734 } | 739 } |
| 735 | 740 |
| 736 return GrDefaultGeoProcFactory::Create(flags, GrColor_WHITE, usesLocalCoords
, coverageIgnored, | 741 return GrDefaultGeoProcFactory::Create(flags, GrColor_WHITE, SkMatrix::I(),
localMatrix); |
| 737 SkMatrix::I(), localMatrix); | |
| 738 } | 742 } |
| 739 | 743 |
| 740 class AAConvexPathBatch : public GrBatch { | 744 class AAConvexPathBatch : public GrBatch { |
| 741 public: | 745 public: |
| 742 struct Geometry { | 746 struct Geometry { |
| 743 GrColor fColor; | 747 GrColor fColor; |
| 744 SkMatrix fViewMatrix; | 748 SkMatrix fViewMatrix; |
| 745 SkPath fPath; | 749 SkPath fPath; |
| 746 }; | 750 }; |
| 747 | 751 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 780 bool canTweakAlphaForCoverage = this->canTweakAlphaForCoverage(); | 784 bool canTweakAlphaForCoverage = this->canTweakAlphaForCoverage(); |
| 781 | 785 |
| 782 SkMatrix invert; | 786 SkMatrix invert; |
| 783 if (this->usesLocalCoords() && !this->viewMatrix().invert(&invert)) { | 787 if (this->usesLocalCoords() && !this->viewMatrix().invert(&invert)) { |
| 784 SkDebugf("Could not invert viewmatrix\n"); | 788 SkDebugf("Could not invert viewmatrix\n"); |
| 785 return; | 789 return; |
| 786 } | 790 } |
| 787 | 791 |
| 788 // Setup GrGeometryProcessor | 792 // Setup GrGeometryProcessor |
| 789 SkAutoTUnref<const GrGeometryProcessor> gp( | 793 SkAutoTUnref<const GrGeometryProcessor> gp( |
| 790 create_fill_gp(canTweakAlphaForC
overage, invert, | 794 create_fill_gp(canTweakAlphaForC
overage, invert)); |
| 791 this->usesLocalCo
ords(), | |
| 792 this->coverageIgn
ored())); | |
| 793 | 795 |
| 794 batchTarget->initDraw(gp, pipeline); | 796 batchTarget->initDraw(gp, pipeline); |
| 795 | 797 |
| 798 // TODO remove this when batch is everywhere |
| 799 GrPipelineInfo init; |
| 800 init.fColorIgnored = fBatch.fColorIgnored; |
| 801 init.fOverrideColor = GrColor_ILLEGAL; |
| 802 init.fCoverageIgnored = fBatch.fCoverageIgnored; |
| 803 init.fUsesLocalCoords = this->usesLocalCoords(); |
| 804 gp->initBatchTracker(batchTarget->currentBatchTracker(), init); |
| 805 |
| 796 size_t vertexStride = gp->getVertexStride(); | 806 size_t vertexStride = gp->getVertexStride(); |
| 797 | 807 |
| 798 SkASSERT(canTweakAlphaForCoverage ? | 808 SkASSERT(canTweakAlphaForCoverage ? |
| 799 vertexStride == sizeof(GrDefaultGeoProcFactory::PositionColorAt
tr) : | 809 vertexStride == sizeof(GrDefaultGeoProcFactory::PositionColorAt
tr) : |
| 800 vertexStride == sizeof(GrDefaultGeoProcFactory::PositionColorCo
verageAttr)); | 810 vertexStride == sizeof(GrDefaultGeoProcFactory::PositionColorCo
verageAttr)); |
| 801 | 811 |
| 802 GrAAConvexTessellator tess; | 812 GrAAConvexTessellator tess; |
| 803 | 813 |
| 804 int instanceCount = fGeoData.count(); | 814 int instanceCount = fGeoData.count(); |
| 805 | 815 |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 853 | 863 |
| 854 int instanceCount = fGeoData.count(); | 864 int instanceCount = fGeoData.count(); |
| 855 | 865 |
| 856 SkMatrix invert; | 866 SkMatrix invert; |
| 857 if (this->usesLocalCoords() && !this->viewMatrix().invert(&invert)) { | 867 if (this->usesLocalCoords() && !this->viewMatrix().invert(&invert)) { |
| 858 SkDebugf("Could not invert viewmatrix\n"); | 868 SkDebugf("Could not invert viewmatrix\n"); |
| 859 return; | 869 return; |
| 860 } | 870 } |
| 861 | 871 |
| 862 // Setup GrGeometryProcessor | 872 // Setup GrGeometryProcessor |
| 863 SkAutoTUnref<GrGeometryProcessor> quadProcessor( | 873 SkAutoTUnref<GrGeometryProcessor> quadProcessor(QuadEdgeEffect::Create(t
his->color(), |
| 864 QuadEdgeEffect::Create(this->color(), invert, this->usesLocalCoo
rds())); | 874 i
nvert)); |
| 865 | 875 |
| 866 batchTarget->initDraw(quadProcessor, pipeline); | 876 batchTarget->initDraw(quadProcessor, pipeline); |
| 867 | 877 |
| 878 // TODO remove this when batch is everywhere |
| 879 GrPipelineInfo init; |
| 880 init.fColorIgnored = fBatch.fColorIgnored; |
| 881 init.fOverrideColor = GrColor_ILLEGAL; |
| 882 init.fCoverageIgnored = fBatch.fCoverageIgnored; |
| 883 init.fUsesLocalCoords = this->usesLocalCoords(); |
| 884 quadProcessor->initBatchTracker(batchTarget->currentBatchTracker(), init
); |
| 885 |
| 868 // TODO generate all segments for all paths and use one vertex buffer | 886 // TODO generate all segments for all paths and use one vertex buffer |
| 869 for (int i = 0; i < instanceCount; i++) { | 887 for (int i = 0; i < instanceCount; i++) { |
| 870 Geometry& args = fGeoData[i]; | 888 Geometry& args = fGeoData[i]; |
| 871 | 889 |
| 872 // We use the fact that SkPath::transform path does subdivision base
d on | 890 // We use the fact that SkPath::transform path does subdivision base
d on |
| 873 // perspective. Otherwise, we apply the view matrix when copying to
the | 891 // perspective. Otherwise, we apply the view matrix when copying to
the |
| 874 // segment representation. | 892 // segment representation. |
| 875 const SkMatrix* viewMatrix = &args.fViewMatrix; | 893 const SkMatrix* viewMatrix = &args.fViewMatrix; |
| 876 if (viewMatrix->hasPerspective()) { | 894 if (viewMatrix->hasPerspective()) { |
| 877 args.fPath.transform(*viewMatrix); | 895 args.fPath.transform(*viewMatrix); |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 966 fGeoData.push_back_n(that->geoData()->count(), that->geoData()->begin())
; | 984 fGeoData.push_back_n(that->geoData()->count(), that->geoData()->begin())
; |
| 967 this->joinBounds(that->bounds()); | 985 this->joinBounds(that->bounds()); |
| 968 return true; | 986 return true; |
| 969 } | 987 } |
| 970 | 988 |
| 971 GrColor color() const { return fBatch.fColor; } | 989 GrColor color() const { return fBatch.fColor; } |
| 972 bool linesOnly() const { return fBatch.fLinesOnly; } | 990 bool linesOnly() const { return fBatch.fLinesOnly; } |
| 973 bool usesLocalCoords() const { return fBatch.fUsesLocalCoords; } | 991 bool usesLocalCoords() const { return fBatch.fUsesLocalCoords; } |
| 974 bool canTweakAlphaForCoverage() const { return fBatch.fCanTweakAlphaForCover
age; } | 992 bool canTweakAlphaForCoverage() const { return fBatch.fCanTweakAlphaForCover
age; } |
| 975 const SkMatrix& viewMatrix() const { return fGeoData[0].fViewMatrix; } | 993 const SkMatrix& viewMatrix() const { return fGeoData[0].fViewMatrix; } |
| 976 bool coverageIgnored() const { return fBatch.fCoverageIgnored; } | |
| 977 | 994 |
| 978 struct BatchTracker { | 995 struct BatchTracker { |
| 979 GrColor fColor; | 996 GrColor fColor; |
| 980 bool fUsesLocalCoords; | 997 bool fUsesLocalCoords; |
| 981 bool fColorIgnored; | 998 bool fColorIgnored; |
| 982 bool fCoverageIgnored; | 999 bool fCoverageIgnored; |
| 983 bool fLinesOnly; | 1000 bool fLinesOnly; |
| 984 bool fCanTweakAlphaForCoverage; | 1001 bool fCanTweakAlphaForCoverage; |
| 985 }; | 1002 }; |
| 986 | 1003 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1018 BATCH_TEST_DEFINE(AAConvexPathBatch) { | 1035 BATCH_TEST_DEFINE(AAConvexPathBatch) { |
| 1019 AAConvexPathBatch::Geometry geometry; | 1036 AAConvexPathBatch::Geometry geometry; |
| 1020 geometry.fColor = GrRandomColor(random); | 1037 geometry.fColor = GrRandomColor(random); |
| 1021 geometry.fViewMatrix = GrTest::TestMatrixInvertible(random); | 1038 geometry.fViewMatrix = GrTest::TestMatrixInvertible(random); |
| 1022 geometry.fPath = GrTest::TestPathConvex(random); | 1039 geometry.fPath = GrTest::TestPathConvex(random); |
| 1023 | 1040 |
| 1024 return AAConvexPathBatch::Create(geometry); | 1041 return AAConvexPathBatch::Create(geometry); |
| 1025 } | 1042 } |
| 1026 | 1043 |
| 1027 #endif | 1044 #endif |
| OLD | NEW |