Index: src/gpu/GrOvalRenderer.cpp |
=================================================================== |
--- src/gpu/GrOvalRenderer.cpp (revision 8459) |
+++ src/gpu/GrOvalRenderer.cpp (working copy) |
@@ -130,19 +130,24 @@ |
} |
} |
+ // The radii are outset for two reasons. First, it allows the shader to simply perform |
+ // clamp(distance-to-center - radius, 0, 1). Second, the outer radius is used to compute the |
+ // verts of the bounding box that is rendered and the outset ensures the box will cover all |
+ // pixels partially covered by the circle. |
+ outerRadius += SK_ScalarHalf; |
+ innerRadius -= SK_ScalarHalf; |
+ |
for (int i = 0; i < 4; ++i) { |
verts[i].fCenter = center; |
- verts[i].fOuterRadius = outerRadius + 0.5f; |
- verts[i].fInnerRadius = innerRadius - 0.5f; |
+ verts[i].fOuterRadius = outerRadius; |
+ verts[i].fInnerRadius = innerRadius; |
} |
- // We've extended the outer radius out half a pixel to antialias. |
- // Expand the drawn rect here so all the pixels will be captured. |
SkRect bounds = SkRect::MakeLTRB( |
- center.fX - outerRadius - SK_ScalarHalf, |
- center.fY - outerRadius - SK_ScalarHalf, |
- center.fX + outerRadius + SK_ScalarHalf, |
- center.fY + outerRadius + SK_ScalarHalf |
+ center.fX - outerRadius, |
+ center.fY - outerRadius, |
+ center.fX + outerRadius, |
+ center.fY + outerRadius |
); |
verts[0].fPos = SkPoint::Make(bounds.fLeft, bounds.fTop); |