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

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: 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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
565 SkScalar radius) { 566 SkScalar radius) {
566 if (info.fCount != 2 || info.fIntervals[0] != 0) { 567 if (info.fCount != 2 || info.fIntervals[0] != 0) {
567 return NULL; 568 return NULL;
568 } 569 }
569 570
570 return SkNEW_ARGS(DashingCircleEffect, (edgeType, info, radius)); 571 return SkNEW_ARGS(DashingCircleEffect, (edgeType, info, radius));
571 } 572 }
572 573
573 DashingCircleEffect::~DashingCircleEffect() {} 574 DashingCircleEffect::~DashingCircleEffect() {}
574 575
575 void DashingCircleEffect::onComputeInvariantOutput(InvariantOutput* inout) const { 576 void DashingCircleEffect::onComputeInvariantOutput(GrInvariantOutput* inout) con st {
576 inout->mulByUnknownAlpha(); 577 inout->mulByUnknownAlpha();
577 } 578 }
578 579
579 const GrBackendGeometryProcessorFactory& DashingCircleEffect::getFactory() const { 580 const GrBackendGeometryProcessorFactory& DashingCircleEffect::getFactory() const {
580 return GrTBackendGeometryProcessorFactory<DashingCircleEffect>::getInstance( ); 581 return GrTBackendGeometryProcessorFactory<DashingCircleEffect>::getInstance( );
581 } 582 }
582 583
583 DashingCircleEffect::DashingCircleEffect(GrPrimitiveEdgeType edgeType, const Das hInfo& info, 584 DashingCircleEffect::DashingCircleEffect(GrPrimitiveEdgeType edgeType, const Das hInfo& info,
584 SkScalar radius) 585 SkScalar radius)
585 : fEdgeType(edgeType) 586 : fEdgeType(edgeType)
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
656 657
657 typedef GLDashingLineEffect GLProcessor; 658 typedef GLDashingLineEffect GLProcessor;
658 659
659 virtual const GrBackendGeometryProcessorFactory& getFactory() const SK_OVERR IDE; 660 virtual const GrBackendGeometryProcessorFactory& getFactory() const SK_OVERR IDE;
660 661
661 private: 662 private:
662 DashingLineEffect(GrPrimitiveEdgeType edgeType, const DashInfo& info, SkScal ar strokeWidth); 663 DashingLineEffect(GrPrimitiveEdgeType edgeType, const DashInfo& info, SkScal ar strokeWidth);
663 664
664 virtual bool onIsEqual(const GrGeometryProcessor& other) const SK_OVERRIDE; 665 virtual bool onIsEqual(const GrGeometryProcessor& other) const SK_OVERRIDE;
665 666
666 virtual void onComputeInvariantOutput(InvariantOutput* inout) const SK_OVERR IDE; 667 virtual void onComputeInvariantOutput(GrInvariantOutput* inout) const SK_OVE RRIDE;
667 668
668 GrPrimitiveEdgeType fEdgeType; 669 GrPrimitiveEdgeType fEdgeType;
669 const GrShaderVar& fInCoord; 670 const GrShaderVar& fInCoord;
670 SkRect fRect; 671 SkRect fRect;
671 SkScalar fIntervalLength; 672 SkScalar fIntervalLength;
672 673
673 GR_DECLARE_GEOMETRY_PROCESSOR_TEST; 674 GR_DECLARE_GEOMETRY_PROCESSOR_TEST;
674 675
675 typedef GrGeometryProcessor INHERITED; 676 typedef GrGeometryProcessor INHERITED;
676 }; 677 };
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
776 SkScalar strokeWidth) { 777 SkScalar strokeWidth) {
777 if (info.fCount != 2) { 778 if (info.fCount != 2) {
778 return NULL; 779 return NULL;
779 } 780 }
780 781
781 return SkNEW_ARGS(DashingLineEffect, (edgeType, info, strokeWidth)); 782 return SkNEW_ARGS(DashingLineEffect, (edgeType, info, strokeWidth));
782 } 783 }
783 784
784 DashingLineEffect::~DashingLineEffect() {} 785 DashingLineEffect::~DashingLineEffect() {}
785 786
786 void DashingLineEffect::onComputeInvariantOutput(InvariantOutput* inout) const { 787 void DashingLineEffect::onComputeInvariantOutput(GrInvariantOutput* inout) const {
787 inout->mulByUnknownAlpha(); 788 inout->mulByUnknownAlpha();
788 } 789 }
789 790
790 const GrBackendGeometryProcessorFactory& DashingLineEffect::getFactory() const { 791 const GrBackendGeometryProcessorFactory& DashingLineEffect::getFactory() const {
791 return GrTBackendGeometryProcessorFactory<DashingLineEffect>::getInstance(); 792 return GrTBackendGeometryProcessorFactory<DashingLineEffect>::getInstance();
792 } 793 }
793 794
794 DashingLineEffect::DashingLineEffect(GrPrimitiveEdgeType edgeType, const DashInf o& info, 795 DashingLineEffect::DashingLineEffect(GrPrimitiveEdgeType edgeType, const DashInf o& info,
795 SkScalar strokeWidth) 796 SkScalar strokeWidth)
796 : fEdgeType(edgeType) 797 : fEdgeType(edgeType)
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
841 switch (cap) { 842 switch (cap) {
842 case GrDashingEffect::kRound_DashCap: 843 case GrDashingEffect::kRound_DashCap:
843 return DashingCircleEffect::Create(edgeType, info, SkScalarHalf(stro keWidth)); 844 return DashingCircleEffect::Create(edgeType, info, SkScalarHalf(stro keWidth));
844 case GrDashingEffect::kNonRound_DashCap: 845 case GrDashingEffect::kNonRound_DashCap:
845 return DashingLineEffect::Create(edgeType, info, strokeWidth); 846 return DashingLineEffect::Create(edgeType, info, strokeWidth);
846 default: 847 default:
847 SkFAIL("Unexpected dashed cap."); 848 SkFAIL("Unexpected dashed cap.");
848 } 849 }
849 return NULL; 850 return NULL;
850 } 851 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698