| 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 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 builder->fsCodeAppendf("\t%s = %s;\n", outputColor, | 120 builder->fsCodeAppendf("\t%s = %s;\n", outputColor, |
| 121 (GrGLSLExpr4(inputColor) * GrGLSLExpr1("edgeA
lpha")).c_str()); | 121 (GrGLSLExpr4(inputColor) * GrGLSLExpr1("edgeA
lpha")).c_str()); |
| 122 } | 122 } |
| 123 | 123 |
| 124 static void GenKey(const GrDrawEffect& drawEffect, const GrGLCaps&, | 124 static void GenKey(const GrDrawEffect& drawEffect, const GrGLCaps&, |
| 125 GrEffectKeyBuilder* b) { | 125 GrEffectKeyBuilder* b) { |
| 126 const CircleEdgeEffect& circleEffect = drawEffect.castEffect<CircleE
dgeEffect>(); | 126 const CircleEdgeEffect& circleEffect = drawEffect.castEffect<CircleE
dgeEffect>(); |
| 127 b->add32(circleEffect.isStroked()); | 127 b->add32(circleEffect.isStroked()); |
| 128 } | 128 } |
| 129 | 129 |
| 130 virtual void setData(const GrGLUniformManager&, const GrDrawEffect&) SK_
OVERRIDE {} | 130 virtual void setData(const GrGLProgramDataManager&, const GrDrawEffect&)
SK_OVERRIDE {} |
| 131 | 131 |
| 132 private: | 132 private: |
| 133 typedef GrGLVertexEffect INHERITED; | 133 typedef GrGLVertexEffect INHERITED; |
| 134 }; | 134 }; |
| 135 | 135 |
| 136 | 136 |
| 137 private: | 137 private: |
| 138 CircleEdgeEffect(bool stroke) : GrVertexEffect() { | 138 CircleEdgeEffect(bool stroke) : GrVertexEffect() { |
| 139 this->addVertexAttrib(kVec4f_GrSLType); | 139 this->addVertexAttrib(kVec4f_GrSLType); |
| 140 fStroke = stroke; | 140 fStroke = stroke; |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 250 builder->fsCodeAppendf("\t%s = %s;\n", outputColor, | 250 builder->fsCodeAppendf("\t%s = %s;\n", outputColor, |
| 251 (GrGLSLExpr4(inputColor) * GrGLSLExpr1("edgeA
lpha")).c_str()); | 251 (GrGLSLExpr4(inputColor) * GrGLSLExpr1("edgeA
lpha")).c_str()); |
| 252 } | 252 } |
| 253 | 253 |
| 254 static void GenKey(const GrDrawEffect& drawEffect, const GrGLCaps&, | 254 static void GenKey(const GrDrawEffect& drawEffect, const GrGLCaps&, |
| 255 GrEffectKeyBuilder* b) { | 255 GrEffectKeyBuilder* b) { |
| 256 const EllipseEdgeEffect& ellipseEffect = drawEffect.castEffect<Ellip
seEdgeEffect>(); | 256 const EllipseEdgeEffect& ellipseEffect = drawEffect.castEffect<Ellip
seEdgeEffect>(); |
| 257 b->add32(ellipseEffect.isStroked()); | 257 b->add32(ellipseEffect.isStroked()); |
| 258 } | 258 } |
| 259 | 259 |
| 260 virtual void setData(const GrGLUniformManager&, const GrDrawEffect&) SK_
OVERRIDE { | 260 virtual void setData(const GrGLProgramDataManager&, const GrDrawEffect&)
SK_OVERRIDE { |
| 261 } | 261 } |
| 262 | 262 |
| 263 private: | 263 private: |
| 264 typedef GrGLVertexEffect INHERITED; | 264 typedef GrGLVertexEffect INHERITED; |
| 265 }; | 265 }; |
| 266 | 266 |
| 267 private: | 267 private: |
| 268 EllipseEdgeEffect(bool stroke) : GrVertexEffect() { | 268 EllipseEdgeEffect(bool stroke) : GrVertexEffect() { |
| 269 this->addVertexAttrib(kVec2f_GrSLType); | 269 this->addVertexAttrib(kVec2f_GrSLType); |
| 270 this->addVertexAttrib(kVec4f_GrSLType); | 270 this->addVertexAttrib(kVec4f_GrSLType); |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 408 } | 408 } |
| 409 | 409 |
| 410 static void GenKey(const GrDrawEffect& drawEffect, const GrGLCaps&, | 410 static void GenKey(const GrDrawEffect& drawEffect, const GrGLCaps&, |
| 411 GrEffectKeyBuilder* b) { | 411 GrEffectKeyBuilder* b) { |
| 412 const DIEllipseEdgeEffect& ellipseEffect = | 412 const DIEllipseEdgeEffect& ellipseEffect = |
| 413 drawEffect.castEffect<DIEllipseEdgeEffect>(); | 413 drawEffect.castEffect<DIEllipseEdgeEffect>(); |
| 414 | 414 |
| 415 b->add32(ellipseEffect.getMode()); | 415 b->add32(ellipseEffect.getMode()); |
| 416 } | 416 } |
| 417 | 417 |
| 418 virtual void setData(const GrGLUniformManager&, const GrDrawEffect&) SK_
OVERRIDE { | 418 virtual void setData(const GrGLProgramDataManager&, const GrDrawEffect&)
SK_OVERRIDE { |
| 419 } | 419 } |
| 420 | 420 |
| 421 private: | 421 private: |
| 422 typedef GrGLVertexEffect INHERITED; | 422 typedef GrGLVertexEffect INHERITED; |
| 423 }; | 423 }; |
| 424 | 424 |
| 425 private: | 425 private: |
| 426 DIEllipseEdgeEffect(Mode mode) : GrVertexEffect() { | 426 DIEllipseEdgeEffect(Mode mode) : GrVertexEffect() { |
| 427 this->addVertexAttrib(kVec2f_GrSLType); | 427 this->addVertexAttrib(kVec2f_GrSLType); |
| 428 this->addVertexAttrib(kVec2f_GrSLType); | 428 this->addVertexAttrib(kVec2f_GrSLType); |
| (...skipping 789 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1218 | 1218 |
| 1219 // drop out the middle quad if we're stroked | 1219 // drop out the middle quad if we're stroked |
| 1220 int indexCnt = isStrokeOnly ? SK_ARRAY_COUNT(gRRectIndices) - 6 : | 1220 int indexCnt = isStrokeOnly ? SK_ARRAY_COUNT(gRRectIndices) - 6 : |
| 1221 SK_ARRAY_COUNT(gRRectIndices); | 1221 SK_ARRAY_COUNT(gRRectIndices); |
| 1222 target->setIndexSourceToBuffer(indexBuffer); | 1222 target->setIndexSourceToBuffer(indexBuffer); |
| 1223 target->drawIndexed(kTriangles_GrPrimitiveType, 0, 0, 16, indexCnt, &bou
nds); | 1223 target->drawIndexed(kTriangles_GrPrimitiveType, 0, 0, 16, indexCnt, &bou
nds); |
| 1224 } | 1224 } |
| 1225 | 1225 |
| 1226 return true; | 1226 return true; |
| 1227 } | 1227 } |
| OLD | NEW |