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

Side by Side Diff: sky/examples/widgets/spinning_mixed.dart

Issue 1186653003: Make it easier to debug examples/widgets/container.dart, since it is currently showing a crazy clip… (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 6 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 | sky/sdk/lib/framework/widgets/raised_button.dart » ('j') | 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:sky' as sky; 5 import 'dart:sky' as sky;
6 6
7 import 'package:sky/framework/rendering/box.dart'; 7 import 'package:sky/framework/rendering/box.dart';
8 import 'package:sky/framework/rendering/flex.dart'; 8 import 'package:sky/framework/rendering/flex.dart';
9 import 'package:sky/framework/scheduler.dart'; 9 import 'package:sky/framework/scheduler.dart';
10 import 'package:sky/framework/widgets/raised_button.dart'; 10 import 'package:sky/framework/widgets/raised_button.dart';
11 import 'package:sky/framework/widgets/ui_node.dart'; 11 import 'package:sky/framework/widgets/ui_node.dart';
12 import 'package:sky/framework/widgets/wrappers.dart'; 12 import 'package:sky/framework/widgets/wrappers.dart';
13 import 'package:vector_math/vector_math.dart'; 13 import 'package:vector_math/vector_math.dart';
14 14
15 import '../lib/solid_color_box.dart'; 15 import '../lib/solid_color_box.dart';
16 import '../../tests/resources/display_list.dart';
16 17
17 // Solid colour, RenderObject version 18 // Solid colour, RenderObject version
18 void addFlexChildSolidColor(RenderFlex parent, sky.Color backgroundColor, { int flex: 0 }) { 19 void addFlexChildSolidColor(RenderFlex parent, sky.Color backgroundColor, { int flex: 0 }) {
19 RenderSolidColorBox child = new RenderSolidColorBox(backgroundColor); 20 RenderSolidColorBox child = new RenderSolidColorBox(backgroundColor);
20 parent.add(child); 21 parent.add(child);
21 child.parentData.flex = flex; 22 child.parentData.flex = flex;
22 } 23 }
23 24
24 // Solid colour, Widget version 25 // Solid colour, Widget version
25 class Rectangle extends Component { 26 class Rectangle extends Component {
(...skipping 26 matching lines...) Expand all
52 new Rectangle(const Color(0xFFFFFF00), key: 'b'), 53 new Rectangle(const Color(0xFFFFFF00), key: 'b'),
53 ], 54 ],
54 direction: FlexDirection.vertical, 55 direction: FlexDirection.vertical,
55 justifyContent: FlexJustifyContent.spaceBetween 56 justifyContent: FlexJustifyContent.spaceBetween
56 ); 57 );
57 } 58 }
58 59
59 double timeBase; 60 double timeBase;
60 RenderTransform transformBox; 61 RenderTransform transformBox;
61 62
63 final TestRenderView tester = new TestRenderView();
64
62 void rotate(double timeStamp) { 65 void rotate(double timeStamp) {
63 if (timeBase == null) 66 if (timeBase == null)
64 timeBase = timeStamp; 67 timeBase = timeStamp;
65 double delta = (timeStamp - timeBase) / 1000; // radians 68 double delta = (timeStamp - timeBase) / 1000; // radians
66 69
67 transformBox.setIdentity(); 70 transformBox.setIdentity();
68 transformBox.translate(transformBox.size.width / 2.0, transformBox.size.height / 2.0); 71 transformBox.translate(transformBox.size.width / 2.0, transformBox.size.height / 2.0);
69 transformBox.rotateZ(delta); 72 transformBox.rotateZ(delta);
70 transformBox.translate(-transformBox.size.width / 2.0, -transformBox.size.heig ht / 2.0); 73 transformBox.translate(-transformBox.size.width / 2.0, -transformBox.size.heig ht / 2.0);
74
75 // tester.checkFrame();
71 } 76 }
72 77
78 final bool debugDisplayList = false; // set this to true to use the test renderi ng logic
79
73 void main() { 80 void main() {
81 // Because we're going to use UINodes, we want to initialise its
82 // AppView, not use the default one. We don't really need to do
83 // this, because RenderObjectToUINodeAdapter does it for us, but
84 // it's good practice in case we happen to not have a
85 // RenderObjectToUINodeAdapter in our tree at startup, or in case we
86 // want a renderViewOverride.
87 UINodeAppView.initUINodeAppView(renderViewOverride: debugDisplayList ? tester : null);
88
74 RenderFlex flexRoot = new RenderFlex(direction: FlexDirection.vertical); 89 RenderFlex flexRoot = new RenderFlex(direction: FlexDirection.vertical);
75 90
76 RenderProxyBox proxy = new RenderProxyBox(); 91 RenderProxyBox proxy = new RenderProxyBox();
77 new RenderObjectToUINodeAdapter(proxy, builder); // adds itself to proxy 92 new RenderObjectToUINodeAdapter(proxy, builder); // adds itself to proxy
78 93
79 addFlexChildSolidColor(flexRoot, const sky.Color(0xFFFF00FF), flex: 1); 94 addFlexChildSolidColor(flexRoot, const sky.Color(0xFFFF00FF), flex: 1);
80 flexRoot.add(proxy); 95 flexRoot.add(proxy);
81 addFlexChildSolidColor(flexRoot, const sky.Color(0xFF0000FF), flex: 1); 96 addFlexChildSolidColor(flexRoot, const sky.Color(0xFF0000FF), flex: 1);
82 97
83 transformBox = new RenderTransform(child: flexRoot, transform: new Matrix4.ide ntity()); 98 transformBox = new RenderTransform(child: flexRoot, transform: new Matrix4.ide ntity());
84 RenderPadding root = new RenderPadding(padding: new EdgeDims.all(20.0), child: transformBox); 99 RenderPadding root = new RenderPadding(padding: new EdgeDims.all(20.0), child: transformBox);
85 100
86 // Because we're going to use UINodes, we want to initialise its
87 // AppView, not use the default one. We don't really need to do
88 // this, because RenderObjectToUINodeAdapter does it for us, but
89 // it's good practice in case we happen to not have a
90 // RenderObjectToUINodeAdapter in our tree at startup.
91 UINodeAppView.initUINodeAppView();
92 UINodeAppView.appView.root = root; 101 UINodeAppView.appView.root = root;
93
94 addPersistentFrameCallback(rotate); 102 addPersistentFrameCallback(rotate);
95 } 103 }
OLDNEW
« no previous file with comments | « no previous file | sky/sdk/lib/framework/widgets/raised_button.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698