Commit bf74bac5 authored by Jason Simmons's avatar Jason Simmons

Make RRect immutable and replace RRect.setRectXY with a fromRectXY constructor

parent 5ea50bf4
...@@ -151,8 +151,8 @@ class _RenderCheckbox extends RenderToggleable { ...@@ -151,8 +151,8 @@ class _RenderCheckbox extends RenderToggleable {
// Create an inner rectangle to cover inside of rectangle. This is needed to avoid // Create an inner rectangle to cover inside of rectangle. This is needed to avoid
// painting artefacts caused by overlayed paintings. // painting artefacts caused by overlayed paintings.
Rect innerRect = rect.deflate(1.0); Rect innerRect = rect.deflate(1.0);
ui.RRect rrect = new ui.RRect() ui.RRect rrect = new ui.RRect.fromRectXY(
..setRectXY(rect, _kEdgeRadius, _kEdgeRadius); rect, _kEdgeRadius, _kEdgeRadius);
// Outline of the empty rrect // Outline of the empty rrect
paint.style = ui.PaintingStyle.stroke; paint.style = ui.PaintingStyle.stroke;
......
...@@ -124,8 +124,8 @@ class _RenderSwitch extends RenderToggleable { ...@@ -124,8 +124,8 @@ class _RenderSwitch extends RenderToggleable {
Rect rect = new Rect.fromLTWH(offset.dx, Rect rect = new Rect.fromLTWH(offset.dx,
offset.dy + _kSwitchHeight / 2.0 - _kTrackHeight / 2.0, _kTrackWidth, offset.dy + _kSwitchHeight / 2.0 - _kTrackHeight / 2.0, _kTrackWidth,
_kTrackHeight); _kTrackHeight);
ui.RRect rrect = new ui.RRect() ui.RRect rrect = new ui.RRect.fromRectXY(
..setRectXY(rect, _kTrackRadius, _kTrackRadius); rect, _kTrackRadius, _kTrackRadius);
canvas.drawRRect(rrect, paint); canvas.drawRRect(rrect, paint);
if (_radialReaction != null) if (_radialReaction != null)
......
...@@ -949,7 +949,7 @@ class BoxPainter { ...@@ -949,7 +949,7 @@ class BoxPainter {
canvas.drawRect(rect, _backgroundPaint); canvas.drawRect(rect, _backgroundPaint);
} else { } else {
double radius = _getEffectiveBorderRadius(rect); double radius = _getEffectiveBorderRadius(rect);
canvas.drawRRect(new ui.RRect()..setRectXY(rect, radius, radius), _backgroundPaint); canvas.drawRRect(new ui.RRect.fromRectXY(rect, radius, radius), _backgroundPaint);
} }
break; break;
} }
...@@ -1043,8 +1043,8 @@ class BoxPainter { ...@@ -1043,8 +1043,8 @@ class BoxPainter {
double width = _decoration.border.top.width; double width = _decoration.border.top.width;
double radius = _getEffectiveBorderRadius(rect); double radius = _getEffectiveBorderRadius(rect);
ui.RRect outer = new ui.RRect()..setRectXY(rect, radius, radius); ui.RRect outer = new ui.RRect.fromRectXY(rect, radius, radius);
ui.RRect inner = new ui.RRect()..setRectXY(rect.deflate(width), radius - width, radius - width); ui.RRect inner = new ui.RRect.fromRectXY(rect.deflate(width), radius - width, radius - width);
canvas.drawDRRect(outer, inner, new Paint()..color = color); canvas.drawDRRect(outer, inner, new Paint()..color = color);
} }
......
...@@ -587,7 +587,7 @@ class RenderClipRRect extends RenderProxyBox { ...@@ -587,7 +587,7 @@ class RenderClipRRect extends RenderProxyBox {
void paint(PaintingContext context, Offset offset) { void paint(PaintingContext context, Offset offset) {
if (child != null) { if (child != null) {
Rect rect = offset & size; Rect rect = offset & size;
ui.RRect rrect = new ui.RRect()..setRectXY(rect, xRadius, yRadius); ui.RRect rrect = new ui.RRect.fromRectXY(rect, xRadius, yRadius);
context.paintChildWithClipRRect(child, offset.toPoint(), rect, rrect); context.paintChildWithClipRRect(child, offset.toPoint(), rect, rrect);
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment