| 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 "GrBatchFlushState.h" | 10 #include "GrBatchFlushState.h" |
| (...skipping 766 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 777 DashAAMode aaMode() const { return fAAMode; } | 777 DashAAMode aaMode() const { return fAAMode; } |
| 778 | 778 |
| 779 GrColor color() const { return fColor; } | 779 GrColor color() const { return fColor; } |
| 780 | 780 |
| 781 bool colorIgnored() const { return GrColor_ILLEGAL == fColor; } | 781 bool colorIgnored() const { return GrColor_ILLEGAL == fColor; } |
| 782 | 782 |
| 783 const SkMatrix& localMatrix() const { return fLocalMatrix; } | 783 const SkMatrix& localMatrix() const { return fLocalMatrix; } |
| 784 | 784 |
| 785 bool usesLocalCoords() const { return fUsesLocalCoords; } | 785 bool usesLocalCoords() const { return fUsesLocalCoords; } |
| 786 | 786 |
| 787 virtual void getGLProcessorKey(const GrBatchTracker&, | 787 void getGLProcessorKey(const GrGLSLCaps&, GrProcessorKeyBuilder* b) const ov
erride; |
| 788 const GrGLSLCaps&, | |
| 789 GrProcessorKeyBuilder* b) const override; | |
| 790 | 788 |
| 791 virtual GrGLPrimitiveProcessor* createGLInstance(const GrBatchTracker&, | 789 GrGLPrimitiveProcessor* createGLInstance(const GrGLSLCaps&) const override; |
| 792 const GrGLSLCaps&) const ov
erride; | |
| 793 | 790 |
| 794 private: | 791 private: |
| 795 DashingCircleEffect(GrColor, DashAAMode aaMode, const SkMatrix& localMatrix, | 792 DashingCircleEffect(GrColor, DashAAMode aaMode, const SkMatrix& localMatrix, |
| 796 bool usesLocalCoords); | 793 bool usesLocalCoords); |
| 797 | 794 |
| 798 GrColor fColor; | 795 GrColor fColor; |
| 799 SkMatrix fLocalMatrix; | 796 SkMatrix fLocalMatrix; |
| 800 bool fUsesLocalCoords; | 797 bool fUsesLocalCoords; |
| 801 DashAAMode fAAMode; | 798 DashAAMode fAAMode; |
| 802 const Attribute* fInPosition; | 799 const Attribute* fInPosition; |
| 803 const Attribute* fInDashParams; | 800 const Attribute* fInDashParams; |
| 804 const Attribute* fInCircleParams; | 801 const Attribute* fInCircleParams; |
| 805 | 802 |
| 806 GR_DECLARE_GEOMETRY_PROCESSOR_TEST; | 803 GR_DECLARE_GEOMETRY_PROCESSOR_TEST; |
| 807 | 804 |
| 808 typedef GrGeometryProcessor INHERITED; | 805 typedef GrGeometryProcessor INHERITED; |
| 809 }; | 806 }; |
| 810 | 807 |
| 811 ////////////////////////////////////////////////////////////////////////////// | 808 ////////////////////////////////////////////////////////////////////////////// |
| 812 | 809 |
| 813 class GLDashingCircleEffect : public GrGLGeometryProcessor { | 810 class GLDashingCircleEffect : public GrGLGeometryProcessor { |
| 814 public: | 811 public: |
| 815 GLDashingCircleEffect(const GrGeometryProcessor&, const GrBatchTracker&); | 812 GLDashingCircleEffect(); |
| 816 | 813 |
| 817 void onEmitCode(EmitArgs&, GrGPArgs*) override; | 814 void onEmitCode(EmitArgs&, GrGPArgs*) override; |
| 818 | 815 |
| 819 static inline void GenKey(const GrGeometryProcessor&, | 816 static inline void GenKey(const GrGeometryProcessor&, |
| 820 const GrBatchTracker&, | |
| 821 const GrGLSLCaps&, | 817 const GrGLSLCaps&, |
| 822 GrProcessorKeyBuilder*); | 818 GrProcessorKeyBuilder*); |
| 823 | 819 |
| 824 virtual void setData(const GrGLProgramDataManager&, | 820 void setData(const GrGLProgramDataManager&, const GrPrimitiveProcessor&) ove
rride; |
| 825 const GrPrimitiveProcessor&, | |
| 826 const GrBatchTracker&) override; | |
| 827 | 821 |
| 828 void setTransformData(const GrPrimitiveProcessor& primProc, | 822 void setTransformData(const GrPrimitiveProcessor& primProc, |
| 829 const GrGLProgramDataManager& pdman, | 823 const GrGLProgramDataManager& pdman, |
| 830 int index, | 824 int index, |
| 831 const SkTArray<const GrCoordTransform*, true>& transfo
rms) override { | 825 const SkTArray<const GrCoordTransform*, true>& transfo
rms) override { |
| 832 this->setTransformDataHelper<DashingCircleEffect>(primProc, pdman, index
, transforms); | 826 this->setTransformDataHelper<DashingCircleEffect>(primProc, pdman, index
, transforms); |
| 833 } | 827 } |
| 834 | 828 |
| 835 private: | 829 private: |
| 836 UniformHandle fParamUniform; | 830 UniformHandle fParamUniform; |
| 837 UniformHandle fColorUniform; | 831 UniformHandle fColorUniform; |
| 838 GrColor fColor; | 832 GrColor fColor; |
| 839 SkScalar fPrevRadius; | 833 SkScalar fPrevRadius; |
| 840 SkScalar fPrevCenterX; | 834 SkScalar fPrevCenterX; |
| 841 SkScalar fPrevIntervalLength; | 835 SkScalar fPrevIntervalLength; |
| 842 typedef GrGLGeometryProcessor INHERITED; | 836 typedef GrGLGeometryProcessor INHERITED; |
| 843 }; | 837 }; |
| 844 | 838 |
| 845 GLDashingCircleEffect::GLDashingCircleEffect(const GrGeometryProcessor&, | 839 GLDashingCircleEffect::GLDashingCircleEffect() { |
| 846 const GrBatchTracker&) { | |
| 847 fColor = GrColor_ILLEGAL; | 840 fColor = GrColor_ILLEGAL; |
| 848 fPrevRadius = SK_ScalarMin; | 841 fPrevRadius = SK_ScalarMin; |
| 849 fPrevCenterX = SK_ScalarMin; | 842 fPrevCenterX = SK_ScalarMin; |
| 850 fPrevIntervalLength = SK_ScalarMax; | 843 fPrevIntervalLength = SK_ScalarMax; |
| 851 } | 844 } |
| 852 | 845 |
| 853 void GLDashingCircleEffect::onEmitCode(EmitArgs& args, GrGPArgs* gpArgs) { | 846 void GLDashingCircleEffect::onEmitCode(EmitArgs& args, GrGPArgs* gpArgs) { |
| 854 const DashingCircleEffect& dce = args.fGP.cast<DashingCircleEffect>(); | 847 const DashingCircleEffect& dce = args.fGP.cast<DashingCircleEffect>(); |
| 855 GrGLGPBuilder* pb = args.fPB; | 848 GrGLGPBuilder* pb = args.fPB; |
| 856 GrGLVertexBuilder* vsBuilder = args.fPB->getVertexShaderBuilder(); | 849 GrGLVertexBuilder* vsBuilder = args.fPB->getVertexShaderBuilder(); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 893 fsBuilder->codeAppend("diff = 1.0 - diff;"); | 886 fsBuilder->codeAppend("diff = 1.0 - diff;"); |
| 894 fsBuilder->codeAppend("float alpha = clamp(diff, 0.0, 1.0);"); | 887 fsBuilder->codeAppend("float alpha = clamp(diff, 0.0, 1.0);"); |
| 895 } else { | 888 } else { |
| 896 fsBuilder->codeAppendf("float alpha = 1.0;"); | 889 fsBuilder->codeAppendf("float alpha = 1.0;"); |
| 897 fsBuilder->codeAppendf("alpha *= dist < %s.x + 0.5 ? 1.0 : 0.0;", circl
eParams.fsIn()); | 890 fsBuilder->codeAppendf("alpha *= dist < %s.x + 0.5 ? 1.0 : 0.0;", circl
eParams.fsIn()); |
| 898 } | 891 } |
| 899 fsBuilder->codeAppendf("%s = vec4(alpha);", args.fOutputCoverage); | 892 fsBuilder->codeAppendf("%s = vec4(alpha);", args.fOutputCoverage); |
| 900 } | 893 } |
| 901 | 894 |
| 902 void GLDashingCircleEffect::setData(const GrGLProgramDataManager& pdman, | 895 void GLDashingCircleEffect::setData(const GrGLProgramDataManager& pdman, |
| 903 const GrPrimitiveProcessor& processor, | 896 const GrPrimitiveProcessor& processor) { |
| 904 const GrBatchTracker& bt) { | |
| 905 const DashingCircleEffect& dce = processor.cast<DashingCircleEffect>(); | 897 const DashingCircleEffect& dce = processor.cast<DashingCircleEffect>(); |
| 906 if (dce.color() != fColor) { | 898 if (dce.color() != fColor) { |
| 907 GrGLfloat c[4]; | 899 GrGLfloat c[4]; |
| 908 GrColorToRGBAFloat(dce.color(), c); | 900 GrColorToRGBAFloat(dce.color(), c); |
| 909 pdman.set4fv(fColorUniform, 1, c); | 901 pdman.set4fv(fColorUniform, 1, c); |
| 910 fColor = dce.color(); | 902 fColor = dce.color(); |
| 911 } | 903 } |
| 912 } | 904 } |
| 913 | 905 |
| 914 void GLDashingCircleEffect::GenKey(const GrGeometryProcessor& gp, | 906 void GLDashingCircleEffect::GenKey(const GrGeometryProcessor& gp, |
| 915 const GrBatchTracker& bt, | |
| 916 const GrGLSLCaps&, | 907 const GrGLSLCaps&, |
| 917 GrProcessorKeyBuilder* b) { | 908 GrProcessorKeyBuilder* b) { |
| 918 const DashingCircleEffect& dce = gp.cast<DashingCircleEffect>(); | 909 const DashingCircleEffect& dce = gp.cast<DashingCircleEffect>(); |
| 919 uint32_t key = 0; | 910 uint32_t key = 0; |
| 920 key |= dce.usesLocalCoords() && dce.localMatrix().hasPerspective() ? 0x1 : 0
x0; | 911 key |= dce.usesLocalCoords() && dce.localMatrix().hasPerspective() ? 0x1 : 0
x0; |
| 921 key |= dce.colorIgnored() ? 0x2 : 0x0; | 912 key |= dce.colorIgnored() ? 0x2 : 0x0; |
| 922 key |= dce.aaMode() << 8; | 913 key |= dce.aaMode() << 8; |
| 923 b->add32(key); | 914 b->add32(key); |
| 924 } | 915 } |
| 925 | 916 |
| 926 ////////////////////////////////////////////////////////////////////////////// | 917 ////////////////////////////////////////////////////////////////////////////// |
| 927 | 918 |
| 928 GrGeometryProcessor* DashingCircleEffect::Create(GrColor color, | 919 GrGeometryProcessor* DashingCircleEffect::Create(GrColor color, |
| 929 DashAAMode aaMode, | 920 DashAAMode aaMode, |
| 930 const SkMatrix& localMatrix, | 921 const SkMatrix& localMatrix, |
| 931 bool usesLocalCoords) { | 922 bool usesLocalCoords) { |
| 932 return new DashingCircleEffect(color, aaMode, localMatrix, usesLocalCoords); | 923 return new DashingCircleEffect(color, aaMode, localMatrix, usesLocalCoords); |
| 933 } | 924 } |
| 934 | 925 |
| 935 void DashingCircleEffect::getGLProcessorKey(const GrBatchTracker& bt, | 926 void DashingCircleEffect::getGLProcessorKey(const GrGLSLCaps& caps,GrProcessorKe
yBuilder* b) const { |
| 936 const GrGLSLCaps& caps, | 927 GLDashingCircleEffect::GenKey(*this, caps, b); |
| 937 GrProcessorKeyBuilder* b) const { | |
| 938 GLDashingCircleEffect::GenKey(*this, bt, caps, b); | |
| 939 } | 928 } |
| 940 | 929 |
| 941 GrGLPrimitiveProcessor* DashingCircleEffect::createGLInstance(const GrBatchTrack
er& bt, | 930 GrGLPrimitiveProcessor* DashingCircleEffect::createGLInstance(const GrGLSLCaps&)
const { |
| 942 const GrGLSLCaps&)
const { | 931 return new GLDashingCircleEffect(); |
| 943 return new GLDashingCircleEffect(*this, bt); | |
| 944 } | 932 } |
| 945 | 933 |
| 946 DashingCircleEffect::DashingCircleEffect(GrColor color, | 934 DashingCircleEffect::DashingCircleEffect(GrColor color, |
| 947 DashAAMode aaMode, | 935 DashAAMode aaMode, |
| 948 const SkMatrix& localMatrix, | 936 const SkMatrix& localMatrix, |
| 949 bool usesLocalCoords) | 937 bool usesLocalCoords) |
| 950 : fColor(color) | 938 : fColor(color) |
| 951 , fLocalMatrix(localMatrix) | 939 , fLocalMatrix(localMatrix) |
| 952 , fUsesLocalCoords(usesLocalCoords) | 940 , fUsesLocalCoords(usesLocalCoords) |
| 953 , fAAMode(aaMode) { | 941 , fAAMode(aaMode) { |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1000 DashAAMode aaMode() const { return fAAMode; } | 988 DashAAMode aaMode() const { return fAAMode; } |
| 1001 | 989 |
| 1002 GrColor color() const { return fColor; } | 990 GrColor color() const { return fColor; } |
| 1003 | 991 |
| 1004 bool colorIgnored() const { return GrColor_ILLEGAL == fColor; } | 992 bool colorIgnored() const { return GrColor_ILLEGAL == fColor; } |
| 1005 | 993 |
| 1006 const SkMatrix& localMatrix() const { return fLocalMatrix; } | 994 const SkMatrix& localMatrix() const { return fLocalMatrix; } |
| 1007 | 995 |
| 1008 bool usesLocalCoords() const { return fUsesLocalCoords; } | 996 bool usesLocalCoords() const { return fUsesLocalCoords; } |
| 1009 | 997 |
| 1010 virtual void getGLProcessorKey(const GrBatchTracker& bt, | 998 void getGLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBuilder* b) con
st override; |
| 1011 const GrGLSLCaps& caps, | |
| 1012 GrProcessorKeyBuilder* b) const override; | |
| 1013 | 999 |
| 1014 virtual GrGLPrimitiveProcessor* createGLInstance(const GrBatchTracker& bt, | 1000 GrGLPrimitiveProcessor* createGLInstance(const GrGLSLCaps&) const override; |
| 1015 const GrGLSLCaps&) const ov
erride; | |
| 1016 | 1001 |
| 1017 private: | 1002 private: |
| 1018 DashingLineEffect(GrColor, DashAAMode aaMode, const SkMatrix& localMatrix, | 1003 DashingLineEffect(GrColor, DashAAMode aaMode, const SkMatrix& localMatrix, |
| 1019 bool usesLocalCoords); | 1004 bool usesLocalCoords); |
| 1020 | 1005 |
| 1021 GrColor fColor; | 1006 GrColor fColor; |
| 1022 SkMatrix fLocalMatrix; | 1007 SkMatrix fLocalMatrix; |
| 1023 bool fUsesLocalCoords; | 1008 bool fUsesLocalCoords; |
| 1024 DashAAMode fAAMode; | 1009 DashAAMode fAAMode; |
| 1025 const Attribute* fInPosition; | 1010 const Attribute* fInPosition; |
| 1026 const Attribute* fInDashParams; | 1011 const Attribute* fInDashParams; |
| 1027 const Attribute* fInRectParams; | 1012 const Attribute* fInRectParams; |
| 1028 | 1013 |
| 1029 GR_DECLARE_GEOMETRY_PROCESSOR_TEST; | 1014 GR_DECLARE_GEOMETRY_PROCESSOR_TEST; |
| 1030 | 1015 |
| 1031 typedef GrGeometryProcessor INHERITED; | 1016 typedef GrGeometryProcessor INHERITED; |
| 1032 }; | 1017 }; |
| 1033 | 1018 |
| 1034 ////////////////////////////////////////////////////////////////////////////// | 1019 ////////////////////////////////////////////////////////////////////////////// |
| 1035 | 1020 |
| 1036 class GLDashingLineEffect : public GrGLGeometryProcessor { | 1021 class GLDashingLineEffect : public GrGLGeometryProcessor { |
| 1037 public: | 1022 public: |
| 1038 GLDashingLineEffect(const GrGeometryProcessor&, const GrBatchTracker&); | 1023 GLDashingLineEffect(); |
| 1039 | 1024 |
| 1040 void onEmitCode(EmitArgs&, GrGPArgs*) override; | 1025 void onEmitCode(EmitArgs&, GrGPArgs*) override; |
| 1041 | 1026 |
| 1042 static inline void GenKey(const GrGeometryProcessor&, | 1027 static inline void GenKey(const GrGeometryProcessor&, |
| 1043 const GrBatchTracker&, | |
| 1044 const GrGLSLCaps&, | 1028 const GrGLSLCaps&, |
| 1045 GrProcessorKeyBuilder*); | 1029 GrProcessorKeyBuilder*); |
| 1046 | 1030 |
| 1047 virtual void setData(const GrGLProgramDataManager&, | 1031 void setData(const GrGLProgramDataManager&, const GrPrimitiveProcessor&) ove
rride; |
| 1048 const GrPrimitiveProcessor&, | |
| 1049 const GrBatchTracker&) override; | |
| 1050 | 1032 |
| 1051 void setTransformData(const GrPrimitiveProcessor& primProc, | 1033 void setTransformData(const GrPrimitiveProcessor& primProc, |
| 1052 const GrGLProgramDataManager& pdman, | 1034 const GrGLProgramDataManager& pdman, |
| 1053 int index, | 1035 int index, |
| 1054 const SkTArray<const GrCoordTransform*, true>& transfo
rms) override { | 1036 const SkTArray<const GrCoordTransform*, true>& transfo
rms) override { |
| 1055 this->setTransformDataHelper<DashingLineEffect>(primProc, pdman, index,
transforms); | 1037 this->setTransformDataHelper<DashingLineEffect>(primProc, pdman, index,
transforms); |
| 1056 } | 1038 } |
| 1057 | 1039 |
| 1058 private: | 1040 private: |
| 1059 GrColor fColor; | 1041 GrColor fColor; |
| 1060 UniformHandle fColorUniform; | 1042 UniformHandle fColorUniform; |
| 1061 typedef GrGLGeometryProcessor INHERITED; | 1043 typedef GrGLGeometryProcessor INHERITED; |
| 1062 }; | 1044 }; |
| 1063 | 1045 |
| 1064 GLDashingLineEffect::GLDashingLineEffect(const GrGeometryProcessor&, | 1046 GLDashingLineEffect::GLDashingLineEffect() { |
| 1065 const GrBatchTracker&) { | |
| 1066 fColor = GrColor_ILLEGAL; | 1047 fColor = GrColor_ILLEGAL; |
| 1067 } | 1048 } |
| 1068 | 1049 |
| 1069 void GLDashingLineEffect::onEmitCode(EmitArgs& args, GrGPArgs* gpArgs) { | 1050 void GLDashingLineEffect::onEmitCode(EmitArgs& args, GrGPArgs* gpArgs) { |
| 1070 const DashingLineEffect& de = args.fGP.cast<DashingLineEffect>(); | 1051 const DashingLineEffect& de = args.fGP.cast<DashingLineEffect>(); |
| 1071 GrGLGPBuilder* pb = args.fPB; | 1052 GrGLGPBuilder* pb = args.fPB; |
| 1072 | 1053 |
| 1073 GrGLVertexBuilder* vsBuilder = args.fPB->getVertexShaderBuilder(); | 1054 GrGLVertexBuilder* vsBuilder = args.fPB->getVertexShaderBuilder(); |
| 1074 | 1055 |
| 1075 // emit attributes | 1056 // emit attributes |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1129 fsBuilder->codeAppendf("float alpha = 1.0;"); | 1110 fsBuilder->codeAppendf("float alpha = 1.0;"); |
| 1130 fsBuilder->codeAppendf("alpha *= (fragPosShifted.x - %s.x) > -0.5 ? 1.0
: 0.0;", | 1111 fsBuilder->codeAppendf("alpha *= (fragPosShifted.x - %s.x) > -0.5 ? 1.0
: 0.0;", |
| 1131 inRectParams.fsIn()); | 1112 inRectParams.fsIn()); |
| 1132 fsBuilder->codeAppendf("alpha *= (%s.z - fragPosShifted.x) >= -0.5 ? 1.0
: 0.0;", | 1113 fsBuilder->codeAppendf("alpha *= (%s.z - fragPosShifted.x) >= -0.5 ? 1.0
: 0.0;", |
| 1133 inRectParams.fsIn()); | 1114 inRectParams.fsIn()); |
| 1134 } | 1115 } |
| 1135 fsBuilder->codeAppendf("%s = vec4(alpha);", args.fOutputCoverage); | 1116 fsBuilder->codeAppendf("%s = vec4(alpha);", args.fOutputCoverage); |
| 1136 } | 1117 } |
| 1137 | 1118 |
| 1138 void GLDashingLineEffect::setData(const GrGLProgramDataManager& pdman, | 1119 void GLDashingLineEffect::setData(const GrGLProgramDataManager& pdman, |
| 1139 const GrPrimitiveProcessor& processor, | 1120 const GrPrimitiveProcessor& processor) { |
| 1140 const GrBatchTracker& bt) { | |
| 1141 const DashingLineEffect& de = processor.cast<DashingLineEffect>(); | 1121 const DashingLineEffect& de = processor.cast<DashingLineEffect>(); |
| 1142 if (de.color() != fColor) { | 1122 if (de.color() != fColor) { |
| 1143 GrGLfloat c[4]; | 1123 GrGLfloat c[4]; |
| 1144 GrColorToRGBAFloat(de.color(), c); | 1124 GrColorToRGBAFloat(de.color(), c); |
| 1145 pdman.set4fv(fColorUniform, 1, c); | 1125 pdman.set4fv(fColorUniform, 1, c); |
| 1146 fColor = de.color(); | 1126 fColor = de.color(); |
| 1147 } | 1127 } |
| 1148 } | 1128 } |
| 1149 | 1129 |
| 1150 void GLDashingLineEffect::GenKey(const GrGeometryProcessor& gp, | 1130 void GLDashingLineEffect::GenKey(const GrGeometryProcessor& gp, |
| 1151 const GrBatchTracker& bt, | |
| 1152 const GrGLSLCaps&, | 1131 const GrGLSLCaps&, |
| 1153 GrProcessorKeyBuilder* b) { | 1132 GrProcessorKeyBuilder* b) { |
| 1154 const DashingLineEffect& de = gp.cast<DashingLineEffect>(); | 1133 const DashingLineEffect& de = gp.cast<DashingLineEffect>(); |
| 1155 uint32_t key = 0; | 1134 uint32_t key = 0; |
| 1156 key |= de.usesLocalCoords() && de.localMatrix().hasPerspective() ? 0x1 : 0x0
; | 1135 key |= de.usesLocalCoords() && de.localMatrix().hasPerspective() ? 0x1 : 0x0
; |
| 1157 key |= de.colorIgnored() ? 0x2 : 0x0; | 1136 key |= de.colorIgnored() ? 0x2 : 0x0; |
| 1158 key |= de.aaMode() << 8; | 1137 key |= de.aaMode() << 8; |
| 1159 b->add32(key); | 1138 b->add32(key); |
| 1160 } | 1139 } |
| 1161 | 1140 |
| 1162 ////////////////////////////////////////////////////////////////////////////// | 1141 ////////////////////////////////////////////////////////////////////////////// |
| 1163 | 1142 |
| 1164 GrGeometryProcessor* DashingLineEffect::Create(GrColor color, | 1143 GrGeometryProcessor* DashingLineEffect::Create(GrColor color, |
| 1165 DashAAMode aaMode, | 1144 DashAAMode aaMode, |
| 1166 const SkMatrix& localMatrix, | 1145 const SkMatrix& localMatrix, |
| 1167 bool usesLocalCoords) { | 1146 bool usesLocalCoords) { |
| 1168 return new DashingLineEffect(color, aaMode, localMatrix, usesLocalCoords); | 1147 return new DashingLineEffect(color, aaMode, localMatrix, usesLocalCoords); |
| 1169 } | 1148 } |
| 1170 | 1149 |
| 1171 void DashingLineEffect::getGLProcessorKey(const GrBatchTracker& bt, | 1150 void DashingLineEffect::getGLProcessorKey(const GrGLSLCaps& caps, |
| 1172 const GrGLSLCaps& caps, | |
| 1173 GrProcessorKeyBuilder* b) const { | 1151 GrProcessorKeyBuilder* b) const { |
| 1174 GLDashingLineEffect::GenKey(*this, bt, caps, b); | 1152 GLDashingLineEffect::GenKey(*this, caps, b); |
| 1175 } | 1153 } |
| 1176 | 1154 |
| 1177 GrGLPrimitiveProcessor* DashingLineEffect::createGLInstance(const GrBatchTracker
& bt, | 1155 GrGLPrimitiveProcessor* DashingLineEffect::createGLInstance(const GrGLSLCaps&) c
onst { |
| 1178 const GrGLSLCaps&) c
onst { | 1156 return new GLDashingLineEffect(); |
| 1179 return new GLDashingLineEffect(*this, bt); | |
| 1180 } | 1157 } |
| 1181 | 1158 |
| 1182 DashingLineEffect::DashingLineEffect(GrColor color, | 1159 DashingLineEffect::DashingLineEffect(GrColor color, |
| 1183 DashAAMode aaMode, | 1160 DashAAMode aaMode, |
| 1184 const SkMatrix& localMatrix, | 1161 const SkMatrix& localMatrix, |
| 1185 bool usesLocalCoords) | 1162 bool usesLocalCoords) |
| 1186 : fColor(color) | 1163 : fColor(color) |
| 1187 , fLocalMatrix(localMatrix) | 1164 , fLocalMatrix(localMatrix) |
| 1188 , fUsesLocalCoords(usesLocalCoords) | 1165 , fUsesLocalCoords(usesLocalCoords) |
| 1189 , fAAMode(aaMode) { | 1166 , fAAMode(aaMode) { |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1297 info.fIntervals = intervals; | 1274 info.fIntervals = intervals; |
| 1298 info.fCount = 2; | 1275 info.fCount = 2; |
| 1299 info.fPhase = phase; | 1276 info.fPhase = phase; |
| 1300 SkDEBUGCODE(bool success = ) strokeInfo.setDashInfo(info); | 1277 SkDEBUGCODE(bool success = ) strokeInfo.setDashInfo(info); |
| 1301 SkASSERT(success); | 1278 SkASSERT(success); |
| 1302 | 1279 |
| 1303 return create_batch(color, viewMatrix, pts, useAA, strokeInfo, msaaRT); | 1280 return create_batch(color, viewMatrix, pts, useAA, strokeInfo, msaaRT); |
| 1304 } | 1281 } |
| 1305 | 1282 |
| 1306 #endif | 1283 #endif |
| OLD | NEW |