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