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

Unified Diff: src/gpu/GrOvalRenderer.cpp

Issue 2196053002: Revert of Added distance vector support for CircleGeometryProcessor (Closed) Base URL: https://skia.googlesource.com/skia@dvonbeck-bevel-impl-0
Patch Set: Created 4 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrOvalRenderer.cpp
diff --git a/src/gpu/GrOvalRenderer.cpp b/src/gpu/GrOvalRenderer.cpp
index 527b96e2c64a7f88e8637f8458e1311ef6c99ae9..aec9b76ba85f986236a0382fcb451f84beb5e2c2 100644
--- a/src/gpu/GrOvalRenderer.cpp
+++ b/src/gpu/GrOvalRenderer.cpp
@@ -83,13 +83,10 @@
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,22 +126,12 @@
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);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698