aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar jvanverth <jvanverth@google.com>2016-09-12 10:09:16 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-09-12 10:09:16 -0700
commitdb85665578f19dde2779842488b3054da9b0b7e2 (patch)
treedcd13cf3a3413e0b437512de72a93e93bb4620f1 /src
parent1a1aa9303484106a955e5549bf8ae24950f54e7a (diff)
Fix GaussianEdgeShader GLSL code
Implicit conversion of int constants to float is not always guaranteed GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2328263004 TBR=herbderby@google.com NOTRY=true NOTREECHECKS=true Review-Url: https://codereview.chromium.org/2328263004
Diffstat (limited to 'src')
-rw-r--r--src/effects/SkGaussianEdgeShader.cpp22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/effects/SkGaussianEdgeShader.cpp b/src/effects/SkGaussianEdgeShader.cpp
index a7c27004be..3e582be829 100644
--- a/src/effects/SkGaussianEdgeShader.cpp
+++ b/src/effects/SkGaussianEdgeShader.cpp
@@ -86,26 +86,26 @@ public:
fragBuilder->codeAppendf("// GP does not implement fsDistanceVector - "
" returning grey in GLSLGaussianEdgeFP\n");
fragBuilder->codeAppendf("vec4 color = %s;", args.fInputColor);
- fragBuilder->codeAppendf("%s = vec4(0, 0, 0, color.r);", args.fOutputColor);
+ fragBuilder->codeAppendf("%s = vec4(0.0, 0.0, 0.0, color.r);", args.fOutputColor);
} else if (fLargerBlur) {
fragBuilder->codeAppendf("vec4 color = %s;", args.fInputColor);
- fragBuilder->codeAppend("float radius = color.r*256*64 + color.g*64;");
- fragBuilder->codeAppend("float pad = color.b*64;");
+ fragBuilder->codeAppend("float radius = color.r*256.0*64.0 + color.g*64.0;");
+ fragBuilder->codeAppend("float pad = color.b*64.0;");
- fragBuilder->codeAppendf("float factor = 1 - clamp((%s.z - pad)/radius, 0, 1);",
+ fragBuilder->codeAppendf("float factor = 1.0 - clamp((%s.z - pad)/radius, 0.0, 1.0);",
fragBuilder->distanceVectorName());
- fragBuilder->codeAppend("factor = exp(-factor * factor * 4) - 0.018;");
- fragBuilder->codeAppendf("%s = factor*vec4(0, 0, 0, color.a);",
+ fragBuilder->codeAppend("factor = exp(-factor * factor * 4.0) - 0.018;");
+ fragBuilder->codeAppendf("%s = factor*vec4(0.0, 0.0, 0.0, color.a);",
args.fOutputColor);
} else {
fragBuilder->codeAppendf("vec4 color = %s;", args.fInputColor);
- fragBuilder->codeAppend("float radius = color.g*64;");
- fragBuilder->codeAppend("float pad = color.b*64;");
+ fragBuilder->codeAppend("float radius = color.g*64.0;");
+ fragBuilder->codeAppend("float pad = color.b*64.0;");
- fragBuilder->codeAppendf("float factor = 1 - clamp((%s.z - pad)/radius, 0, 1);",
+ fragBuilder->codeAppendf("float factor = 1.0 - clamp((%s.z - pad)/radius, 0.0, 1.0);",
fragBuilder->distanceVectorName());
- fragBuilder->codeAppend("factor = exp(-factor * factor * 4) - 0.018;");
- fragBuilder->codeAppendf("%s = factor*vec4(0, 0, 0, color.r);",
+ fragBuilder->codeAppend("factor = exp(-factor * factor * 4.0) - 0.018;");
+ fragBuilder->codeAppendf("%s = factor*vec4(0.0, 0.0, 0.0, color.r);",
args.fOutputColor);
}
}