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

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

Issue 13895006: Expand modulate, add, subtract, extract component glsl helpers. (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « src/gpu/GrAAConvexPathRenderer.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 2011 Google Inc. 3 * Copyright 2011 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 "GrAAHairLinePathRenderer.h" 9 #include "GrAAHairLinePathRenderer.h"
10 10
(...skipping 542 matching lines...) Expand 10 before | Expand all | Expand 10 after
553 builder->fsCodeAppendf("\t\tvec2 duvdy = dFdy(%s.xy);\n", fsName); 553 builder->fsCodeAppendf("\t\tvec2 duvdy = dFdy(%s.xy);\n", fsName);
554 builder->fsCodeAppendf("\t\tvec2 gF = vec2(2.0*%s.x*duvdx.x - duvdx. y,\n" 554 builder->fsCodeAppendf("\t\tvec2 gF = vec2(2.0*%s.x*duvdx.x - duvdx. y,\n"
555 "\t\t 2.0*%s.x*duvdy.x - duvdy. y);\n", 555 "\t\t 2.0*%s.x*duvdy.x - duvdy. y);\n",
556 fsName, fsName); 556 fsName, fsName);
557 builder->fsCodeAppendf("\t\tedgeAlpha = (%s.x*%s.x - %s.y);\n", fsNa me, fsName, 557 builder->fsCodeAppendf("\t\tedgeAlpha = (%s.x*%s.x - %s.y);\n", fsNa me, fsName,
558 fsName); 558 fsName);
559 builder->fsCodeAppend("\t\tedgeAlpha = sqrt(edgeAlpha*edgeAlpha / do t(gF, gF));\n"); 559 builder->fsCodeAppend("\t\tedgeAlpha = sqrt(edgeAlpha*edgeAlpha / do t(gF, gF));\n");
560 builder->fsCodeAppend("\t\tedgeAlpha = max(1.0 - edgeAlpha, 0.0);\n" ); 560 builder->fsCodeAppend("\t\tedgeAlpha = max(1.0 - edgeAlpha, 0.0);\n" );
561 561
562 SkString modulate; 562 SkString modulate;
563 GrGLSLModulate4f(&modulate, inputColor, "edgeAlpha"); 563 GrGLSLModulatef<4>(&modulate, inputColor, "edgeAlpha");
564 builder->fsCodeAppendf("\t%s = %s;\n", outputColor, modulate.c_str() ); 564 builder->fsCodeAppendf("\t%s = %s;\n", outputColor, modulate.c_str() );
565 565
566 builder->vsCodeAppendf("\t%s = %s;\n", vsName, attrName->c_str()); 566 builder->vsCodeAppendf("\t%s = %s;\n", vsName, attrName->c_str());
567 } 567 }
568 568
569 static inline EffectKey GenKey(const GrDrawEffect& drawEffect, const GrG LCaps&) { 569 static inline EffectKey GenKey(const GrDrawEffect& drawEffect, const GrG LCaps&) {
570 return 0x0; 570 return 0x0;
571 } 571 }
572 572
573 virtual void setData(const GrGLUniformManager&, const GrDrawEffect&) SK_ OVERRIDE {} 573 virtual void setData(const GrGLUniformManager&, const GrDrawEffect&) SK_ OVERRIDE {}
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
646 builder->getEffectAttributeName(drawEffect.getVertexAttribIndice s()[0]); 646 builder->getEffectAttributeName(drawEffect.getVertexAttribIndice s()[0]);
647 builder->fsCodeAppendf("\t\tfloat edgeAlpha;\n"); 647 builder->fsCodeAppendf("\t\tfloat edgeAlpha;\n");
648 648
649 builder->addVarying(kVec4f_GrSLType, "HairLineEdge", &vsName, &fsNam e); 649 builder->addVarying(kVec4f_GrSLType, "HairLineEdge", &vsName, &fsNam e);
650 650
651 builder->fsCodeAppendf("\t\tedgeAlpha = abs(dot(vec3(%s.xy,1), %s.xy z));\n", 651 builder->fsCodeAppendf("\t\tedgeAlpha = abs(dot(vec3(%s.xy,1), %s.xy z));\n",
652 builder->fragmentPosition(), fsName); 652 builder->fragmentPosition(), fsName);
653 builder->fsCodeAppendf("\t\tedgeAlpha = max(1.0 - edgeAlpha, 0.0);\n "); 653 builder->fsCodeAppendf("\t\tedgeAlpha = max(1.0 - edgeAlpha, 0.0);\n ");
654 654
655 SkString modulate; 655 SkString modulate;
656 GrGLSLModulate4f(&modulate, inputColor, "edgeAlpha"); 656 GrGLSLModulatef<4>(&modulate, inputColor, "edgeAlpha");
657 builder->fsCodeAppendf("\t%s = %s;\n", outputColor, modulate.c_str() ); 657 builder->fsCodeAppendf("\t%s = %s;\n", outputColor, modulate.c_str() );
658 658
659 builder->vsCodeAppendf("\t%s = %s;\n", vsName, attrName->c_str()); 659 builder->vsCodeAppendf("\t%s = %s;\n", vsName, attrName->c_str());
660 } 660 }
661 661
662 static inline EffectKey GenKey(const GrDrawEffect& drawEffect, const GrG LCaps&) { 662 static inline EffectKey GenKey(const GrDrawEffect& drawEffect, const GrG LCaps&) {
663 return 0x0; 663 return 0x0;
664 } 664 }
665 665
666 virtual void setData(const GrGLUniformManager&, const GrDrawEffect&) SK_ OVERRIDE {} 666 virtual void setData(const GrGLUniformManager&, const GrDrawEffect&) SK_ OVERRIDE {}
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
839 4 * lineCnt + kVertsPerQuad*quads, // startV 839 4 * lineCnt + kVertsPerQuad*quads, // startV
840 0, // startI 840 0, // startI
841 kVertsPerQuad*n, // vCount 841 kVertsPerQuad*n, // vCount
842 kIdxsPerQuad*n); // iCount 842 kIdxsPerQuad*n); // iCount
843 quads += n; 843 quads += n;
844 } 844 }
845 target->resetIndexSource(); 845 target->resetIndexSource();
846 846
847 return true; 847 return true;
848 } 848 }
OLDNEW
« no previous file with comments | « src/gpu/GrAAConvexPathRenderer.cpp ('k') | src/gpu/GrAARectRenderer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698