Index: src/gpu/effects/GrOvalEffect.cpp |
diff --git a/src/gpu/effects/GrOvalEffect.cpp b/src/gpu/effects/GrOvalEffect.cpp |
index 97b977f7542b8a357e8700d2c406fa0cf37751e8..40870e27d2ff216ea30a852a5efa7e742fe4bdc5 100644 |
--- a/src/gpu/effects/GrOvalEffect.cpp |
+++ b/src/gpu/effects/GrOvalEffect.cpp |
@@ -137,7 +137,8 @@ void GLCircleEffect::emitCode(GrGLShaderBuilder* builder, |
const TextureSamplerArray& samplers) { |
const CircleEffect& ce = drawEffect.castEffect<CircleEffect>(); |
const char *circleName; |
- // The circle uniform is (center.x, center.y, radius + 0.5) |
+ // The circle uniform is (center.x, center.y, radius + 0.5) for regular fills and |
+ // (... ,radius - 0.5) for inverse fills. |
fCircleUniform = builder->addUniform(GrGLShaderBuilder::kFragment_Visibility, |
kVec3f_GrSLType, |
"circle", |
@@ -171,7 +172,13 @@ GrGLEffect::EffectKey GLCircleEffect::GenKey(const GrDrawEffect& drawEffect, |
void GLCircleEffect::setData(const GrGLUniformManager& uman, const GrDrawEffect& drawEffect) { |
const CircleEffect& ce = drawEffect.castEffect<CircleEffect>(); |
if (ce.getRadius() != fPrevRadius || ce.getCenter() != fPrevCenter) { |
- uman.set3f(fCircleUniform, ce.getCenter().fX, ce.getCenter().fY, ce.getRadius() + 0.5f); |
+ SkScalar radius = ce.getRadius(); |
+ if (GrEffectEdgeTypeIsInverseFill(ce.getEdgeType())) { |
+ radius -= 0.5f; |
+ } else { |
+ radius += 0.5f; |
+ } |
+ uman.set3f(fCircleUniform, ce.getCenter().fX, ce.getCenter().fY, radius); |
fPrevCenter = ce.getCenter(); |
fPrevRadius = ce.getRadius(); |
} |