Remove no-longer-needed clamping of RRect radii (#111668)

This commit is contained in:
Greg Spencer 2022-09-15 13:54:18 -07:00 committed by GitHub
parent d26365504c
commit c03eef4d57
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 3 additions and 47 deletions

View File

@ -232,18 +232,7 @@ abstract class BoxBorder extends ShapeBorder {
canvas.drawRRect(borderRadius.toRRect(rect), paint);
} else {
final RRect borderRect = borderRadius.toRRect(rect);
RRect inner = borderRect.deflate(side.strokeInset);
// Clamp the inner border's radii to zero, until deflate does this
// automatically, so that we can start asserting non-negative values
// in the engine without breaking the framework.
// TODO(gspencergoog): Remove this once https://github.com/flutter/engine/pull/36062 rolls into the framework.
inner = RRect.fromLTRBAndCorners(
inner.left, inner.top, inner.right, inner.bottom,
topLeft: inner.tlRadius.clamp(minimum: Radius.zero), // ignore_clamp_double_lint
topRight: inner.trRadius.clamp(minimum: Radius.zero), // ignore_clamp_double_lint
bottomLeft: inner.blRadius.clamp(minimum: Radius.zero), // ignore_clamp_double_lint
bottomRight: inner.brRadius.clamp(minimum: Radius.zero), // ignore_clamp_double_lint
);
final RRect inner = borderRect.deflate(side.strokeInset);
final RRect outer = borderRect.inflate(side.strokeOutset);
canvas.drawDRRect(outer, inner, paint);
}

View File

@ -132,18 +132,7 @@ class RoundedRectangleBorder extends OutlinedBorder {
final Paint paint = Paint()
..color = side.color;
final RRect borderRect = borderRadius.resolve(textDirection).toRRect(rect);
RRect inner = borderRect.deflate(side.strokeInset);
// Clamp the inner border's radii to zero, until deflate does this
// automatically, so that we can start asserting non-negative values
// in the engine without breaking the framework.
// TODO(gspencergoog): Remove this once https://github.com/flutter/engine/pull/36062 rolls into the framework.
inner = RRect.fromLTRBAndCorners(
inner.left, inner.top, inner.right, inner.bottom,
topLeft: inner.tlRadius.clamp(minimum: Radius.zero), // ignore_clamp_double_lint
topRight: inner.trRadius.clamp(minimum: Radius.zero), // ignore_clamp_double_lint
bottomLeft: inner.blRadius.clamp(minimum: Radius.zero), // ignore_clamp_double_lint
bottomRight: inner.brRadius.clamp(minimum: Radius.zero), // ignore_clamp_double_lint
);
final RRect inner = borderRect.deflate(side.strokeInset);
final RRect outer = borderRect.inflate(side.strokeOutset);
canvas.drawDRRect(outer, inner, paint);
}

View File

@ -271,18 +271,7 @@ class TableBorder {
paintBorder(canvas, rect, top: top, right: right, bottom: bottom, left: left);
} else {
final RRect outer = borderRadius.toRRect(rect);
RRect inner = outer.deflate(top.width);
// Clamp the inner border's radii to zero, until deflate does this
// automatically, so that we can start asserting non-negative values
// in the engine without breaking the framework.
// TODO(gspencergoog): Remove this once https://github.com/flutter/engine/pull/36062 rolls into the framework.
inner = RRect.fromLTRBAndCorners(
inner.left, inner.top, inner.right, inner.bottom,
topLeft: inner.tlRadius.clamp(minimum: Radius.zero), // ignore_clamp_double_lint
topRight: inner.trRadius.clamp(minimum: Radius.zero), // ignore_clamp_double_lint
bottomLeft: inner.blRadius.clamp(minimum: Radius.zero), // ignore_clamp_double_lint
bottomRight: inner.brRadius.clamp(minimum: Radius.zero), // ignore_clamp_double_lint
);
final RRect inner = outer.deflate(top.width);
final Paint paint = Paint()..color = top.color;
canvas.drawDRRect(outer, inner, paint);
}

View File

@ -129,17 +129,6 @@ class _MulticastCanvas implements Canvas {
@override
void drawDRRect(RRect outer, RRect inner, Paint paint) {
// Clamp the inner border's radii to zero, until deflate does this
// automatically, so that we can start asserting non-negative values
// in the engine without breaking the framework.
// TODO(gspencergoog): Remove this once https://github.com/flutter/engine/pull/36062 rolls into the framework.
inner = RRect.fromLTRBAndCorners(
inner.left, inner.top, inner.right, inner.bottom,
topLeft: inner.tlRadius.clamp(minimum: Radius.zero), // ignore_clamp_double_lint
topRight: inner.trRadius.clamp(minimum: Radius.zero), // ignore_clamp_double_lint
bottomLeft: inner.blRadius.clamp(minimum: Radius.zero), // ignore_clamp_double_lint
bottomRight: inner.brRadius.clamp(minimum: Radius.zero), // ignore_clamp_double_lint
);
_main.drawDRRect(outer, inner, paint);
_screenshot.drawDRRect(outer, inner, paint);
}