diff options
author | commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2013-08-30 16:34:52 +0000 |
---|---|---|
committer | commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2013-08-30 16:34:52 +0000 |
commit | cefde6e5783bcce27369216e5e4ee5c7eed02e26 (patch) | |
tree | ed0d7922e0d17a0f5c0d400fe0224ee99976d3fc /src | |
parent | a6f37e77c1c95f0a06ac55ff659cb7b8dfabefcf (diff) |
Fix stroked oval and rrect rendering on Ubuntu-x86-Release.
The Ubuntu-x86 compiler was optimizing out a case where I was
reseting the isStroked boolean based on the new inner radii.
This changes it to check the radii at the time the effect is
created, which tricks the compiler into doing the right thing.
R=bsalomon@google.com, robertphillips@google.com
Author: jvanverth@google.com
Review URL: https://chromiumcodereview.appspot.com/23592021
git-svn-id: http://skia.googlecode.com/svn/trunk@11035 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src')
-rw-r--r-- | src/gpu/GrOvalRenderer.cpp | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/src/gpu/GrOvalRenderer.cpp b/src/gpu/GrOvalRenderer.cpp index 4055d2fcf2..5ec7504577 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; - 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,12 +682,13 @@ bool GrOvalRenderer::drawSimpleRRect(GrDrawTarget* target, GrContext* context, b if (isStroked) { innerRadius = xRadius - halfWidth; - isStroked = (innerRadius > 0); } outerRadius += halfWidth; bounds.outset(halfWidth, halfWidth); } + isStroked = (isStroked && innerRadius > 0); + GrEffectRef* effect = CircleEdgeEffect::Create(isStroked); static const int kCircleEdgeAttrIndex = 1; drawState->addCoverageEffect(effect, kCircleEdgeAttrIndex)->unref(); @@ -776,7 +776,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; @@ -784,6 +783,8 @@ bool GrOvalRenderer::drawSimpleRRect(GrDrawTarget* target, GrContext* context, b bounds.outset(scaledStroke.fX, scaledStroke.fY); } + isStroked = (isStroked && innerXRadius > 0 && innerYRadius > 0); + GrDrawTarget::AutoReleaseGeometry geo(target, 16, 0); if (!geo.succeeded()) { GrPrintf("Failed to get space for vertices!\n"); |