diff options
author | 2015-04-15 13:41:31 -0700 | |
---|---|---|
committer | 2015-04-15 13:41:31 -0700 | |
commit | bc0273524b039c45dcea2c1ab5ab379c75486c07 (patch) | |
tree | 7bdd916b4a9939206217db5fe7bf554eb7e0a2a5 | |
parent | a0246165eab9018d07afc09ff826ea4c40898ebc (diff) |
Fix LCD text and add path fix for Mali.
dFdy(st.y) produces negative values, so we need to take
abs() to get the right inverse scale.
BUG=skia:3528
Review URL: https://codereview.chromium.org/1086183002
-rwxr-xr-x | src/gpu/effects/GrDistanceFieldGeoProc.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/gpu/effects/GrDistanceFieldGeoProc.cpp b/src/gpu/effects/GrDistanceFieldGeoProc.cpp index 05e42c9240..ed087ddbd4 100755 --- a/src/gpu/effects/GrDistanceFieldGeoProc.cpp +++ b/src/gpu/effects/GrDistanceFieldGeoProc.cpp @@ -365,7 +365,7 @@ public: // to ensure we're mapping 1:1 from texel space to pixel space. // this gives us a smooth step across approximately one fragment - fsBuilder->codeAppend("afwidth = abs(" SK_DistanceFieldAAFactor "*dFdx(st.x));"); + fsBuilder->codeAppend("afwidth = abs(" SK_DistanceFieldAAFactor "*dFdy(st.y));"); } else { // For general transforms, to determine the amount of correction we multiply a unit // vector pointing along the SDF gradient direction by the Jacobian of the st coords @@ -605,7 +605,7 @@ public: fsBuilder->codeAppend("float delta = " GR_FONT_ATLAS_LCD_DELTA ";\n"); } if (isUniformScale) { - fsBuilder->codeAppendf("float dy = dFdy(%s.y);", st.fsIn()); + fsBuilder->codeAppendf("float dy = abs(dFdy(%s.y));", st.fsIn()); fsBuilder->codeAppend("vec2 offset = vec2(dy*delta, 0.0);"); } else { fsBuilder->codeAppendf("vec2 st = %s;\n", st.fsIn()); @@ -655,7 +655,7 @@ public: // to ensure we're mapping 1:1 from texel space to pixel space. // this gives us a smooth step across approximately one fragment - fsBuilder->codeAppend("afwidth = abs(" SK_DistanceFieldAAFactor "*dy);"); + fsBuilder->codeAppend("afwidth = " SK_DistanceFieldAAFactor "*dy;"); } else { // For general transforms, to determine the amount of correction we multiply a unit // vector pointing along the SDF gradient direction by the Jacobian of the st coords |