| 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 "GrBatch.h" | 10 #include "GrBatch.h" | 
| (...skipping 765 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 776     const char* name() const override { return "DashingCircleEffect"; } | 776     const char* name() const override { return "DashingCircleEffect"; } | 
| 777 | 777 | 
| 778     const Attribute* inPosition() const { return fInPosition; } | 778     const Attribute* inPosition() const { return fInPosition; } | 
| 779 | 779 | 
| 780     const Attribute* inDashParams() const { return fInDashParams; } | 780     const Attribute* inDashParams() const { return fInDashParams; } | 
| 781 | 781 | 
| 782     const Attribute* inCircleParams() const { return fInCircleParams; } | 782     const Attribute* inCircleParams() const { return fInCircleParams; } | 
| 783 | 783 | 
| 784     DashAAMode aaMode() const { return fAAMode; } | 784     DashAAMode aaMode() const { return fAAMode; } | 
| 785 | 785 | 
|  | 786     GrColor color() const { return fColor; } | 
|  | 787 | 
| 786     virtual void getGLProcessorKey(const GrBatchTracker&, | 788     virtual void getGLProcessorKey(const GrBatchTracker&, | 
| 787                                    const GrGLSLCaps&, | 789                                    const GrGLSLCaps&, | 
| 788                                    GrProcessorKeyBuilder* b) const override; | 790                                    GrProcessorKeyBuilder* b) const override; | 
| 789 | 791 | 
| 790     virtual GrGLPrimitiveProcessor* createGLInstance(const GrBatchTracker&, | 792     virtual GrGLPrimitiveProcessor* createGLInstance(const GrBatchTracker&, | 
| 791                                                      const GrGLSLCaps&) const ov
      erride; | 793                                                      const GrGLSLCaps&) const ov
      erride; | 
| 792 | 794 | 
| 793     void initBatchTracker(GrBatchTracker* bt, const GrPipelineInfo& init) const 
      override; | 795     void initBatchTracker(GrBatchTracker* bt, const GrPipelineInfo& init) const 
      override; | 
| 794 | 796 | 
| 795 private: | 797 private: | 
| 796     DashingCircleEffect(GrColor, DashAAMode aaMode, const SkMatrix& localMatrix)
      ; | 798     DashingCircleEffect(GrColor, DashAAMode aaMode, const SkMatrix& localMatrix)
      ; | 
| 797 | 799 | 
|  | 800     GrColor             fColor; | 
| 798     DashAAMode          fAAMode; | 801     DashAAMode          fAAMode; | 
| 799     const Attribute*    fInPosition; | 802     const Attribute*    fInPosition; | 
| 800     const Attribute*    fInDashParams; | 803     const Attribute*    fInDashParams; | 
| 801     const Attribute*    fInCircleParams; | 804     const Attribute*    fInCircleParams; | 
| 802 | 805 | 
| 803     GR_DECLARE_GEOMETRY_PROCESSOR_TEST; | 806     GR_DECLARE_GEOMETRY_PROCESSOR_TEST; | 
| 804 | 807 | 
| 805     typedef GrGeometryProcessor INHERITED; | 808     typedef GrGeometryProcessor INHERITED; | 
| 806 }; | 809 }; | 
| 807 | 810 | 
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 930 } | 933 } | 
| 931 | 934 | 
| 932 GrGLPrimitiveProcessor* DashingCircleEffect::createGLInstance(const GrBatchTrack
      er& bt, | 935 GrGLPrimitiveProcessor* DashingCircleEffect::createGLInstance(const GrBatchTrack
      er& bt, | 
| 933                                                               const GrGLSLCaps&)
       const { | 936                                                               const GrGLSLCaps&)
       const { | 
| 934     return SkNEW_ARGS(GLDashingCircleEffect, (*this, bt)); | 937     return SkNEW_ARGS(GLDashingCircleEffect, (*this, bt)); | 
| 935 } | 938 } | 
| 936 | 939 | 
| 937 DashingCircleEffect::DashingCircleEffect(GrColor color, | 940 DashingCircleEffect::DashingCircleEffect(GrColor color, | 
| 938                                          DashAAMode aaMode, | 941                                          DashAAMode aaMode, | 
| 939                                          const SkMatrix& localMatrix) | 942                                          const SkMatrix& localMatrix) | 
| 940     : INHERITED(color, SkMatrix::I(), localMatrix), fAAMode(aaMode) { | 943     : INHERITED(SkMatrix::I(), localMatrix) | 
|  | 944     , fColor(color) | 
|  | 945     , fAAMode(aaMode) { | 
| 941     this->initClassID<DashingCircleEffect>(); | 946     this->initClassID<DashingCircleEffect>(); | 
| 942     fInPosition = &this->addVertexAttrib(Attribute("inPosition", kVec2f_GrVertex
      AttribType)); | 947     fInPosition = &this->addVertexAttrib(Attribute("inPosition", kVec2f_GrVertex
      AttribType)); | 
| 943     fInDashParams = &this->addVertexAttrib(Attribute("inDashParams", kVec3f_GrVe
      rtexAttribType)); | 948     fInDashParams = &this->addVertexAttrib(Attribute("inDashParams", kVec3f_GrVe
      rtexAttribType)); | 
| 944     fInCircleParams = &this->addVertexAttrib(Attribute("inCircleParams", | 949     fInCircleParams = &this->addVertexAttrib(Attribute("inCircleParams", | 
| 945                                                        kVec2f_GrVertexAttribType
      )); | 950                                                        kVec2f_GrVertexAttribType
      )); | 
| 946 } | 951 } | 
| 947 | 952 | 
| 948 void DashingCircleEffect::initBatchTracker(GrBatchTracker* bt, const GrPipelineI
      nfo& init) const { | 953 void DashingCircleEffect::initBatchTracker(GrBatchTracker* bt, const GrPipelineI
      nfo& init) const { | 
| 949     DashingCircleBatchTracker* local = bt->cast<DashingCircleBatchTracker>(); | 954     DashingCircleBatchTracker* local = bt->cast<DashingCircleBatchTracker>(); | 
| 950     local->fInputColorType = GetColorInputType(&local->fColor, this->color(), in
      it, false); | 955     local->fInputColorType = GetColorInputType(&local->fColor, this->color(), in
      it, false); | 
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 992     const char* name() const override { return "DashingEffect"; } | 997     const char* name() const override { return "DashingEffect"; } | 
| 993 | 998 | 
| 994     const Attribute* inPosition() const { return fInPosition; } | 999     const Attribute* inPosition() const { return fInPosition; } | 
| 995 | 1000 | 
| 996     const Attribute* inDashParams() const { return fInDashParams; } | 1001     const Attribute* inDashParams() const { return fInDashParams; } | 
| 997 | 1002 | 
| 998     const Attribute* inRectParams() const { return fInRectParams; } | 1003     const Attribute* inRectParams() const { return fInRectParams; } | 
| 999 | 1004 | 
| 1000     DashAAMode aaMode() const { return fAAMode; } | 1005     DashAAMode aaMode() const { return fAAMode; } | 
| 1001 | 1006 | 
|  | 1007     GrColor color() const { return fColor; } | 
|  | 1008 | 
| 1002     virtual void getGLProcessorKey(const GrBatchTracker& bt, | 1009     virtual void getGLProcessorKey(const GrBatchTracker& bt, | 
| 1003                                    const GrGLSLCaps& caps, | 1010                                    const GrGLSLCaps& caps, | 
| 1004                                    GrProcessorKeyBuilder* b) const override; | 1011                                    GrProcessorKeyBuilder* b) const override; | 
| 1005 | 1012 | 
| 1006     virtual GrGLPrimitiveProcessor* createGLInstance(const GrBatchTracker& bt, | 1013     virtual GrGLPrimitiveProcessor* createGLInstance(const GrBatchTracker& bt, | 
| 1007                                                      const GrGLSLCaps&) const ov
      erride; | 1014                                                      const GrGLSLCaps&) const ov
      erride; | 
| 1008 | 1015 | 
| 1009     void initBatchTracker(GrBatchTracker* bt, const GrPipelineInfo& init) const 
      override; | 1016     void initBatchTracker(GrBatchTracker* bt, const GrPipelineInfo& init) const 
      override; | 
| 1010 | 1017 | 
| 1011 private: | 1018 private: | 
| 1012     DashingLineEffect(GrColor, DashAAMode aaMode, const SkMatrix& localMatrix); | 1019     DashingLineEffect(GrColor, DashAAMode aaMode, const SkMatrix& localMatrix); | 
| 1013 | 1020 | 
|  | 1021     GrColor             fColor; | 
| 1014     DashAAMode          fAAMode; | 1022     DashAAMode          fAAMode; | 
| 1015     const Attribute*    fInPosition; | 1023     const Attribute*    fInPosition; | 
| 1016     const Attribute*    fInDashParams; | 1024     const Attribute*    fInDashParams; | 
| 1017     const Attribute*    fInRectParams; | 1025     const Attribute*    fInRectParams; | 
| 1018 | 1026 | 
| 1019     GR_DECLARE_GEOMETRY_PROCESSOR_TEST; | 1027     GR_DECLARE_GEOMETRY_PROCESSOR_TEST; | 
| 1020 | 1028 | 
| 1021     typedef GrGeometryProcessor INHERITED; | 1029     typedef GrGeometryProcessor INHERITED; | 
| 1022 }; | 1030 }; | 
| 1023 | 1031 | 
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1158 } | 1166 } | 
| 1159 | 1167 | 
| 1160 GrGLPrimitiveProcessor* DashingLineEffect::createGLInstance(const GrBatchTracker
      & bt, | 1168 GrGLPrimitiveProcessor* DashingLineEffect::createGLInstance(const GrBatchTracker
      & bt, | 
| 1161                                                             const GrGLSLCaps&) c
      onst { | 1169                                                             const GrGLSLCaps&) c
      onst { | 
| 1162     return SkNEW_ARGS(GLDashingLineEffect, (*this, bt)); | 1170     return SkNEW_ARGS(GLDashingLineEffect, (*this, bt)); | 
| 1163 } | 1171 } | 
| 1164 | 1172 | 
| 1165 DashingLineEffect::DashingLineEffect(GrColor color, | 1173 DashingLineEffect::DashingLineEffect(GrColor color, | 
| 1166                                      DashAAMode aaMode, | 1174                                      DashAAMode aaMode, | 
| 1167                                      const SkMatrix& localMatrix) | 1175                                      const SkMatrix& localMatrix) | 
| 1168     : INHERITED(color, SkMatrix::I(), localMatrix), fAAMode(aaMode) { | 1176     : INHERITED(SkMatrix::I(), localMatrix) | 
|  | 1177     , fColor(color) | 
|  | 1178     , fAAMode(aaMode) { | 
| 1169     this->initClassID<DashingLineEffect>(); | 1179     this->initClassID<DashingLineEffect>(); | 
| 1170     fInPosition = &this->addVertexAttrib(Attribute("inPosition", kVec2f_GrVertex
      AttribType)); | 1180     fInPosition = &this->addVertexAttrib(Attribute("inPosition", kVec2f_GrVertex
      AttribType)); | 
| 1171     fInDashParams = &this->addVertexAttrib(Attribute("inDashParams", kVec3f_GrVe
      rtexAttribType)); | 1181     fInDashParams = &this->addVertexAttrib(Attribute("inDashParams", kVec3f_GrVe
      rtexAttribType)); | 
| 1172     fInRectParams = &this->addVertexAttrib(Attribute("inRect", kVec4f_GrVertexAt
      tribType)); | 1182     fInRectParams = &this->addVertexAttrib(Attribute("inRect", kVec4f_GrVertexAt
      tribType)); | 
| 1173 } | 1183 } | 
| 1174 | 1184 | 
| 1175 void DashingLineEffect::initBatchTracker(GrBatchTracker* bt, const GrPipelineInf
      o& init) const { | 1185 void DashingLineEffect::initBatchTracker(GrBatchTracker* bt, const GrPipelineInf
      o& init) const { | 
| 1176     DashingLineBatchTracker* local = bt->cast<DashingLineBatchTracker>(); | 1186     DashingLineBatchTracker* local = bt->cast<DashingLineBatchTracker>(); | 
| 1177     local->fInputColorType = GetColorInputType(&local->fColor, this->color(), in
      it, false); | 1187     local->fInputColorType = GetColorInputType(&local->fColor, this->color(), in
      it, false); | 
| 1178     local->fUsesLocalCoords = init.fUsesLocalCoords; | 1188     local->fUsesLocalCoords = init.fUsesLocalCoords; | 
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1279     info.fIntervals = intervals; | 1289     info.fIntervals = intervals; | 
| 1280     info.fCount = 2; | 1290     info.fCount = 2; | 
| 1281     info.fPhase = phase; | 1291     info.fPhase = phase; | 
| 1282     SkDEBUGCODE(bool success = ) strokeInfo.setDashInfo(info); | 1292     SkDEBUGCODE(bool success = ) strokeInfo.setDashInfo(info); | 
| 1283     SkASSERT(success); | 1293     SkASSERT(success); | 
| 1284 | 1294 | 
| 1285     return create_batch(color, viewMatrix, pts, useAA, strokeInfo, msaaRT); | 1295     return create_batch(color, viewMatrix, pts, useAA, strokeInfo, msaaRT); | 
| 1286 } | 1296 } | 
| 1287 | 1297 | 
| 1288 #endif | 1298 #endif | 
| OLD | NEW | 
|---|