Index: src/gpu/GrOvalRenderer.cpp |
diff --git a/src/gpu/GrOvalRenderer.cpp b/src/gpu/GrOvalRenderer.cpp |
index 465dd2b45e243e1d120d895314c0e074a695b6cd..1a798502c6037756bf49c1fa4d2e14875cebbc0e 100644 |
--- a/src/gpu/GrOvalRenderer.cpp |
+++ b/src/gpu/GrOvalRenderer.cpp |
@@ -221,7 +221,9 @@ public: |
builder->fsCodeAppendf("\tvec2 scaledOffset = %s*%s.xy;\n", fsOffsetName, fsRadiiName); |
builder->fsCodeAppend("\tfloat test = dot(scaledOffset, scaledOffset) - 1.0;\n"); |
builder->fsCodeAppendf("\tvec2 grad = 2.0*scaledOffset*%s.xy;\n", fsRadiiName); |
- builder->fsCodeAppend("\tfloat invlen = inversesqrt(dot(grad, grad));\n"); |
+ builder->fsCodeAppend("\tfloat grad_dot = dot(grad, grad);\n"); |
robertphillips
2013/07/01 18:35:41
comment here as to why we're doing this?
|
+ builder->fsCodeAppend("\tgrad_dot = max(grad_dot, 1.0e-4);\n"); |
bsalomon
2013/07/01 18:36:03
Could use a comment here about why this number was
|
+ builder->fsCodeAppend("\tfloat invlen = inversesqrt(grad_dot);\n"); |
builder->fsCodeAppend("\tfloat edgeAlpha = clamp(0.5-test*invlen, 0.0, 1.0);\n"); |
// for inner curve |
@@ -808,7 +810,7 @@ bool GrOvalRenderer::drawSimpleRRect(GrDrawTarget* target, GrContext* context, b |
bounds.fBottom |
}; |
SkScalar yOuterOffsets[4] = { |
- -yOuterRadius, |
+ yOuterRadius, |
SK_ScalarNearlyZero, // we're using inversesqrt() in the shader, so can't be exactly 0 |
SK_ScalarNearlyZero, |
yOuterRadius |
@@ -816,7 +818,7 @@ bool GrOvalRenderer::drawSimpleRRect(GrDrawTarget* target, GrContext* context, b |
for (int i = 0; i < 4; ++i) { |
verts->fPos = SkPoint::Make(bounds.fLeft, yCoords[i]); |
- verts->fOffset = SkPoint::Make(-xOuterRadius, yOuterOffsets[i]); |
+ verts->fOffset = SkPoint::Make(xOuterRadius, yOuterOffsets[i]); |
verts->fOuterRadii = SkPoint::Make(xRadRecip, yRadRecip); |
verts->fInnerRadii = SkPoint::Make(xInnerRadRecip, yInnerRadRecip); |
verts++; |