Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: src/gpu/GrAAConvexPathRenderer.cpp

Issue 385713005: Allow GrGLEffects to produce variable length keys. (Closed) Base URL: https://skia.googlesource.com/skia.git@key
Patch Set: rebase Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/effects/gradients/SkTwoPointRadialGradient.cpp ('k') | src/gpu/GrAARectRenderer.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
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 }
OLDNEW
« no previous file with comments | « src/effects/gradients/SkTwoPointRadialGradient.cpp ('k') | src/gpu/GrAARectRenderer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698