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

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

Issue 699943003: Move GrInvariantOutput out of GrProcessor and into its own class. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Cleanup Created 6 years, 1 month 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"
11 11
12 #include "GrGeometryProcessor.h" 12 #include "GrGeometryProcessor.h"
13 #include "gl/builders/GrGLProgramBuilder.h" 13 #include "gl/builders/GrGLProgramBuilder.h"
14 #include "gl/GrGLProcessor.h" 14 #include "gl/GrGLProcessor.h"
15 #include "gl/GrGLGeometryProcessor.h" 15 #include "gl/GrGLGeometryProcessor.h"
16 #include "gl/GrGLSL.h" 16 #include "gl/GrGLSL.h"
17 #include "GrContext.h" 17 #include "GrContext.h"
18 #include "GrCoordTransform.h" 18 #include "GrCoordTransform.h"
19 #include "GrDrawTarget.h" 19 #include "GrDrawTarget.h"
20 #include "GrDrawTargetCaps.h" 20 #include "GrDrawTargetCaps.h"
21 #include "GrInvariantOutput.h"
21 #include "GrProcessor.h" 22 #include "GrProcessor.h"
22 #include "GrGpu.h" 23 #include "GrGpu.h"
23 #include "GrStrokeInfo.h" 24 #include "GrStrokeInfo.h"
24 #include "GrTBackendProcessorFactory.h" 25 #include "GrTBackendProcessorFactory.h"
25 #include "SkGr.h" 26 #include "SkGr.h"
26 27
27 /////////////////////////////////////////////////////////////////////////////// 28 ///////////////////////////////////////////////////////////////////////////////
28 29
29 // Returns whether or not the gpu can fast path the dash line effect. 30 // Returns whether or not the gpu can fast path the dash line effect.
30 static bool can_fast_path_dash(const SkPoint pts[2], const GrStrokeInfo& strokeI nfo, 31 static bool can_fast_path_dash(const SkPoint pts[2], const GrStrokeInfo& strokeI nfo,
(...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after
456 457
457 typedef GLDashingCircleEffect GLProcessor; 458 typedef GLDashingCircleEffect GLProcessor;
458 459
459 virtual const GrBackendGeometryProcessorFactory& getFactory() const SK_OVERR IDE; 460 virtual const GrBackendGeometryProcessorFactory& getFactory() const SK_OVERR IDE;
460 461
461 private: 462 private:
462 DashingCircleEffect(GrPrimitiveEdgeType edgeType, const DashInfo& info, SkSc alar radius); 463 DashingCircleEffect(GrPrimitiveEdgeType edgeType, const DashInfo& info, SkSc alar radius);
463 464
464 virtual bool onIsEqual(const GrGeometryProcessor& other) const SK_OVERRIDE; 465 virtual bool onIsEqual(const GrGeometryProcessor& other) const SK_OVERRIDE;
465 466
466 virtual void onComputeInvariantOutput(InvariantOutput* inout) const SK_OVERR IDE; 467 virtual void onComputeInvariantOutput(GrInvariantOutput* inout) const SK_OVE RRIDE;
467 468
468 GrPrimitiveEdgeType fEdgeType; 469 GrPrimitiveEdgeType fEdgeType;
469 const GrShaderVar& fInCoord; 470 const GrShaderVar& fInCoord;
470 SkScalar fIntervalLength; 471 SkScalar fIntervalLength;
471 SkScalar fRadius; 472 SkScalar fRadius;
472 SkScalar fCenterX; 473 SkScalar fCenterX;
473 474
474 GR_DECLARE_GEOMETRY_PROCESSOR_TEST; 475 GR_DECLARE_GEOMETRY_PROCESSOR_TEST;
475 476
476 typedef GrGeometryProcessor INHERITED; 477 typedef GrGeometryProcessor INHERITED;
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
569 SkScalar radius) { 570 SkScalar radius) {
570 if (info.fCount != 2 || info.fIntervals[0] != 0) { 571 if (info.fCount != 2 || info.fIntervals[0] != 0) {
571 return NULL; 572 return NULL;
572 } 573 }
573 574
574 return SkNEW_ARGS(DashingCircleEffect, (edgeType, info, radius)); 575 return SkNEW_ARGS(DashingCircleEffect, (edgeType, info, radius));
575 } 576 }
576 577
577 DashingCircleEffect::~DashingCircleEffect() {} 578 DashingCircleEffect::~DashingCircleEffect() {}
578 579
579 void DashingCircleEffect::onComputeInvariantOutput(InvariantOutput* inout) const { 580 void DashingCircleEffect::onComputeInvariantOutput(GrInvariantOutput* inout) con st {
580 inout->mulByUnknownAlpha(); 581 inout->mulByUnknownAlpha();
581 } 582 }
582 583
583 const GrBackendGeometryProcessorFactory& DashingCircleEffect::getFactory() const { 584 const GrBackendGeometryProcessorFactory& DashingCircleEffect::getFactory() const {
584 return GrTBackendGeometryProcessorFactory<DashingCircleEffect>::getInstance( ); 585 return GrTBackendGeometryProcessorFactory<DashingCircleEffect>::getInstance( );
585 } 586 }
586 587
587 DashingCircleEffect::DashingCircleEffect(GrPrimitiveEdgeType edgeType, const Das hInfo& info, 588 DashingCircleEffect::DashingCircleEffect(GrPrimitiveEdgeType edgeType, const Das hInfo& info,
588 SkScalar radius) 589 SkScalar radius)
589 : fEdgeType(edgeType) 590 : fEdgeType(edgeType)
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
660 661
661 typedef GLDashingLineEffect GLProcessor; 662 typedef GLDashingLineEffect GLProcessor;
662 663
663 virtual const GrBackendGeometryProcessorFactory& getFactory() const SK_OVERR IDE; 664 virtual const GrBackendGeometryProcessorFactory& getFactory() const SK_OVERR IDE;
664 665
665 private: 666 private:
666 DashingLineEffect(GrPrimitiveEdgeType edgeType, const DashInfo& info, SkScal ar strokeWidth); 667 DashingLineEffect(GrPrimitiveEdgeType edgeType, const DashInfo& info, SkScal ar strokeWidth);
667 668
668 virtual bool onIsEqual(const GrGeometryProcessor& other) const SK_OVERRIDE; 669 virtual bool onIsEqual(const GrGeometryProcessor& other) const SK_OVERRIDE;
669 670
670 virtual void onComputeInvariantOutput(InvariantOutput* inout) const SK_OVERR IDE; 671 virtual void onComputeInvariantOutput(GrInvariantOutput* inout) const SK_OVE RRIDE;
671 672
672 GrPrimitiveEdgeType fEdgeType; 673 GrPrimitiveEdgeType fEdgeType;
673 const GrShaderVar& fInCoord; 674 const GrShaderVar& fInCoord;
674 SkRect fRect; 675 SkRect fRect;
675 SkScalar fIntervalLength; 676 SkScalar fIntervalLength;
676 677
677 GR_DECLARE_GEOMETRY_PROCESSOR_TEST; 678 GR_DECLARE_GEOMETRY_PROCESSOR_TEST;
678 679
679 typedef GrGeometryProcessor INHERITED; 680 typedef GrGeometryProcessor INHERITED;
680 }; 681 };
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
784 SkScalar strokeWidth) { 785 SkScalar strokeWidth) {
785 if (info.fCount != 2) { 786 if (info.fCount != 2) {
786 return NULL; 787 return NULL;
787 } 788 }
788 789
789 return SkNEW_ARGS(DashingLineEffect, (edgeType, info, strokeWidth)); 790 return SkNEW_ARGS(DashingLineEffect, (edgeType, info, strokeWidth));
790 } 791 }
791 792
792 DashingLineEffect::~DashingLineEffect() {} 793 DashingLineEffect::~DashingLineEffect() {}
793 794
794 void DashingLineEffect::onComputeInvariantOutput(InvariantOutput* inout) const { 795 void DashingLineEffect::onComputeInvariantOutput(GrInvariantOutput* inout) const {
795 inout->mulByUnknownAlpha(); 796 inout->mulByUnknownAlpha();
796 } 797 }
797 798
798 const GrBackendGeometryProcessorFactory& DashingLineEffect::getFactory() const { 799 const GrBackendGeometryProcessorFactory& DashingLineEffect::getFactory() const {
799 return GrTBackendGeometryProcessorFactory<DashingLineEffect>::getInstance(); 800 return GrTBackendGeometryProcessorFactory<DashingLineEffect>::getInstance();
800 } 801 }
801 802
802 DashingLineEffect::DashingLineEffect(GrPrimitiveEdgeType edgeType, const DashInf o& info, 803 DashingLineEffect::DashingLineEffect(GrPrimitiveEdgeType edgeType, const DashInf o& info,
803 SkScalar strokeWidth) 804 SkScalar strokeWidth)
804 : fEdgeType(edgeType) 805 : fEdgeType(edgeType)
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
849 switch (cap) { 850 switch (cap) {
850 case GrDashingEffect::kRound_DashCap: 851 case GrDashingEffect::kRound_DashCap:
851 return DashingCircleEffect::Create(edgeType, info, SkScalarHalf(stro keWidth)); 852 return DashingCircleEffect::Create(edgeType, info, SkScalarHalf(stro keWidth));
852 case GrDashingEffect::kNonRound_DashCap: 853 case GrDashingEffect::kNonRound_DashCap:
853 return DashingLineEffect::Create(edgeType, info, strokeWidth); 854 return DashingLineEffect::Create(edgeType, info, strokeWidth);
854 default: 855 default:
855 SkFAIL("Unexpected dashed cap."); 856 SkFAIL("Unexpected dashed cap.");
856 } 857 }
857 return NULL; 858 return NULL;
858 } 859 }
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