Index: src/gpu/GrOvalRenderer.cpp |
diff --git a/src/gpu/GrOvalRenderer.cpp b/src/gpu/GrOvalRenderer.cpp |
index 4055d2fcf2ee54c3338d2bf239fe17e90890267d..7375a01e719993a0e65bb828b60cce313d4a0e0b 100644 |
--- a/src/gpu/GrOvalRenderer.cpp |
+++ b/src/gpu/GrOvalRenderer.cpp |
@@ -359,10 +359,6 @@ void GrOvalRenderer::drawCircle(GrDrawTarget* target, |
SkStrokeRec::Style style = stroke.getStyle(); |
bool isStroked = (SkStrokeRec::kStroke_Style == style || SkStrokeRec::kHairline_Style == style); |
- GrEffectRef* effect = CircleEdgeEffect::Create(isStroked); |
- static const int kCircleEdgeAttrIndex = 1; |
- drawState->addCoverageEffect(effect, kCircleEdgeAttrIndex)->unref(); |
- |
SkScalar innerRadius = 0.0f; |
SkScalar outerRadius = radius; |
SkScalar halfWidth = 0; |
@@ -376,10 +372,13 @@ void GrOvalRenderer::drawCircle(GrDrawTarget* target, |
outerRadius += halfWidth; |
if (isStroked) { |
innerRadius = radius - halfWidth; |
robertphillips
2013/08/29 17:01:14
Did you try leaving the "innerRadius = radius - ha
jvanverth1
2013/08/29 18:16:53
Yes, that's why I moved it down.
|
- isStroked = (innerRadius > 0); |
} |
} |
+ GrEffectRef* effect = CircleEdgeEffect::Create(isStroked && innerRadius > 0); |
+ static const int kCircleEdgeAttrIndex = 1; |
+ drawState->addCoverageEffect(effect, kCircleEdgeAttrIndex)->unref(); |
+ |
// 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 |
@@ -489,7 +488,6 @@ bool GrOvalRenderer::drawEllipse(GrDrawTarget* target, |
if (isStroked) { |
innerXRadius = xRadius - scaledStroke.fX; |
innerYRadius = yRadius - scaledStroke.fY; |
- isStroked = (innerXRadius > 0 && innerYRadius > 0); |
} |
xRadius += scaledStroke.fX; |
@@ -512,7 +510,8 @@ bool GrOvalRenderer::drawEllipse(GrDrawTarget* target, |
EllipseVertex* verts = reinterpret_cast<EllipseVertex*>(geo.vertices()); |
- GrEffectRef* effect = EllipseEdgeEffect::Create(isStroked); |
+ GrEffectRef* effect = EllipseEdgeEffect::Create(isStroked && |
+ innerXRadius > 0 && innerYRadius > 0); |
static const int kEllipseCenterAttrIndex = 1; |
static const int kEllipseEdgeAttrIndex = 2; |
@@ -683,13 +682,12 @@ bool GrOvalRenderer::drawSimpleRRect(GrDrawTarget* target, GrContext* context, b |
if (isStroked) { |
innerRadius = xRadius - halfWidth; |
- isStroked = (innerRadius > 0); |
} |
outerRadius += halfWidth; |
bounds.outset(halfWidth, halfWidth); |
} |
- GrEffectRef* effect = CircleEdgeEffect::Create(isStroked); |
+ GrEffectRef* effect = CircleEdgeEffect::Create(isStroked && innerRadius > 0); |
static const int kCircleEdgeAttrIndex = 1; |
drawState->addCoverageEffect(effect, kCircleEdgeAttrIndex)->unref(); |
@@ -776,7 +774,6 @@ bool GrOvalRenderer::drawSimpleRRect(GrDrawTarget* target, GrContext* context, b |
if (isStroked) { |
innerXRadius = xRadius - scaledStroke.fX; |
innerYRadius = yRadius - scaledStroke.fY; |
- isStroked = (innerXRadius > 0 && innerYRadius > 0); |
} |
xRadius += scaledStroke.fX; |
@@ -791,7 +788,8 @@ bool GrOvalRenderer::drawSimpleRRect(GrDrawTarget* target, GrContext* context, b |
} |
EllipseVertex* verts = reinterpret_cast<EllipseVertex*>(geo.vertices()); |
- GrEffectRef* effect = EllipseEdgeEffect::Create(isStroked); |
+ GrEffectRef* effect = EllipseEdgeEffect::Create(isStroked && |
+ innerXRadius > 0 && innerYRadius > 0); |
static const int kEllipseOffsetAttrIndex = 1; |
static const int kEllipseRadiiAttrIndex = 2; |
drawState->addCoverageEffect(effect, |