diff options
author | 2017-12-01 13:49:50 -0500 | |
---|---|---|
committer | 2017-12-01 20:00:09 +0000 | |
commit | 096074af2c6fcbf622f0a42b2f7c56d0c66fbd80 (patch) | |
tree | c8162aad746f18fee6344567a6cf63ae11dc7dec /src/gpu/effects/GrCircleEffect.h | |
parent | b826a3ab7247fea323eb8b06372a678fbc6c3dbe (diff) |
Fix rendering of drrects with small circular inner rrects.
Previously when the inner rrect was a circle with a radius of 1 we would
cause a inf * 0 in the shader which would lead to the shape not rendering.
This change also makes concentric circle drrects draw as stroked circles.
bug: chromium:789262
Change-Id: I6efbe3fdde25d6c4e031c7412d83df009afe014a
Reviewed-on: https://skia-review.googlesource.com/79141
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Diffstat (limited to 'src/gpu/effects/GrCircleEffect.h')
-rw-r--r-- | src/gpu/effects/GrCircleEffect.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/gpu/effects/GrCircleEffect.h b/src/gpu/effects/GrCircleEffect.h index bf6bd0e8e6..d721a78241 100644 --- a/src/gpu/effects/GrCircleEffect.h +++ b/src/gpu/effects/GrCircleEffect.h @@ -19,8 +19,14 @@ public: GrClipEdgeType edgeType() const { return fEdgeType; } SkPoint center() const { return fCenter; } float radius() const { return fRadius; } + static std::unique_ptr<GrFragmentProcessor> Make(GrClipEdgeType edgeType, SkPoint center, float radius) { + // A radius below half causes the implicit insetting done by this processor to become + // inverted. We could handle this case by making the processor code more complicated. + if (radius < .5f) { + return nullptr; + } return std::unique_ptr<GrFragmentProcessor>(new GrCircleEffect(edgeType, center, radius)); } GrCircleEffect(const GrCircleEffect& src); |