OLD | NEW |
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 460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
471 typedef SkPathEffect::DashInfo DashInfo; | 471 typedef SkPathEffect::DashInfo DashInfo; |
472 | 472 |
473 static GrGeometryProcessor* Create(GrColor, | 473 static GrGeometryProcessor* Create(GrColor, |
474 GrPrimitiveEdgeType edgeType, | 474 GrPrimitiveEdgeType edgeType, |
475 const DashInfo& info, | 475 const DashInfo& info, |
476 SkScalar radius, | 476 SkScalar radius, |
477 const SkMatrix& localMatrix); | 477 const SkMatrix& localMatrix); |
478 | 478 |
479 virtual ~DashingCircleEffect(); | 479 virtual ~DashingCircleEffect(); |
480 | 480 |
481 virtual const char* name() const SK_OVERRIDE { return "DashingCircleEffect";
} | 481 const char* name() const SK_OVERRIDE { return "DashingCircleEffect"; } |
482 | 482 |
483 const GrAttribute* inPosition() const { return fInPosition; } | 483 const GrAttribute* inPosition() const { return fInPosition; } |
484 | 484 |
485 const GrAttribute* inCoord() const { return fInCoord; } | 485 const GrAttribute* inCoord() const { return fInCoord; } |
486 | 486 |
487 GrPrimitiveEdgeType getEdgeType() const { return fEdgeType; } | 487 GrPrimitiveEdgeType getEdgeType() const { return fEdgeType; } |
488 | 488 |
489 SkScalar getRadius() const { return fRadius; } | 489 SkScalar getRadius() const { return fRadius; } |
490 | 490 |
491 SkScalar getCenterX() const { return fCenterX; } | 491 SkScalar getCenterX() const { return fCenterX; } |
492 | 492 |
493 SkScalar getIntervalLength() const { return fIntervalLength; } | 493 SkScalar getIntervalLength() const { return fIntervalLength; } |
494 | 494 |
495 virtual void getGLProcessorKey(const GrBatchTracker&, | 495 virtual void getGLProcessorKey(const GrBatchTracker&, |
496 const GrGLCaps&, | 496 const GrGLCaps&, |
497 GrProcessorKeyBuilder* b) const SK_OVERRIDE; | 497 GrProcessorKeyBuilder* b) const SK_OVERRIDE; |
498 | 498 |
499 virtual GrGLGeometryProcessor* createGLInstance(const GrBatchTracker&) const
SK_OVERRIDE; | 499 GrGLGeometryProcessor* createGLInstance(const GrBatchTracker&) const SK_OVER
RIDE; |
500 | 500 |
501 void initBatchTracker(GrBatchTracker* bt, const InitBT& init) const SK_OVERR
IDE; | 501 void initBatchTracker(GrBatchTracker* bt, const InitBT& init) const SK_OVERR
IDE; |
502 | 502 |
503 bool onCanMakeEqual(const GrBatchTracker&, | 503 bool onCanMakeEqual(const GrBatchTracker&, |
504 const GrGeometryProcessor&, | 504 const GrGeometryProcessor&, |
505 const GrBatchTracker&) const SK_OVERRIDE; | 505 const GrBatchTracker&) const SK_OVERRIDE; |
506 | 506 |
507 private: | 507 private: |
508 DashingCircleEffect(GrColor, GrPrimitiveEdgeType edgeType, const DashInfo& i
nfo, | 508 DashingCircleEffect(GrColor, GrPrimitiveEdgeType edgeType, const DashInfo& i
nfo, |
509 SkScalar radius, const SkMatrix& localMatrix); | 509 SkScalar radius, const SkMatrix& localMatrix); |
510 | 510 |
511 virtual bool onIsEqual(const GrGeometryProcessor& other) const SK_OVERRIDE; | 511 bool onIsEqual(const GrGeometryProcessor& other) const SK_OVERRIDE; |
512 | 512 |
513 virtual void onGetInvariantOutputCoverage(GrInitInvariantOutput*) const SK_O
VERRIDE; | 513 void onGetInvariantOutputCoverage(GrInitInvariantOutput*) const SK_OVERRIDE; |
514 | 514 |
515 GrPrimitiveEdgeType fEdgeType; | 515 GrPrimitiveEdgeType fEdgeType; |
516 const GrAttribute* fInPosition; | 516 const GrAttribute* fInPosition; |
517 const GrAttribute* fInCoord; | 517 const GrAttribute* fInCoord; |
518 SkScalar fIntervalLength; | 518 SkScalar fIntervalLength; |
519 SkScalar fRadius; | 519 SkScalar fRadius; |
520 SkScalar fCenterX; | 520 SkScalar fCenterX; |
521 | 521 |
522 GR_DECLARE_GEOMETRY_PROCESSOR_TEST; | 522 GR_DECLARE_GEOMETRY_PROCESSOR_TEST; |
523 | 523 |
524 typedef GrGeometryProcessor INHERITED; | 524 typedef GrGeometryProcessor INHERITED; |
525 }; | 525 }; |
526 | 526 |
527 ////////////////////////////////////////////////////////////////////////////// | 527 ////////////////////////////////////////////////////////////////////////////// |
528 | 528 |
529 class GLDashingCircleEffect : public GrGLGeometryProcessor { | 529 class GLDashingCircleEffect : public GrGLGeometryProcessor { |
530 public: | 530 public: |
531 GLDashingCircleEffect(const GrGeometryProcessor&, const GrBatchTracker&); | 531 GLDashingCircleEffect(const GrGeometryProcessor&, const GrBatchTracker&); |
532 | 532 |
533 virtual void emitCode(const EmitArgs&) SK_OVERRIDE; | 533 void emitCode(const EmitArgs&) SK_OVERRIDE; |
534 | 534 |
535 static inline void GenKey(const GrGeometryProcessor&, | 535 static inline void GenKey(const GrGeometryProcessor&, |
536 const GrBatchTracker&, | 536 const GrBatchTracker&, |
537 const GrGLCaps&, | 537 const GrGLCaps&, |
538 GrProcessorKeyBuilder*); | 538 GrProcessorKeyBuilder*); |
539 | 539 |
540 virtual void setData(const GrGLProgramDataManager&, | 540 virtual void setData(const GrGLProgramDataManager&, |
541 const GrPrimitiveProcessor&, | 541 const GrPrimitiveProcessor&, |
542 const GrBatchTracker&) SK_OVERRIDE; | 542 const GrBatchTracker&) SK_OVERRIDE; |
543 | 543 |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
760 typedef SkPathEffect::DashInfo DashInfo; | 760 typedef SkPathEffect::DashInfo DashInfo; |
761 | 761 |
762 static GrGeometryProcessor* Create(GrColor, | 762 static GrGeometryProcessor* Create(GrColor, |
763 GrPrimitiveEdgeType edgeType, | 763 GrPrimitiveEdgeType edgeType, |
764 const DashInfo& info, | 764 const DashInfo& info, |
765 SkScalar strokeWidth, | 765 SkScalar strokeWidth, |
766 const SkMatrix& localMatrix); | 766 const SkMatrix& localMatrix); |
767 | 767 |
768 virtual ~DashingLineEffect(); | 768 virtual ~DashingLineEffect(); |
769 | 769 |
770 virtual const char* name() const SK_OVERRIDE { return "DashingEffect"; } | 770 const char* name() const SK_OVERRIDE { return "DashingEffect"; } |
771 | 771 |
772 const GrAttribute* inPosition() const { return fInPosition; } | 772 const GrAttribute* inPosition() const { return fInPosition; } |
773 | 773 |
774 const GrAttribute* inCoord() const { return fInCoord; } | 774 const GrAttribute* inCoord() const { return fInCoord; } |
775 | 775 |
776 GrPrimitiveEdgeType getEdgeType() const { return fEdgeType; } | 776 GrPrimitiveEdgeType getEdgeType() const { return fEdgeType; } |
777 | 777 |
778 const SkRect& getRect() const { return fRect; } | 778 const SkRect& getRect() const { return fRect; } |
779 | 779 |
780 SkScalar getIntervalLength() const { return fIntervalLength; } | 780 SkScalar getIntervalLength() const { return fIntervalLength; } |
781 | 781 |
782 virtual void getGLProcessorKey(const GrBatchTracker& bt, | 782 virtual void getGLProcessorKey(const GrBatchTracker& bt, |
783 const GrGLCaps& caps, | 783 const GrGLCaps& caps, |
784 GrProcessorKeyBuilder* b) const SK_OVERRIDE; | 784 GrProcessorKeyBuilder* b) const SK_OVERRIDE; |
785 | 785 |
786 virtual GrGLGeometryProcessor* createGLInstance(const GrBatchTracker& bt) co
nst SK_OVERRIDE; | 786 GrGLGeometryProcessor* createGLInstance(const GrBatchTracker& bt) const SK_O
VERRIDE; |
787 | 787 |
788 void initBatchTracker(GrBatchTracker* bt, const InitBT& init) const SK_OVERR
IDE; | 788 void initBatchTracker(GrBatchTracker* bt, const InitBT& init) const SK_OVERR
IDE; |
789 | 789 |
790 bool onCanMakeEqual(const GrBatchTracker&, | 790 bool onCanMakeEqual(const GrBatchTracker&, |
791 const GrGeometryProcessor&, | 791 const GrGeometryProcessor&, |
792 const GrBatchTracker&) const SK_OVERRIDE; | 792 const GrBatchTracker&) const SK_OVERRIDE; |
793 | 793 |
794 private: | 794 private: |
795 DashingLineEffect(GrColor, GrPrimitiveEdgeType edgeType, const DashInfo& inf
o, | 795 DashingLineEffect(GrColor, GrPrimitiveEdgeType edgeType, const DashInfo& inf
o, |
796 SkScalar strokeWidth, const SkMatrix& localMatrix); | 796 SkScalar strokeWidth, const SkMatrix& localMatrix); |
797 | 797 |
798 virtual bool onIsEqual(const GrGeometryProcessor& other) const SK_OVERRIDE; | 798 bool onIsEqual(const GrGeometryProcessor& other) const SK_OVERRIDE; |
799 | 799 |
800 virtual void onGetInvariantOutputCoverage(GrInitInvariantOutput*) const SK_O
VERRIDE; | 800 void onGetInvariantOutputCoverage(GrInitInvariantOutput*) const SK_OVERRIDE; |
801 | 801 |
802 GrPrimitiveEdgeType fEdgeType; | 802 GrPrimitiveEdgeType fEdgeType; |
803 const GrAttribute* fInPosition; | 803 const GrAttribute* fInPosition; |
804 const GrAttribute* fInCoord; | 804 const GrAttribute* fInCoord; |
805 SkRect fRect; | 805 SkRect fRect; |
806 SkScalar fIntervalLength; | 806 SkScalar fIntervalLength; |
807 | 807 |
808 GR_DECLARE_GEOMETRY_PROCESSOR_TEST; | 808 GR_DECLARE_GEOMETRY_PROCESSOR_TEST; |
809 | 809 |
810 typedef GrGeometryProcessor INHERITED; | 810 typedef GrGeometryProcessor INHERITED; |
811 }; | 811 }; |
812 | 812 |
813 ////////////////////////////////////////////////////////////////////////////// | 813 ////////////////////////////////////////////////////////////////////////////// |
814 | 814 |
815 class GLDashingLineEffect : public GrGLGeometryProcessor { | 815 class GLDashingLineEffect : public GrGLGeometryProcessor { |
816 public: | 816 public: |
817 GLDashingLineEffect(const GrGeometryProcessor&, const GrBatchTracker&); | 817 GLDashingLineEffect(const GrGeometryProcessor&, const GrBatchTracker&); |
818 | 818 |
819 virtual void emitCode(const EmitArgs&) SK_OVERRIDE; | 819 void emitCode(const EmitArgs&) SK_OVERRIDE; |
820 | 820 |
821 static inline void GenKey(const GrGeometryProcessor&, | 821 static inline void GenKey(const GrGeometryProcessor&, |
822 const GrBatchTracker&, | 822 const GrBatchTracker&, |
823 const GrGLCaps&, | 823 const GrGLCaps&, |
824 GrProcessorKeyBuilder*); | 824 GrProcessorKeyBuilder*); |
825 | 825 |
826 virtual void setData(const GrGLProgramDataManager&, | 826 virtual void setData(const GrGLProgramDataManager&, |
827 const GrPrimitiveProcessor&, | 827 const GrPrimitiveProcessor&, |
828 const GrBatchTracker&) SK_OVERRIDE; | 828 const GrBatchTracker&) SK_OVERRIDE; |
829 | 829 |
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1049 return DashingCircleEffect::Create(color, edgeType, info, | 1049 return DashingCircleEffect::Create(color, edgeType, info, |
1050 SkScalarHalf(strokeWidth), | 1050 SkScalarHalf(strokeWidth), |
1051 localMatrix); | 1051 localMatrix); |
1052 case GrDashingEffect::kNonRound_DashCap: | 1052 case GrDashingEffect::kNonRound_DashCap: |
1053 return DashingLineEffect::Create(color, edgeType, info, strokeWidth,
localMatrix); | 1053 return DashingLineEffect::Create(color, edgeType, info, strokeWidth,
localMatrix); |
1054 default: | 1054 default: |
1055 SkFAIL("Unexpected dashed cap."); | 1055 SkFAIL("Unexpected dashed cap."); |
1056 } | 1056 } |
1057 return NULL; | 1057 return NULL; |
1058 } | 1058 } |
OLD | NEW |