OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 import 'dart:math' as math; | 5 import 'dart:math' as math; |
6 import 'dart:sky' as sky; | 6 import 'dart:sky' as sky; |
7 import 'package:sky/framework/app.dart'; | 7 import 'package:sky/framework/app.dart'; |
8 import 'package:sky/framework/layout2.dart'; | 8 import 'package:sky/framework/layout2.dart'; |
9 | 9 |
10 const double kTwoPi = 2 * math.PI; | 10 const double kTwoPi = 2 * math.PI; |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 assert(deltaTheta != null); | 119 assert(deltaTheta != null); |
120 assert(parentData is SectorParentData); | 120 assert(parentData is SectorParentData); |
121 | 121 |
122 if (_decoration == null) | 122 if (_decoration == null) |
123 return; | 123 return; |
124 | 124 |
125 if (_decoration.backgroundColor != null) { | 125 if (_decoration.backgroundColor != null) { |
126 sky.Paint paint = new sky.Paint()..color = _decoration.backgroundColor; | 126 sky.Paint paint = new sky.Paint()..color = _decoration.backgroundColor; |
127 sky.Path path = new sky.Path(); | 127 sky.Path path = new sky.Path(); |
128 double outerRadius = (parentData.radius + deltaRadius); | 128 double outerRadius = (parentData.radius + deltaRadius); |
129 sky.Rect outerBounds = new sky.Rect()..setLTRB(-outerRadius, -outerRadius,
outerRadius, outerRadius); | 129 sky.Rect outerBounds = new sky.Rect.fromLTRB(-outerRadius, -outerRadius, o
uterRadius, outerRadius); |
130 path.arcTo(outerBounds, deg(parentData.theta), deg(deltaTheta), true); | 130 path.arcTo(outerBounds, deg(parentData.theta), deg(deltaTheta), true); |
131 double innerRadius = parentData.radius; | 131 double innerRadius = parentData.radius; |
132 sky.Rect innerBounds = new sky.Rect()..setLTRB(-innerRadius, -innerRadius,
innerRadius, innerRadius); | 132 sky.Rect innerBounds = new sky.Rect.fromLTRB(-innerRadius, -innerRadius, i
nnerRadius, innerRadius); |
133 path.arcTo(innerBounds, deg(parentData.theta + deltaTheta), deg(-deltaThet
a), false); | 133 path.arcTo(innerBounds, deg(parentData.theta + deltaTheta), deg(-deltaThet
a), false); |
134 path.close(); | 134 path.close(); |
135 canvas.drawPath(path, paint); | 135 canvas.drawPath(path, paint); |
136 } | 136 } |
137 } | 137 } |
138 } | 138 } |
139 | 139 |
140 class SectorChildListParentData extends SectorParentData with ContainerParentDat
aMixin<RenderSector> { } | 140 class SectorChildListParentData extends SectorParentData with ContainerParentDat
aMixin<RenderSector> { } |
141 | 141 |
142 class RenderSectorWithChildren extends RenderDecoratedSector with ContainerRende
rNodeMixin<RenderSector, SectorChildListParentData> { | 142 class RenderSectorWithChildren extends RenderDecoratedSector with ContainerRende
rNodeMixin<RenderSector, SectorChildListParentData> { |
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
496 rootCircle.add(new RenderSolidColor(0xFF0000FF, desiredDeltaTheta: kTwoPi * 0.
4)); | 496 rootCircle.add(new RenderSolidColor(0xFF0000FF, desiredDeltaTheta: kTwoPi * 0.
4)); |
497 var stack = new RenderSectorSlice(padding: 2.0); | 497 var stack = new RenderSectorSlice(padding: 2.0); |
498 stack.add(new RenderSolidColor(0xFFFFFF00, desiredDeltaRadius: 20.0)); | 498 stack.add(new RenderSolidColor(0xFFFFFF00, desiredDeltaRadius: 20.0)); |
499 stack.add(new RenderSolidColor(0xFFFF9000, desiredDeltaRadius: 20.0)); | 499 stack.add(new RenderSolidColor(0xFFFF9000, desiredDeltaRadius: 20.0)); |
500 stack.add(new RenderSolidColor(0xFF00FF00)); | 500 stack.add(new RenderSolidColor(0xFF00FF00)); |
501 rootCircle.add(stack); | 501 rootCircle.add(stack); |
502 | 502 |
503 var root = new RenderBoxToRenderSectorAdapter(innerRadius: 50.0, child: rootCi
rcle); | 503 var root = new RenderBoxToRenderSectorAdapter(innerRadius: 50.0, child: rootCi
rcle); |
504 app = new AppView(root); | 504 app = new AppView(root); |
505 } | 505 } |
OLD | NEW |