Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(302)

Side by Side Diff: sky/examples/raw/sector-layout.dart

Issue 1151383003: Replace setBoxDecoration() with a decoration property. (part II) (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 91
92 double deltaRadius; 92 double deltaRadius;
93 double deltaTheta; 93 double deltaTheta;
94 } 94 }
95 95
96 class RenderDecoratedSector extends RenderSector { 96 class RenderDecoratedSector extends RenderSector {
97 BoxDecoration _decoration; 97 BoxDecoration _decoration;
98 98
99 RenderDecoratedSector(BoxDecoration decoration) : _decoration = decoration; 99 RenderDecoratedSector(BoxDecoration decoration) : _decoration = decoration;
100 100
101 void setBoxDecoration(BoxDecoration decoration) { 101 BoxDecoration _decoration;
102 if (_decoration == decoration) 102 BoxDecoration get decoration => _decoration;
103 void set decoration (BoxDecoration value) {
104 if (value == _decoration)
103 return; 105 return;
104 _decoration = decoration; 106 _decoration = value;
105 markNeedsPaint(); 107 markNeedsPaint();
106 } 108 }
107 109
108 // origin must be set to the center of the circle 110 // origin must be set to the center of the circle
109 void paint(RenderNodeDisplayList canvas) { 111 void paint(RenderNodeDisplayList canvas) {
110 assert(deltaRadius != null); 112 assert(deltaRadius != null);
111 assert(deltaTheta != null); 113 assert(deltaTheta != null);
112 assert(parentData is SectorParentData); 114 assert(parentData is SectorParentData);
113 115
114 if (_decoration == null) 116 if (_decoration == null)
(...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after
525 rootCircle.add(new RenderSolidColor(0xFF0000FF, desiredDeltaTheta: kTwoPi * 0. 4)); 527 rootCircle.add(new RenderSolidColor(0xFF0000FF, desiredDeltaTheta: kTwoPi * 0. 4));
526 var stack = new RenderSectorSlice(padding: 2.0); 528 var stack = new RenderSectorSlice(padding: 2.0);
527 stack.add(new RenderSolidColor(0xFFFFFF00, desiredDeltaRadius: 20.0)); 529 stack.add(new RenderSolidColor(0xFFFFFF00, desiredDeltaRadius: 20.0));
528 stack.add(new RenderSolidColor(0xFFFF9000, desiredDeltaRadius: 20.0)); 530 stack.add(new RenderSolidColor(0xFFFF9000, desiredDeltaRadius: 20.0));
529 stack.add(new RenderSolidColor(0xFF00FF00)); 531 stack.add(new RenderSolidColor(0xFF00FF00));
530 rootCircle.add(stack); 532 rootCircle.add(stack);
531 533
532 var root = new RenderBoxToRenderSectorAdapter(innerRadius: 50.0, child: rootCi rcle); 534 var root = new RenderBoxToRenderSectorAdapter(innerRadius: 50.0, child: rootCi rcle);
533 app = new AppView(root); 535 app = new AppView(root);
534 } 536 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698