| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 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 "GrAARectRenderer.h" | 8 #include "GrAARectRenderer.h" |
| 9 #include "GrGpu.h" | 9 #include "GrGpu.h" |
| 10 #include "gl/GrGLEffect.h" | 10 #include "gl/GrGLEffect.h" |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 "\tcoverage = coverage*scaleH*clamp((%s.w-abs(%s.y))/spanH, 0.0,
1.0);\n", | 83 "\tcoverage = coverage*scaleH*clamp((%s.w-abs(%s.y))/spanH, 0.0,
1.0);\n", |
| 84 fsRectName, fsRectName); | 84 fsRectName, fsRectName); |
| 85 | 85 |
| 86 | 86 |
| 87 builder->fsCodeAppendf("\t%s = %s;\n", outputColor, | 87 builder->fsCodeAppendf("\t%s = %s;\n", outputColor, |
| 88 (GrGLSLExpr4(inputColor) * GrGLSLExpr1("cover
age")).c_str()); | 88 (GrGLSLExpr4(inputColor) * GrGLSLExpr1("cover
age")).c_str()); |
| 89 } | 89 } |
| 90 | 90 |
| 91 static void GenKey(const GrDrawEffect&, const GrGLCaps&, GrEffectKeyBuil
der*) {} | 91 static void GenKey(const GrDrawEffect&, const GrGLCaps&, GrEffectKeyBuil
der*) {} |
| 92 | 92 |
| 93 virtual void setData(const GrGLUniformManager& uman, const GrDrawEffect&
) SK_OVERRIDE {} | 93 virtual void setData(const GrGLProgramDataManager& pdman, const GrDrawEf
fect&) SK_OVERRIDE {} |
| 94 | 94 |
| 95 private: | 95 private: |
| 96 typedef GrGLVertexEffect INHERITED; | 96 typedef GrGLVertexEffect INHERITED; |
| 97 }; | 97 }; |
| 98 | 98 |
| 99 | 99 |
| 100 private: | 100 private: |
| 101 GrAlignedRectEffect() : GrVertexEffect() { | 101 GrAlignedRectEffect() : GrVertexEffect() { |
| 102 this->addVertexAttrib(kVec4f_GrSLType); | 102 this->addVertexAttrib(kVec4f_GrSLType); |
| 103 } | 103 } |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 214 "\tcoverage = coverage*scaleH*clamp((%s.y-perpDot)/spanH, 0.
0, 1.0);\n", | 214 "\tcoverage = coverage*scaleH*clamp((%s.y-perpDot)/spanH, 0.
0, 1.0);\n", |
| 215 fsWidthHeightName); | 215 fsWidthHeightName); |
| 216 | 216 |
| 217 | 217 |
| 218 builder->fsCodeAppendf("\t%s = %s;\n", outputColor, | 218 builder->fsCodeAppendf("\t%s = %s;\n", outputColor, |
| 219 (GrGLSLExpr4(inputColor) * GrGLSLExpr1("cover
age")).c_str()); | 219 (GrGLSLExpr4(inputColor) * GrGLSLExpr1("cover
age")).c_str()); |
| 220 } | 220 } |
| 221 | 221 |
| 222 static void GenKey(const GrDrawEffect&, const GrGLCaps&, GrEffectKeyBuil
der*) {} | 222 static void GenKey(const GrDrawEffect&, const GrGLCaps&, GrEffectKeyBuil
der*) {} |
| 223 | 223 |
| 224 virtual void setData(const GrGLUniformManager& uman, const GrDrawEffect&
) SK_OVERRIDE {} | 224 virtual void setData(const GrGLProgramDataManager& pdman, const GrDrawEf
fect&) SK_OVERRIDE {} |
| 225 | 225 |
| 226 private: | 226 private: |
| 227 typedef GrGLVertexEffect INHERITED; | 227 typedef GrGLVertexEffect INHERITED; |
| 228 }; | 228 }; |
| 229 | 229 |
| 230 | 230 |
| 231 private: | 231 private: |
| 232 GrRectEffect() : GrVertexEffect() { | 232 GrRectEffect() : GrVertexEffect() { |
| 233 this->addVertexAttrib(kVec4f_GrSLType); | 233 this->addVertexAttrib(kVec4f_GrSLType); |
| 234 this->addVertexAttrib(kVec2f_GrSLType); | 234 this->addVertexAttrib(kVec2f_GrSLType); |
| (...skipping 687 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 922 combinedMatrix.mapPoints((SkPoint*)&devInside, (const SkPoint*)&rects[1], 2)
; | 922 combinedMatrix.mapPoints((SkPoint*)&devInside, (const SkPoint*)&rects[1], 2)
; |
| 923 | 923 |
| 924 if (devInside.isEmpty()) { | 924 if (devInside.isEmpty()) { |
| 925 this->fillAARect(gpu, target, devOutside, SkMatrix::I(), devOutside, use
VertexCoverage); | 925 this->fillAARect(gpu, target, devOutside, SkMatrix::I(), devOutside, use
VertexCoverage); |
| 926 return; | 926 return; |
| 927 } | 927 } |
| 928 | 928 |
| 929 this->geometryStrokeAARect(gpu, target, devOutside, devOutsideAssist, | 929 this->geometryStrokeAARect(gpu, target, devOutside, devOutsideAssist, |
| 930 devInside, useVertexCoverage, true); | 930 devInside, useVertexCoverage, true); |
| 931 } | 931 } |
| OLD | NEW |