OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2012 Google Inc. | 3 * Copyright 2012 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 #include "GrAAConvexPathRenderer.h" | 9 #include "GrAAConvexPathRenderer.h" |
10 | 10 |
(...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
526 return GrTBackendEffectFactory<QuadEdgeEffect>::getInstance(); | 526 return GrTBackendEffectFactory<QuadEdgeEffect>::getInstance(); |
527 } | 527 } |
528 | 528 |
529 class GLEffect : public GrGLVertexEffect { | 529 class GLEffect : public GrGLVertexEffect { |
530 public: | 530 public: |
531 GLEffect(const GrBackendEffectFactory& factory, const GrDrawEffect&) | 531 GLEffect(const GrBackendEffectFactory& factory, const GrDrawEffect&) |
532 : INHERITED (factory) {} | 532 : INHERITED (factory) {} |
533 | 533 |
534 virtual void emitCode(GrGLFullShaderBuilder* builder, | 534 virtual void emitCode(GrGLFullShaderBuilder* builder, |
535 const GrDrawEffect& drawEffect, | 535 const GrDrawEffect& drawEffect, |
536 EffectKey key, | 536 const GrEffectKey& key, |
537 const char* outputColor, | 537 const char* outputColor, |
538 const char* inputColor, | 538 const char* inputColor, |
539 const TransformedCoordsArray&, | 539 const TransformedCoordsArray&, |
540 const TextureSamplerArray& samplers) SK_OVERRIDE { | 540 const TextureSamplerArray& samplers) SK_OVERRIDE { |
541 const char *vsName, *fsName; | 541 const char *vsName, *fsName; |
542 const SkString* attrName = | 542 const SkString* attrName = |
543 builder->getEffectAttributeName(drawEffect.getVertexAttribIndice
s()[0]); | 543 builder->getEffectAttributeName(drawEffect.getVertexAttribIndice
s()[0]); |
544 builder->fsCodeAppendf("\t\tfloat edgeAlpha;\n"); | 544 builder->fsCodeAppendf("\t\tfloat edgeAlpha;\n"); |
545 | 545 |
546 SkAssertResult(builder->enableFeature( | 546 SkAssertResult(builder->enableFeature( |
(...skipping 16 matching lines...) Expand all Loading... |
563 builder->fsCodeAppendf("\t\t\tedgeAlpha = " | 563 builder->fsCodeAppendf("\t\t\tedgeAlpha = " |
564 "clamp(0.5 - edgeAlpha / length(gF), 0.0, 1.0
);\n\t\t}\n"); | 564 "clamp(0.5 - edgeAlpha / length(gF), 0.0, 1.0
);\n\t\t}\n"); |
565 | 565 |
566 | 566 |
567 builder->fsCodeAppendf("\t%s = %s;\n", outputColor, | 567 builder->fsCodeAppendf("\t%s = %s;\n", outputColor, |
568 (GrGLSLExpr4(inputColor) * GrGLSLExpr1("edgeA
lpha")).c_str()); | 568 (GrGLSLExpr4(inputColor) * GrGLSLExpr1("edgeA
lpha")).c_str()); |
569 | 569 |
570 builder->vsCodeAppendf("\t%s = %s;\n", vsName, attrName->c_str()); | 570 builder->vsCodeAppendf("\t%s = %s;\n", vsName, attrName->c_str()); |
571 } | 571 } |
572 | 572 |
573 static inline EffectKey GenKey(const GrDrawEffect& drawEffect, const GrG
LCaps&) { | 573 static inline void GenKey(const GrDrawEffect&, const GrGLCaps&, GrEffect
KeyBuilder*) {} |
574 return 0x0; | |
575 } | |
576 | 574 |
577 virtual void setData(const GrGLUniformManager&, const GrDrawEffect&) SK_
OVERRIDE {} | 575 virtual void setData(const GrGLUniformManager&, const GrDrawEffect&) SK_
OVERRIDE {} |
578 | 576 |
579 private: | 577 private: |
580 typedef GrGLVertexEffect INHERITED; | 578 typedef GrGLVertexEffect INHERITED; |
581 }; | 579 }; |
582 | 580 |
583 private: | 581 private: |
584 QuadEdgeEffect() { | 582 QuadEdgeEffect() { |
585 this->addVertexAttrib(kVec4f_GrSLType); | 583 this->addVertexAttrib(kVec4f_GrSLType); |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
709 vOffset, // start vertex | 707 vOffset, // start vertex |
710 0, // start index | 708 0, // start index |
711 draw.fVertexCnt, | 709 draw.fVertexCnt, |
712 draw.fIndexCnt, | 710 draw.fIndexCnt, |
713 &devBounds); | 711 &devBounds); |
714 vOffset += draw.fVertexCnt; | 712 vOffset += draw.fVertexCnt; |
715 } | 713 } |
716 | 714 |
717 return true; | 715 return true; |
718 } | 716 } |
OLD | NEW |