Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(100)

Side by Side Diff: src/gpu/effects/GrDashingEffect.cpp

Issue 608253002: Add isSingleComponent bool to getConstantColorComponent (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix isSolidWhite Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright 2014 Google Inc. 2 * Copyright 2014 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "GrDashingEffect.h" 8 #include "GrDashingEffect.h"
9 9
10 #include "../GrAARectRenderer.h" 10 #include "../GrAARectRenderer.h"
(...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after
449 GrPrimitiveEdgeType getEdgeType() const { return fEdgeType; } 449 GrPrimitiveEdgeType getEdgeType() const { return fEdgeType; }
450 450
451 SkScalar getRadius() const { return fRadius; } 451 SkScalar getRadius() const { return fRadius; }
452 452
453 SkScalar getCenterX() const { return fCenterX; } 453 SkScalar getCenterX() const { return fCenterX; }
454 454
455 SkScalar getIntervalLength() const { return fIntervalLength; } 455 SkScalar getIntervalLength() const { return fIntervalLength; }
456 456
457 typedef GLDashingCircleEffect GLProcessor; 457 typedef GLDashingCircleEffect GLProcessor;
458 458
459 virtual void getConstantColorComponents(GrColor* color, uint32_t* validFlags ) const SK_OVERRIDE;
460
461 virtual const GrBackendGeometryProcessorFactory& getFactory() const SK_OVERR IDE; 459 virtual const GrBackendGeometryProcessorFactory& getFactory() const SK_OVERR IDE;
462 460
463 private: 461 private:
464 DashingCircleEffect(GrPrimitiveEdgeType edgeType, const DashInfo& info, SkSc alar radius); 462 DashingCircleEffect(GrPrimitiveEdgeType edgeType, const DashInfo& info, SkSc alar radius);
465 463
466 virtual bool onIsEqual(const GrProcessor& other) const SK_OVERRIDE; 464 virtual bool onIsEqual(const GrProcessor& other) const SK_OVERRIDE;
467 465
466 virtual void onComputeInvariantOutput(InvariantOutput* inout) const SK_OVERR IDE;
467
468 GrPrimitiveEdgeType fEdgeType; 468 GrPrimitiveEdgeType fEdgeType;
469 const GrShaderVar& fInCoord; 469 const GrShaderVar& fInCoord;
470 SkScalar fIntervalLength; 470 SkScalar fIntervalLength;
471 SkScalar fRadius; 471 SkScalar fRadius;
472 SkScalar fCenterX; 472 SkScalar fCenterX;
473 473
474 GR_DECLARE_GEOMETRY_PROCESSOR_TEST; 474 GR_DECLARE_GEOMETRY_PROCESSOR_TEST;
475 475
476 typedef GrGeometryProcessor INHERITED; 476 typedef GrGeometryProcessor INHERITED;
477 }; 477 };
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
577 SkScalar radius) { 577 SkScalar radius) {
578 if (info.fCount != 2 || info.fIntervals[0] != 0) { 578 if (info.fCount != 2 || info.fIntervals[0] != 0) {
579 return NULL; 579 return NULL;
580 } 580 }
581 581
582 return SkNEW_ARGS(DashingCircleEffect, (edgeType, info, radius)); 582 return SkNEW_ARGS(DashingCircleEffect, (edgeType, info, radius));
583 } 583 }
584 584
585 DashingCircleEffect::~DashingCircleEffect() {} 585 DashingCircleEffect::~DashingCircleEffect() {}
586 586
587 void DashingCircleEffect::getConstantColorComponents(GrColor* color, uint32_t* v alidFlags) const { 587 void DashingCircleEffect::onComputeInvariantOutput(InvariantOutput* inout) const {
588 *validFlags = 0; 588 inout->fValidFlags = 0;
589 inout->fIsSingleComponent = false;
589 } 590 }
590 591
591 const GrBackendGeometryProcessorFactory& DashingCircleEffect::getFactory() const { 592 const GrBackendGeometryProcessorFactory& DashingCircleEffect::getFactory() const {
592 return GrTBackendGeometryProcessorFactory<DashingCircleEffect>::getInstance( ); 593 return GrTBackendGeometryProcessorFactory<DashingCircleEffect>::getInstance( );
593 } 594 }
594 595
595 DashingCircleEffect::DashingCircleEffect(GrPrimitiveEdgeType edgeType, const Das hInfo& info, 596 DashingCircleEffect::DashingCircleEffect(GrPrimitiveEdgeType edgeType, const Das hInfo& info,
596 SkScalar radius) 597 SkScalar radius)
597 : fEdgeType(edgeType) 598 : fEdgeType(edgeType)
598 , fInCoord(this->addVertexAttrib(GrShaderVar("inCoord", 599 , fInCoord(this->addVertexAttrib(GrShaderVar("inCoord",
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
661 const GrShaderVar& inCoord() const { return fInCoord; } 662 const GrShaderVar& inCoord() const { return fInCoord; }
662 663
663 GrPrimitiveEdgeType getEdgeType() const { return fEdgeType; } 664 GrPrimitiveEdgeType getEdgeType() const { return fEdgeType; }
664 665
665 const SkRect& getRect() const { return fRect; } 666 const SkRect& getRect() const { return fRect; }
666 667
667 SkScalar getIntervalLength() const { return fIntervalLength; } 668 SkScalar getIntervalLength() const { return fIntervalLength; }
668 669
669 typedef GLDashingLineEffect GLProcessor; 670 typedef GLDashingLineEffect GLProcessor;
670 671
671 virtual void getConstantColorComponents(GrColor* color, uint32_t* validFlags ) const SK_OVERRIDE;
672
673 virtual const GrBackendGeometryProcessorFactory& getFactory() const SK_OVERR IDE; 672 virtual const GrBackendGeometryProcessorFactory& getFactory() const SK_OVERR IDE;
674 673
675 private: 674 private:
676 DashingLineEffect(GrPrimitiveEdgeType edgeType, const DashInfo& info, SkScal ar strokeWidth); 675 DashingLineEffect(GrPrimitiveEdgeType edgeType, const DashInfo& info, SkScal ar strokeWidth);
677 676
678 virtual bool onIsEqual(const GrProcessor& other) const SK_OVERRIDE; 677 virtual bool onIsEqual(const GrProcessor& other) const SK_OVERRIDE;
679 678
679 virtual void onComputeInvariantOutput(InvariantOutput* inout) const SK_OVERR IDE;
680
680 GrPrimitiveEdgeType fEdgeType; 681 GrPrimitiveEdgeType fEdgeType;
681 const GrShaderVar& fInCoord; 682 const GrShaderVar& fInCoord;
682 SkRect fRect; 683 SkRect fRect;
683 SkScalar fIntervalLength; 684 SkScalar fIntervalLength;
684 685
685 GR_DECLARE_GEOMETRY_PROCESSOR_TEST; 686 GR_DECLARE_GEOMETRY_PROCESSOR_TEST;
686 687
687 typedef GrGeometryProcessor INHERITED; 688 typedef GrGeometryProcessor INHERITED;
688 }; 689 };
689 690
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
800 SkScalar strokeWidth) { 801 SkScalar strokeWidth) {
801 if (info.fCount != 2) { 802 if (info.fCount != 2) {
802 return NULL; 803 return NULL;
803 } 804 }
804 805
805 return SkNEW_ARGS(DashingLineEffect, (edgeType, info, strokeWidth)); 806 return SkNEW_ARGS(DashingLineEffect, (edgeType, info, strokeWidth));
806 } 807 }
807 808
808 DashingLineEffect::~DashingLineEffect() {} 809 DashingLineEffect::~DashingLineEffect() {}
809 810
810 void DashingLineEffect::getConstantColorComponents(GrColor* color, uint32_t* val idFlags) const { 811 void DashingLineEffect::onComputeInvariantOutput(InvariantOutput* inout) const {
811 *validFlags = 0; 812 inout->fValidFlags = 0;
813 inout->fIsSingleComponent = false;
812 } 814 }
813 815
814 const GrBackendGeometryProcessorFactory& DashingLineEffect::getFactory() const { 816 const GrBackendGeometryProcessorFactory& DashingLineEffect::getFactory() const {
815 return GrTBackendGeometryProcessorFactory<DashingLineEffect>::getInstance(); 817 return GrTBackendGeometryProcessorFactory<DashingLineEffect>::getInstance();
816 } 818 }
817 819
818 DashingLineEffect::DashingLineEffect(GrPrimitiveEdgeType edgeType, const DashInf o& info, 820 DashingLineEffect::DashingLineEffect(GrPrimitiveEdgeType edgeType, const DashInf o& info,
819 SkScalar strokeWidth) 821 SkScalar strokeWidth)
820 : fEdgeType(edgeType) 822 : fEdgeType(edgeType)
821 , fInCoord(this->addVertexAttrib(GrShaderVar("inCoord", 823 , fInCoord(this->addVertexAttrib(GrShaderVar("inCoord",
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
865 switch (cap) { 867 switch (cap) {
866 case GrDashingEffect::kRound_DashCap: 868 case GrDashingEffect::kRound_DashCap:
867 return DashingCircleEffect::Create(edgeType, info, SkScalarHalf(stro keWidth)); 869 return DashingCircleEffect::Create(edgeType, info, SkScalarHalf(stro keWidth));
868 case GrDashingEffect::kNonRound_DashCap: 870 case GrDashingEffect::kNonRound_DashCap:
869 return DashingLineEffect::Create(edgeType, info, strokeWidth); 871 return DashingLineEffect::Create(edgeType, info, strokeWidth);
870 default: 872 default:
871 SkFAIL("Unexpected dashed cap."); 873 SkFAIL("Unexpected dashed cap.");
872 } 874 }
873 return NULL; 875 return NULL;
874 } 876 }
OLDNEW
« no previous file with comments | « src/gpu/effects/GrCustomCoordsTextureEffect.cpp ('k') | src/gpu/effects/GrDistanceFieldTextureEffect.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698