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 "gl/builders/GrGLProgramBuilder.h" | 10 #include "gl/builders/GrGLProgramBuilder.h" |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 | 133 |
134 private: | 134 private: |
135 CircleEdgeEffect(bool stroke) | 135 CircleEdgeEffect(bool stroke) |
136 : fInCircleEdge(this->addVertexAttrib( | 136 : fInCircleEdge(this->addVertexAttrib( |
137 GrShaderVar("inCircleEdge", | 137 GrShaderVar("inCircleEdge", |
138 kVec4f_GrSLType, | 138 kVec4f_GrSLType, |
139 GrShaderVar::kAttribute_TypeModifier))) { | 139 GrShaderVar::kAttribute_TypeModifier))) { |
140 fStroke = stroke; | 140 fStroke = stroke; |
141 } | 141 } |
142 | 142 |
143 virtual bool onIsEqual(const GrProcessor& other) const SK_OVERRIDE { | 143 virtual bool onIsEqual(const GrGeometryProcessor& other) const SK_OVERRIDE { |
144 const CircleEdgeEffect& cee = other.cast<CircleEdgeEffect>(); | 144 const CircleEdgeEffect& cee = other.cast<CircleEdgeEffect>(); |
145 return cee.fStroke == fStroke; | 145 return cee.fStroke == fStroke; |
146 } | 146 } |
147 | 147 |
148 virtual void onComputeInvariantOutput(InvariantOutput* inout) const SK_OVERR
IDE { | 148 virtual void onComputeInvariantOutput(InvariantOutput* inout) const SK_OVERR
IDE { |
149 inout->mulByUnknownAlpha(); | 149 inout->mulByUnknownAlpha(); |
150 } | 150 } |
151 | 151 |
152 const GrShaderVar& fInCircleEdge; | 152 const GrShaderVar& fInCircleEdge; |
153 bool fStroke; | 153 bool fStroke; |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
273 GrShaderVar("inEllipseOffset", | 273 GrShaderVar("inEllipseOffset", |
274 kVec2f_GrSLType, | 274 kVec2f_GrSLType, |
275 GrShaderVar::kAttribute_TypeModifier))) | 275 GrShaderVar::kAttribute_TypeModifier))) |
276 , fInEllipseRadii(this->addVertexAttrib( | 276 , fInEllipseRadii(this->addVertexAttrib( |
277 GrShaderVar("inEllipseRadii", | 277 GrShaderVar("inEllipseRadii", |
278 kVec4f_GrSLType, | 278 kVec4f_GrSLType, |
279 GrShaderVar::kAttribute_TypeModifier))) { | 279 GrShaderVar::kAttribute_TypeModifier))) { |
280 fStroke = stroke; | 280 fStroke = stroke; |
281 } | 281 } |
282 | 282 |
283 virtual bool onIsEqual(const GrProcessor& other) const SK_OVERRIDE { | 283 virtual bool onIsEqual(const GrGeometryProcessor& other) const SK_OVERRIDE { |
284 const EllipseEdgeEffect& eee = other.cast<EllipseEdgeEffect>(); | 284 const EllipseEdgeEffect& eee = other.cast<EllipseEdgeEffect>(); |
285 return eee.fStroke == fStroke; | 285 return eee.fStroke == fStroke; |
286 } | 286 } |
287 | 287 |
288 virtual void onComputeInvariantOutput(InvariantOutput* inout) const SK_OVERR
IDE { | 288 virtual void onComputeInvariantOutput(InvariantOutput* inout) const SK_OVERR
IDE { |
289 inout->mulByUnknownAlpha(); | 289 inout->mulByUnknownAlpha(); |
290 } | 290 } |
291 | 291 |
292 const GrShaderVar& fInEllipseOffset; | 292 const GrShaderVar& fInEllipseOffset; |
293 const GrShaderVar& fInEllipseRadii; | 293 const GrShaderVar& fInEllipseRadii; |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
441 GrShaderVar("inEllipseOffsets0", | 441 GrShaderVar("inEllipseOffsets0", |
442 kVec2f_GrSLType, | 442 kVec2f_GrSLType, |
443 GrShaderVar::kAttribute_TypeModifier))) | 443 GrShaderVar::kAttribute_TypeModifier))) |
444 , fInEllipseOffsets1(this->addVertexAttrib( | 444 , fInEllipseOffsets1(this->addVertexAttrib( |
445 GrShaderVar("inEllipseOffsets1", | 445 GrShaderVar("inEllipseOffsets1", |
446 kVec2f_GrSLType, | 446 kVec2f_GrSLType, |
447 GrShaderVar::kAttribute_TypeModifier))) { | 447 GrShaderVar::kAttribute_TypeModifier))) { |
448 fMode = mode; | 448 fMode = mode; |
449 } | 449 } |
450 | 450 |
451 virtual bool onIsEqual(const GrProcessor& other) const SK_OVERRIDE { | 451 virtual bool onIsEqual(const GrGeometryProcessor& other) const SK_OVERRIDE { |
452 const DIEllipseEdgeEffect& eee = other.cast<DIEllipseEdgeEffect>(); | 452 const DIEllipseEdgeEffect& eee = other.cast<DIEllipseEdgeEffect>(); |
453 return eee.fMode == fMode; | 453 return eee.fMode == fMode; |
454 } | 454 } |
455 | 455 |
456 virtual void onComputeInvariantOutput(InvariantOutput* inout) const SK_OVERR
IDE { | 456 virtual void onComputeInvariantOutput(InvariantOutput* inout) const SK_OVERR
IDE { |
457 inout->mulByUnknownAlpha(); | 457 inout->mulByUnknownAlpha(); |
458 } | 458 } |
459 | 459 |
460 const GrShaderVar& fInEllipseOffsets0; | 460 const GrShaderVar& fInEllipseOffsets0; |
461 const GrShaderVar& fInEllipseOffsets1; | 461 const GrShaderVar& fInEllipseOffsets1; |
(...skipping 772 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1234 | 1234 |
1235 // drop out the middle quad if we're stroked | 1235 // drop out the middle quad if we're stroked |
1236 int indexCnt = isStrokeOnly ? SK_ARRAY_COUNT(gRRectIndices) - 6 : | 1236 int indexCnt = isStrokeOnly ? SK_ARRAY_COUNT(gRRectIndices) - 6 : |
1237 SK_ARRAY_COUNT(gRRectIndices); | 1237 SK_ARRAY_COUNT(gRRectIndices); |
1238 target->setIndexSourceToBuffer(indexBuffer); | 1238 target->setIndexSourceToBuffer(indexBuffer); |
1239 target->drawIndexed(kTriangles_GrPrimitiveType, 0, 0, 16, indexCnt, &bou
nds); | 1239 target->drawIndexed(kTriangles_GrPrimitiveType, 0, 0, 16, indexCnt, &bou
nds); |
1240 } | 1240 } |
1241 | 1241 |
1242 return true; | 1242 return true; |
1243 } | 1243 } |
OLD | NEW |