| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 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 "GrOvalRenderer.h" | 8 #include "GrOvalRenderer.h" |
| 9 | 9 |
| 10 #include "GrEffect.h" | 10 #include "GrEffect.h" |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 GrGLSLModulatef<4>(&modulate, inputColor, "edgeAlpha"); | 110 GrGLSLModulatef<4>(&modulate, inputColor, "edgeAlpha"); |
| 111 builder->fsCodeAppendf("\t%s = %s;\n", outputColor, modulate.c_str()
); | 111 builder->fsCodeAppendf("\t%s = %s;\n", outputColor, modulate.c_str()
); |
| 112 } | 112 } |
| 113 | 113 |
| 114 static inline EffectKey GenKey(const GrDrawEffect& drawEffect, const GrG
LCaps&) { | 114 static inline EffectKey GenKey(const GrDrawEffect& drawEffect, const GrG
LCaps&) { |
| 115 const CircleEdgeEffect& circleEffect = drawEffect.castEffect<CircleE
dgeEffect>(); | 115 const CircleEdgeEffect& circleEffect = drawEffect.castEffect<CircleE
dgeEffect>(); |
| 116 | 116 |
| 117 return circleEffect.isStroked() ? 0x1 : 0x0; | 117 return circleEffect.isStroked() ? 0x1 : 0x0; |
| 118 } | 118 } |
| 119 | 119 |
| 120 virtual void setData(const GrGLUniformManager&, const GrDrawEffect&) SK_
OVERRIDE {} | 120 virtual void setData(const GrGLContext&, const GrDrawEffect&) SK_OVERRID
E {} |
| 121 | 121 |
| 122 private: | 122 private: |
| 123 typedef GrGLEffect INHERITED; | 123 typedef GrGLEffect INHERITED; |
| 124 }; | 124 }; |
| 125 | 125 |
| 126 | 126 |
| 127 private: | 127 private: |
| 128 CircleEdgeEffect(bool stroke) : GrEffect() { | 128 CircleEdgeEffect(bool stroke) : GrEffect() { |
| 129 this->addVertexAttrib(kVec4f_GrSLType); | 129 this->addVertexAttrib(kVec4f_GrSLType); |
| 130 fStroke = stroke; | 130 fStroke = stroke; |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 242 GrGLSLModulatef<4>(&modulate, inputColor, "edgeAlpha"); | 242 GrGLSLModulatef<4>(&modulate, inputColor, "edgeAlpha"); |
| 243 builder->fsCodeAppendf("\t%s = %s;\n", outputColor, modulate.c_str()
); | 243 builder->fsCodeAppendf("\t%s = %s;\n", outputColor, modulate.c_str()
); |
| 244 } | 244 } |
| 245 | 245 |
| 246 static inline EffectKey GenKey(const GrDrawEffect& drawEffect, const GrG
LCaps&) { | 246 static inline EffectKey GenKey(const GrDrawEffect& drawEffect, const GrG
LCaps&) { |
| 247 const EllipseEdgeEffect& ellipseEffect = drawEffect.castEffect<Ellip
seEdgeEffect>(); | 247 const EllipseEdgeEffect& ellipseEffect = drawEffect.castEffect<Ellip
seEdgeEffect>(); |
| 248 | 248 |
| 249 return ellipseEffect.isStroked() ? 0x1 : 0x0; | 249 return ellipseEffect.isStroked() ? 0x1 : 0x0; |
| 250 } | 250 } |
| 251 | 251 |
| 252 virtual void setData(const GrGLUniformManager&, const GrDrawEffect&) SK_
OVERRIDE { | 252 virtual void setData(const GrGLContext&, const GrDrawEffect&) SK_OVERRID
E { |
| 253 } | 253 } |
| 254 | 254 |
| 255 private: | 255 private: |
| 256 typedef GrGLEffect INHERITED; | 256 typedef GrGLEffect INHERITED; |
| 257 }; | 257 }; |
| 258 | 258 |
| 259 private: | 259 private: |
| 260 EllipseEdgeEffect(bool stroke) : GrEffect() { | 260 EllipseEdgeEffect(bool stroke) : GrEffect() { |
| 261 this->addVertexAttrib(kVec2f_GrSLType); | 261 this->addVertexAttrib(kVec2f_GrSLType); |
| 262 this->addVertexAttrib(kVec4f_GrSLType); | 262 this->addVertexAttrib(kVec4f_GrSLType); |
| (...skipping 587 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 850 } | 850 } |
| 851 | 851 |
| 852 // drop out the middle quad if we're stroked | 852 // drop out the middle quad if we're stroked |
| 853 int indexCnt = isStroked ? GR_ARRAY_COUNT(gRRectIndices)-6 : GR_ARRAY_CO
UNT(gRRectIndices); | 853 int indexCnt = isStroked ? GR_ARRAY_COUNT(gRRectIndices)-6 : GR_ARRAY_CO
UNT(gRRectIndices); |
| 854 target->setIndexSourceToBuffer(indexBuffer); | 854 target->setIndexSourceToBuffer(indexBuffer); |
| 855 target->drawIndexed(kTriangles_GrPrimitiveType, 0, 0, 16, indexCnt, &bou
nds); | 855 target->drawIndexed(kTriangles_GrPrimitiveType, 0, 0, 16, indexCnt, &bou
nds); |
| 856 } | 856 } |
| 857 | 857 |
| 858 return true; | 858 return true; |
| 859 } | 859 } |
| OLD | NEW |