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