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 "GrRefCnt.h" | 9 #include "GrRefCnt.h" |
10 #include "GrGpu.h" | 10 #include "GrGpu.h" |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 fsWidthHeightName); | 93 fsWidthHeightName); |
94 | 94 |
95 // Compute the coverage for the rect's height and merge with the wid
th | 95 // Compute the coverage for the rect's height and merge with the wid
th |
96 builder->fsCodeAppendf("\tperpDot = abs(dot(offset, %s.zw));\n", | 96 builder->fsCodeAppendf("\tperpDot = abs(dot(offset, %s.zw));\n", |
97 fsRectEdgeName); | 97 fsRectEdgeName); |
98 builder->fsCodeAppendf( | 98 builder->fsCodeAppendf( |
99 "\tcoverage = min(coverage, clamp(hScale*(%s.y-perpDot), 0.0
, 1.0));\n", | 99 "\tcoverage = min(coverage, clamp(hScale*(%s.y-perpDot), 0.0
, 1.0));\n", |
100 fsWidthHeightName); | 100 fsWidthHeightName); |
101 | 101 |
102 SkString modulate; | 102 SkString modulate; |
103 GrGLSLModulate4f(&modulate, inputColor, "coverage"); | 103 GrGLSLModulatef<4>(&modulate, inputColor, "coverage"); |
104 builder->fsCodeAppendf("\t%s = %s;\n", outputColor, modulate.c_str()
); | 104 builder->fsCodeAppendf("\t%s = %s;\n", outputColor, modulate.c_str()
); |
105 } | 105 } |
106 | 106 |
107 static inline EffectKey GenKey(const GrDrawEffect& drawEffect, const GrG
LCaps&) { | 107 static inline EffectKey GenKey(const GrDrawEffect& drawEffect, const GrG
LCaps&) { |
108 return 0; | 108 return 0; |
109 } | 109 } |
110 | 110 |
111 virtual void setData(const GrGLUniformManager& uman, const GrDrawEffect&
) SK_OVERRIDE {} | 111 virtual void setData(const GrGLUniformManager& uman, const GrDrawEffect&
) SK_OVERRIDE {} |
112 | 112 |
113 private: | 113 private: |
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
480 // The innermost rect has full coverage | 480 // The innermost rect has full coverage |
481 verts += 8 * vsize; | 481 verts += 8 * vsize; |
482 for (int i = 0; i < 4; ++i) { | 482 for (int i = 0; i < 4; ++i) { |
483 *reinterpret_cast<GrColor*>(verts + i * vsize) = 0; | 483 *reinterpret_cast<GrColor*>(verts + i * vsize) = 0; |
484 } | 484 } |
485 | 485 |
486 target->setIndexSourceToBuffer(indexBuffer); | 486 target->setIndexSourceToBuffer(indexBuffer); |
487 target->drawIndexed(kTriangles_GrPrimitiveType, | 487 target->drawIndexed(kTriangles_GrPrimitiveType, |
488 0, 0, 16, aaStrokeRectIndexCount()); | 488 0, 0, 16, aaStrokeRectIndexCount()); |
489 } | 489 } |
OLD | NEW |