Introduce RenderProxyBox and RenderSizedBox
Also makes Point, Size, and Rect immutable. R=ianh@google.com Review URL: https://codereview.chromium.org/1162033002
This commit is contained in:
@@ -126,10 +126,10 @@ class RenderDecoratedSector extends RenderSector {
|
||||
sky.Paint paint = new sky.Paint()..color = _decoration.backgroundColor;
|
||||
sky.Path path = new sky.Path();
|
||||
double outerRadius = (parentData.radius + deltaRadius);
|
||||
sky.Rect outerBounds = new sky.Rect()..setLTRB(-outerRadius, -outerRadius, outerRadius, outerRadius);
|
||||
sky.Rect outerBounds = new sky.Rect.fromLTRB(-outerRadius, -outerRadius, outerRadius, outerRadius);
|
||||
path.arcTo(outerBounds, deg(parentData.theta), deg(deltaTheta), true);
|
||||
double innerRadius = parentData.radius;
|
||||
sky.Rect innerBounds = new sky.Rect()..setLTRB(-innerRadius, -innerRadius, innerRadius, innerRadius);
|
||||
sky.Rect innerBounds = new sky.Rect.fromLTRB(-innerRadius, -innerRadius, innerRadius, innerRadius);
|
||||
path.arcTo(innerBounds, deg(parentData.theta + deltaTheta), deg(-deltaTheta), false);
|
||||
path.close();
|
||||
canvas.drawPath(path, paint);
|
||||
|
||||
@@ -10,7 +10,7 @@ class RenderSolidColor extends RenderDecoratedBox {
|
||||
final Size desiredSize;
|
||||
final int backgroundColor;
|
||||
|
||||
RenderSolidColor(int backgroundColor, { this.desiredSize })
|
||||
RenderSolidColor(int backgroundColor, { this.desiredSize: const sky.Size.infinite() })
|
||||
: backgroundColor = backgroundColor,
|
||||
super(new BoxDecoration(backgroundColor: backgroundColor)) {
|
||||
}
|
||||
@@ -41,7 +41,7 @@ void main() {
|
||||
decoration: new BoxDecoration(backgroundColor: 0xFF000000));
|
||||
|
||||
void addFlexChild(RenderFlex parent, int backgroundColor, { int flex: 0 }) {
|
||||
RenderNode child = new RenderSolidColor(backgroundColor, desiredSize: new Size.infinite());
|
||||
RenderNode child = new RenderSolidColor(backgroundColor);
|
||||
parent.add(child);
|
||||
child.parentData.flex = flex;
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ void beginFrame(double timeStamp) {
|
||||
PictureRecorder canvas = new PictureRecorder(view.width, view.height);
|
||||
canvas.translate(view.width / 2.0, view.height / 2.0);
|
||||
canvas.rotateDegrees(delta / 10);
|
||||
canvas.drawRect(new Rect()..setLTRB(-100.0, -100.0, 100.0, 100.0),
|
||||
canvas.drawRect(new Rect.fromLTRB(-100.0, -100.0, 100.0, 100.0),
|
||||
new Paint()..setARGB(255, 0, 255, 0));
|
||||
view.picture = canvas.endRecording();
|
||||
view.scheduleFrame();
|
||||
|
||||
@@ -15,7 +15,7 @@ void beginFrame(double timeStamp) {
|
||||
PictureRecorder canvas = new PictureRecorder(view.width, view.height);
|
||||
canvas.translate(view.width / 2.0, view.height / 2.0);
|
||||
canvas.rotateDegrees(delta / 10);
|
||||
canvas.drawRect(new Rect()..setLTRB(-100.0, -100.0, 100.0, 100.0),
|
||||
canvas.drawRect(new Rect.fromLTRB(-100.0, -100.0, 100.0, 100.0),
|
||||
new Paint()..setARGB(255, 0, 255, 0));
|
||||
|
||||
double sin = math.sin(delta / 200);
|
||||
|
||||
Reference in New Issue
Block a user