| 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 483 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 494 | 494 | 
| 495     SkScalar getIntervalLength() const { return fIntervalLength; } | 495     SkScalar getIntervalLength() const { return fIntervalLength; } | 
| 496 | 496 | 
| 497     virtual void getGLProcessorKey(const GrBatchTracker&, | 497     virtual void getGLProcessorKey(const GrBatchTracker&, | 
| 498                                    const GrGLCaps&, | 498                                    const GrGLCaps&, | 
| 499                                    GrProcessorKeyBuilder* b) const SK_OVERRIDE; | 499                                    GrProcessorKeyBuilder* b) const SK_OVERRIDE; | 
| 500 | 500 | 
| 501     virtual GrGLPrimitiveProcessor* createGLInstance(const GrBatchTracker&, | 501     virtual GrGLPrimitiveProcessor* createGLInstance(const GrBatchTracker&, | 
| 502                                                      const GrGLCaps&) const SK_O
      VERRIDE; | 502                                                      const GrGLCaps&) const SK_O
      VERRIDE; | 
| 503 | 503 | 
| 504     void initBatchTracker(GrBatchTracker* bt, const InitBT& init) const SK_OVERR
      IDE; | 504     void initBatchTracker(GrBatchTracker* bt, const GrPipelineInfo& init) const 
      SK_OVERRIDE; | 
| 505 | 505 | 
| 506     bool onCanMakeEqual(const GrBatchTracker&, | 506     bool onCanMakeEqual(const GrBatchTracker&, | 
| 507                         const GrGeometryProcessor&, | 507                         const GrGeometryProcessor&, | 
| 508                         const GrBatchTracker&) const SK_OVERRIDE; | 508                         const GrBatchTracker&) const SK_OVERRIDE; | 
| 509 | 509 | 
| 510 private: | 510 private: | 
| 511     DashingCircleEffect(GrColor, GrPrimitiveEdgeType edgeType, const DashInfo& i
      nfo, | 511     DashingCircleEffect(GrColor, GrPrimitiveEdgeType edgeType, const DashInfo& i
      nfo, | 
| 512                         SkScalar radius, const SkMatrix& localMatrix); | 512                         SkScalar radius, const SkMatrix& localMatrix); | 
| 513 | 513 | 
| 514     bool onIsEqual(const GrGeometryProcessor& other) const SK_OVERRIDE; | 514     bool onIsEqual(const GrGeometryProcessor& other) const SK_OVERRIDE; | 
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 699 } | 699 } | 
| 700 | 700 | 
| 701 bool DashingCircleEffect::onIsEqual(const GrGeometryProcessor& other) const { | 701 bool DashingCircleEffect::onIsEqual(const GrGeometryProcessor& other) const { | 
| 702     const DashingCircleEffect& dce = other.cast<DashingCircleEffect>(); | 702     const DashingCircleEffect& dce = other.cast<DashingCircleEffect>(); | 
| 703     return (fEdgeType == dce.fEdgeType && | 703     return (fEdgeType == dce.fEdgeType && | 
| 704             fIntervalLength == dce.fIntervalLength && | 704             fIntervalLength == dce.fIntervalLength && | 
| 705             fRadius == dce.fRadius && | 705             fRadius == dce.fRadius && | 
| 706             fCenterX == dce.fCenterX); | 706             fCenterX == dce.fCenterX); | 
| 707 } | 707 } | 
| 708 | 708 | 
| 709 void DashingCircleEffect::initBatchTracker(GrBatchTracker* bt, const InitBT& ini
      t) const { | 709 void DashingCircleEffect::initBatchTracker(GrBatchTracker* bt, const GrPipelineI
      nfo& init) const { | 
| 710     DashingCircleBatchTracker* local = bt->cast<DashingCircleBatchTracker>(); | 710     DashingCircleBatchTracker* local = bt->cast<DashingCircleBatchTracker>(); | 
| 711     local->fInputColorType = GetColorInputType(&local->fColor, this->color(), in
      it, false); | 711     local->fInputColorType = GetColorInputType(&local->fColor, this->color(), in
      it, false); | 
| 712     local->fUsesLocalCoords = init.fUsesLocalCoords; | 712     local->fUsesLocalCoords = init.fUsesLocalCoords; | 
| 713 } | 713 } | 
| 714 | 714 | 
| 715 bool DashingCircleEffect::onCanMakeEqual(const GrBatchTracker& m, | 715 bool DashingCircleEffect::onCanMakeEqual(const GrBatchTracker& m, | 
| 716                                          const GrGeometryProcessor& that, | 716                                          const GrGeometryProcessor& that, | 
| 717                                          const GrBatchTracker& t) const { | 717                                          const GrBatchTracker& t) const { | 
| 718     const DashingCircleBatchTracker& mine = m.cast<DashingCircleBatchTracker>(); | 718     const DashingCircleBatchTracker& mine = m.cast<DashingCircleBatchTracker>(); | 
| 719     const DashingCircleBatchTracker& theirs = t.cast<DashingCircleBatchTracker>(
      ); | 719     const DashingCircleBatchTracker& theirs = t.cast<DashingCircleBatchTracker>(
      ); | 
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 788 | 788 | 
| 789     SkScalar getIntervalLength() const { return fIntervalLength; } | 789     SkScalar getIntervalLength() const { return fIntervalLength; } | 
| 790 | 790 | 
| 791     virtual void getGLProcessorKey(const GrBatchTracker& bt, | 791     virtual void getGLProcessorKey(const GrBatchTracker& bt, | 
| 792                                    const GrGLCaps& caps, | 792                                    const GrGLCaps& caps, | 
| 793                                    GrProcessorKeyBuilder* b) const SK_OVERRIDE; | 793                                    GrProcessorKeyBuilder* b) const SK_OVERRIDE; | 
| 794 | 794 | 
| 795     virtual GrGLPrimitiveProcessor* createGLInstance(const GrBatchTracker& bt, | 795     virtual GrGLPrimitiveProcessor* createGLInstance(const GrBatchTracker& bt, | 
| 796                                                      const GrGLCaps&) const SK_O
      VERRIDE; | 796                                                      const GrGLCaps&) const SK_O
      VERRIDE; | 
| 797 | 797 | 
| 798     void initBatchTracker(GrBatchTracker* bt, const InitBT& init) const SK_OVERR
      IDE; | 798     void initBatchTracker(GrBatchTracker* bt, const GrPipelineInfo& init) const 
      SK_OVERRIDE; | 
| 799 | 799 | 
| 800     bool onCanMakeEqual(const GrBatchTracker&, | 800     bool onCanMakeEqual(const GrBatchTracker&, | 
| 801                         const GrGeometryProcessor&, | 801                         const GrGeometryProcessor&, | 
| 802                         const GrBatchTracker&) const SK_OVERRIDE; | 802                         const GrBatchTracker&) const SK_OVERRIDE; | 
| 803 | 803 | 
| 804 private: | 804 private: | 
| 805     DashingLineEffect(GrColor, GrPrimitiveEdgeType edgeType, const DashInfo& inf
      o, | 805     DashingLineEffect(GrColor, GrPrimitiveEdgeType edgeType, const DashInfo& inf
      o, | 
| 806                       SkScalar strokeWidth, const SkMatrix& localMatrix); | 806                       SkScalar strokeWidth, const SkMatrix& localMatrix); | 
| 807 | 807 | 
| 808     bool onIsEqual(const GrGeometryProcessor& other) const SK_OVERRIDE; | 808     bool onIsEqual(const GrGeometryProcessor& other) const SK_OVERRIDE; | 
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1006     fRect.set(halfOffLen, -halfStroke, halfOffLen + onLen, halfStroke); | 1006     fRect.set(halfOffLen, -halfStroke, halfOffLen + onLen, halfStroke); | 
| 1007 } | 1007 } | 
| 1008 | 1008 | 
| 1009 bool DashingLineEffect::onIsEqual(const GrGeometryProcessor& other) const { | 1009 bool DashingLineEffect::onIsEqual(const GrGeometryProcessor& other) const { | 
| 1010     const DashingLineEffect& de = other.cast<DashingLineEffect>(); | 1010     const DashingLineEffect& de = other.cast<DashingLineEffect>(); | 
| 1011     return (fEdgeType == de.fEdgeType && | 1011     return (fEdgeType == de.fEdgeType && | 
| 1012             fRect == de.fRect && | 1012             fRect == de.fRect && | 
| 1013             fIntervalLength == de.fIntervalLength); | 1013             fIntervalLength == de.fIntervalLength); | 
| 1014 } | 1014 } | 
| 1015 | 1015 | 
| 1016 void DashingLineEffect::initBatchTracker(GrBatchTracker* bt, const InitBT& init)
       const { | 1016 void DashingLineEffect::initBatchTracker(GrBatchTracker* bt, const GrPipelineInf
      o& init) const { | 
| 1017     DashingLineBatchTracker* local = bt->cast<DashingLineBatchTracker>(); | 1017     DashingLineBatchTracker* local = bt->cast<DashingLineBatchTracker>(); | 
| 1018     local->fInputColorType = GetColorInputType(&local->fColor, this->color(), in
      it, false); | 1018     local->fInputColorType = GetColorInputType(&local->fColor, this->color(), in
      it, false); | 
| 1019     local->fUsesLocalCoords = init.fUsesLocalCoords; | 1019     local->fUsesLocalCoords = init.fUsesLocalCoords; | 
| 1020 } | 1020 } | 
| 1021 | 1021 | 
| 1022 bool DashingLineEffect::onCanMakeEqual(const GrBatchTracker& m, | 1022 bool DashingLineEffect::onCanMakeEqual(const GrBatchTracker& m, | 
| 1023                                        const GrGeometryProcessor& that, | 1023                                        const GrGeometryProcessor& that, | 
| 1024                                        const GrBatchTracker& t) const { | 1024                                        const GrBatchTracker& t) const { | 
| 1025     const DashingLineBatchTracker& mine = m.cast<DashingLineBatchTracker>(); | 1025     const DashingLineBatchTracker& mine = m.cast<DashingLineBatchTracker>(); | 
| 1026     const DashingLineBatchTracker& theirs = t.cast<DashingLineBatchTracker>(); | 1026     const DashingLineBatchTracker& theirs = t.cast<DashingLineBatchTracker>(); | 
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1065             return DashingCircleEffect::Create(color, edgeType, info, | 1065             return DashingCircleEffect::Create(color, edgeType, info, | 
| 1066                                                SkScalarHalf(strokeWidth), | 1066                                                SkScalarHalf(strokeWidth), | 
| 1067                                                localMatrix); | 1067                                                localMatrix); | 
| 1068         case GrDashingEffect::kNonRound_DashCap: | 1068         case GrDashingEffect::kNonRound_DashCap: | 
| 1069             return DashingLineEffect::Create(color, edgeType, info, strokeWidth,
       localMatrix); | 1069             return DashingLineEffect::Create(color, edgeType, info, strokeWidth,
       localMatrix); | 
| 1070         default: | 1070         default: | 
| 1071             SkFAIL("Unexpected dashed cap."); | 1071             SkFAIL("Unexpected dashed cap."); | 
| 1072     } | 1072     } | 
| 1073     return NULL; | 1073     return NULL; | 
| 1074 } | 1074 } | 
| OLD | NEW | 
|---|