Revert "Don't let neighboring radii in GrAAFillRRectOp get too close"

This reverts commit 778edc883b.

Reason for revert: speculative, to see if chrome rolls

Original change's description:
> Don't let neighboring radii in GrAAFillRRectOp get too close
> 
> Since each corner uses a different reference point, it's possible that
> FP rounding can cause the edges of very close radii on a common edge
> to accidentally overlap. This can cause a pixel to be drawn/blended
> more than once. This CL addresses the issue by not allowing
> neighboring radii on a common edge to get closer than 1/16 pixel from
> one another.
> 
> Bug: skia:8562
> Change-Id: Ifda97c9a4c3973405f86f7fc6846a4073b3ab581
> Reviewed-on: https://skia-review.googlesource.com/c/173036
> Commit-Queue: Chris Dalton <csmartdalton@google.com>
> Reviewed-by: Jim Van Verth <jvanverth@google.com>

TBR=jvanverth@google.com,csmartdalton@google.com

Change-Id: Ica14341e38bc0da649f0f0ade70692b0372f1c78
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:8562
Reviewed-on: https://skia-review.googlesource.com/c/173160
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
This commit is contained in:
Mike Reed 2018-11-28 12:44:43 +00:00 committed by Skia Commit-Bot
parent 600ed12666
commit 1dced86481

View File

@ -325,10 +325,8 @@ public:
v->codeAppend("float2 aa_bloatradius = axiswidths * pixellength * .5;");
// Identify our radii.
v->codeAppend("float4 radii_and_neighbors = radii_selector"
"* float4x4(radii_x, radii_y, radii_x.yxwz, radii_y.wzyx);");
v->codeAppend("float2 radii = radii_and_neighbors.xy;");
v->codeAppend("float2 neighbor_radii = radii_and_neighbors.zw;");
v->codeAppend("float2 radii = float2(dot(radii_selector, radii_x), "
"dot(radii_selector, radii_y));");
v->codeAppend("if (any(greaterThan(aa_bloatradius, float2(1)))) {");
// The rrect is more narrow than an AA coverage ramp. We can't draw as-is
@ -349,14 +347,11 @@ public:
v->codeAppend( "radius_outset = floor(abs(radius_outset)) * radius_outset;");
v->codeAppend( "is_linear_coverage = 1;");
v->codeAppend("} else {");
// Don't let radii get smaller than a pixel.
// Don't let actual arc radii get smaller than a pixel.
v->codeAppend( "radii = clamp(radii, pixellength, 2 - pixellength);");
v->codeAppend( "neighbor_radii = clamp(neighbor_radii, pixellength, 2 - pixellength);");
// Don't let neighboring radii get closer together than 1/16 pixel.
v->codeAppend( "float2 spacing = 2 - radii - neighbor_radii;");
v->codeAppend( "float2 extra_pad = max(pixellength * .0625 - spacing, float2(0));");
v->codeAppend( "radii -= extra_pad * .5;");
v->codeAppend("}");
// Bias radii slightly inward to avoid accidental overlap of geometries from fp rounding.
v->codeAppend("radii -= aa_bloatradius * 1e-3;");
// Find our vertex position, adjusted for radii and bloated for AA. Our rect is drawn in
// normalized [-1,-1,+1,+1] space.