From 570f8af4730578db79fbb7842389178f85dd8699 Mon Sep 17 00:00:00 2001 From: mtklein Date: Sat, 30 Jul 2016 13:31:52 -0700 Subject: [PATCH] Revert of Added distance vector support for CircleGeometryProcessor (patchset #4 id:60001 of https://codereview.chromium.org/2190023002/ ) Reason for revert: Reverting so I can revert https://codereview.chromium.org/2114993002/ Original issue's description: > Added distance vector support for CircleGeometryProcessor > > This CL's base is the CL that sets up the distance vector field req. exposure: https://codereview.chromium.org/2114993002/ > > BUG=skia: > GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2190023002 > > Committed: https://skia.googlesource.com/skia/+/779e1924eaf7c5652dee93e0e8e975bbf5723b37 TBR=egdaniel@google.com,robertphillips@google.com,dvonbeck@google.com # Not skipping CQ checks because original CL landed more than 1 days ago. BUG=skia: Review-Url: https://codereview.chromium.org/2196053002 --- src/gpu/GrOvalRenderer.cpp | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/src/gpu/GrOvalRenderer.cpp b/src/gpu/GrOvalRenderer.cpp index 527b96e2c6..aec9b76ba8 100644 --- a/src/gpu/GrOvalRenderer.cpp +++ b/src/gpu/GrOvalRenderer.cpp @@ -83,13 +83,10 @@ public: fStroke = stroke; } - bool implementsDistanceVector() const override { return true; }; - const Attribute* inPosition() const { return fInPosition; } const Attribute* inColor() const { return fInColor; } const Attribute* inCircleEdge() const { return fInCircleEdge; } const SkMatrix& localMatrix() const { return fLocalMatrix; } - virtual ~CircleGeometryProcessor() {} const char* name() const override { return "CircleEdge"; } @@ -129,24 +126,14 @@ public: args.fTransformsOut); fragBuilder->codeAppendf("float d = length(%s.xy);", v.fsIn()); - fragBuilder->codeAppendf("float distanceToEdge = %s.z * (1.0 - d);", v.fsIn()); - fragBuilder->codeAppendf("float edgeAlpha = clamp(distanceToEdge, 0.0, 1.0);"); + fragBuilder->codeAppendf("float edgeAlpha = clamp(%s.z * (1.0 - d), 0.0, 1.0);", + v.fsIn()); if (cgp.fStroke) { fragBuilder->codeAppendf("float innerAlpha = clamp(%s.z * (d - %s.w), 0.0, 1.0);", v.fsIn(), v.fsIn()); fragBuilder->codeAppend("edgeAlpha *= innerAlpha;"); } - if (args.fDistanceVectorName) { - fragBuilder->codeAppend ("if (d == 0.0) {"); // if on the center of the circle - fragBuilder->codeAppendf(" %s = vec2(distanceToEdge, 0.0);", // avoid normalizing - args.fDistanceVectorName); - fragBuilder->codeAppend ("} else {"); - fragBuilder->codeAppendf(" %s = normalize(%s.xy) * distanceToEdge;", - args.fDistanceVectorName, v.fsIn()); - fragBuilder->codeAppend ("}"); - } - fragBuilder->codeAppendf("%s = vec4(edgeAlpha);", args.fOutputCoverage); }