Index: src/gpu/GrOvalRenderer.cpp |
diff --git a/src/gpu/GrOvalRenderer.cpp b/src/gpu/GrOvalRenderer.cpp |
index 622df15d4aa4ff413475414f47575b3d5ae52745..079c261a66e7a6692983b38c01ef91f9d7394525 100644 |
--- a/src/gpu/GrOvalRenderer.cpp |
+++ b/src/gpu/GrOvalRenderer.cpp |
@@ -145,19 +145,18 @@ private: |
v.fsIn(), v.fsIn()); |
fragBuilder->codeAppend("float innerAlpha = clamp(distanceToInnerEdge, 0.0, 1.0);"); |
fragBuilder->codeAppend("edgeAlpha *= innerAlpha;"); |
- } else { |
- fragBuilder->codeAppend("float distanceToInnerEdge = 0.0;"); |
} |
if (args.fDistanceVectorName) { |
+ const char* innerEdgeDistance = cgp.fStroke ? "distanceToInnerEdge" : "0.0"; |
fragBuilder->codeAppend ("if (d == 0.0) {"); // if on the center of the circle |
fragBuilder->codeAppendf(" %s = vec4(1.0, 0.0, distanceToOuterEdge, " |
- "distanceToInnerEdge);", // no normalize |
- args.fDistanceVectorName); |
+ "%s);", // no normalize |
+ args.fDistanceVectorName, innerEdgeDistance); |
fragBuilder->codeAppend ("} else {"); |
fragBuilder->codeAppendf(" %s = vec4(normalize(%s.xy), distanceToOuterEdge, " |
- "distanceToInnerEdge);", |
- args.fDistanceVectorName, v.fsIn()); |
+ "%s);", |
+ args.fDistanceVectorName, v.fsIn(), innerEdgeDistance); |
fragBuilder->codeAppend ("}"); |
} |