Revert "Don't let neighboring radii in GrAAFillRRectOp get too close"
This reverts commit 778edc883b36995e8c0780b1dc851347c9e24699.
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>
diff --git a/src/gpu/ops/GrAAFillRRectOp.cpp b/src/gpu/ops/GrAAFillRRectOp.cpp
index 2885414..ed7f9cf 100644
--- a/src/gpu/ops/GrAAFillRRectOp.cpp
+++ b/src/gpu/ops/GrAAFillRRectOp.cpp
@@ -325,10 +325,8 @@
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 @@
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.