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

Side by Side Diff: src/gpu/effects/GrDistanceFieldGeoProc.cpp

Issue 2340603003: Remove "f" suffix from literal in LCD DF text shader. (Closed)
Patch Set: Address comment Created 4 years, 3 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/gpu/effects/GrDistanceFieldGeoProc.h ('k') | no next file » | 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 * 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 "GrDistanceFieldGeoProc.h" 8 #include "GrDistanceFieldGeoProc.h"
9 #include "GrInvariantOutput.h" 9 #include "GrInvariantOutput.h"
10 #include "GrTexture.h" 10 #include "GrTexture.h"
(...skipping 702 matching lines...) Expand 10 before | Expand all | Expand 10 after
713 713
714 // this gives us a smooth step across approximately one fragment 714 // this gives us a smooth step across approximately one fragment
715 fragBuilder->codeAppend("afwidth = " SK_DistanceFieldAAFactor "*leng th(grad);"); 715 fragBuilder->codeAppend("afwidth = " SK_DistanceFieldAAFactor "*leng th(grad);");
716 } 716 }
717 717
718 // The smoothstep falloff compensates for the non-linear sRGB response c urve. If we are 718 // The smoothstep falloff compensates for the non-linear sRGB response c urve. If we are
719 // doing gamma-correct rendering (to an sRGB or F16 buffer), then we act ually want distance 719 // doing gamma-correct rendering (to an sRGB or F16 buffer), then we act ually want distance
720 // mapped linearly to coverage, so use a linear step: 720 // mapped linearly to coverage, so use a linear step:
721 if (isGammaCorrect) { 721 if (isGammaCorrect) {
722 fragBuilder->codeAppend("vec4 val = " 722 fragBuilder->codeAppend("vec4 val = "
723 "vec4(clamp(distance + vec3(afwidth) / vec3(2.0 * afwidth), 0.0, 1.0), 1.0f);"); 723 "vec4(clamp(distance + vec3(afwidth) / vec3(2.0 * afwidth), 0.0, 1.0), 1.0);");
724 } else { 724 } else {
725 fragBuilder->codeAppend( 725 fragBuilder->codeAppend(
726 "vec4 val = vec4(smoothstep(vec3(-afwidth), vec3(afwidth), dista nce), 1.0);"); 726 "vec4 val = vec4(smoothstep(vec3(-afwidth), vec3(afwidth), dista nce), 1.0);");
727 } 727 }
728 728
729 // set alpha to be max of rgb coverage 729 // set alpha to be max of rgb coverage
730 fragBuilder->codeAppend("val.a = max(max(val.r, val.g), val.b);"); 730 fragBuilder->codeAppend("val.a = max(max(val.r, val.g), val.b);");
731 731
732 fragBuilder->codeAppendf("%s = val;", args.fOutputCoverage); 732 fragBuilder->codeAppendf("%s = val;", args.fOutputCoverage);
733 } 733 }
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
839 flags |= d->fRandom->nextBool() ? kScaleOnly_DistanceFieldEffectFlag : 0 ; 839 flags |= d->fRandom->nextBool() ? kScaleOnly_DistanceFieldEffectFlag : 0 ;
840 } 840 }
841 flags |= d->fRandom->nextBool() ? kBGR_DistanceFieldEffectFlag : 0; 841 flags |= d->fRandom->nextBool() ? kBGR_DistanceFieldEffectFlag : 0;
842 return GrDistanceFieldLCDTextGeoProc::Make(GrRandomColor(d->fRandom), 842 return GrDistanceFieldLCDTextGeoProc::Make(GrRandomColor(d->fRandom),
843 GrTest::TestMatrix(d->fRandom), 843 GrTest::TestMatrix(d->fRandom),
844 d->fTextures[texIdx], params, 844 d->fTextures[texIdx], params,
845 wa, 845 wa,
846 flags, 846 flags,
847 d->fRandom->nextBool()); 847 d->fRandom->nextBool());
848 } 848 }
OLDNEW
« no previous file with comments | « src/gpu/effects/GrDistanceFieldGeoProc.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698