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

Side by Side Diff: sky/sdk/lib/rendering/box.dart

Issue 1195113002: Improve stocks2 performance (Closed) Base URL: git@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 | « sky/sdk/lib/rendering/block.dart ('k') | sky/sdk/lib/rendering/object.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:math' as math; 5 import 'dart:math' as math;
6 import 'dart:sky' as sky; 6 import 'dart:sky' as sky;
7 7
8 import 'package:vector_math/vector_math.dart'; 8 import 'package:vector_math/vector_math.dart';
9 9
10 import '../base/debug.dart'; 10 import '../base/debug.dart';
(...skipping 24 matching lines...) Expand all
35 this.left: 0.0 }); 35 this.left: 0.0 });
36 const EdgeDims.symmetric({ double vertical: 0.0, 36 const EdgeDims.symmetric({ double vertical: 0.0,
37 double horizontal: 0.0 }) 37 double horizontal: 0.0 })
38 : top = vertical, left = horizontal, bottom = vertical, right = horizontal; 38 : top = vertical, left = horizontal, bottom = vertical, right = horizontal;
39 39
40 final double top; 40 final double top;
41 final double right; 41 final double right;
42 final double bottom; 42 final double bottom;
43 final double left; 43 final double left;
44 44
45 operator ==(EdgeDims other) => (top == other.top) || 45 bool operator ==(other) {
46 (right == other.right) || 46 if (identical(this, other))
47 (bottom == other.bottom) || 47 return true;
48 (left == other.left); 48 return other is EdgeDims
49 && top == other.top
50 && right == other.right
51 && bottom == other.bottom
52 && left == other.left;
53 }
49 54
50 int get hashCode { 55 int get hashCode {
51 int value = 373; 56 int value = 373;
52 value = 37 * value + top.hashCode; 57 value = 37 * value + top.hashCode;
53 value = 37 * value + left.hashCode; 58 value = 37 * value + left.hashCode;
54 value = 37 * value + bottom.hashCode; 59 value = 37 * value + bottom.hashCode;
55 value = 37 * value + right.hashCode; 60 value = 37 * value + right.hashCode;
56 return value; 61 return value;
57 } 62 }
58 String toString() => "EdgeDims($top, $right, $bottom, $left)"; 63 String toString() => "EdgeDims($top, $right, $bottom, $left)";
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 178
174 Size constrain(Size size) { 179 Size constrain(Size size) {
175 Size result = new Size(constrainWidth(size.width), constrainHeight(size.heig ht)); 180 Size result = new Size(constrainWidth(size.width), constrainHeight(size.heig ht));
176 if (size is _DebugSize) 181 if (size is _DebugSize)
177 result = new _DebugSize(result, size._owner, size._canBeUsedByParent); 182 result = new _DebugSize(result, size._owner, size._canBeUsedByParent);
178 return result; 183 return result;
179 } 184 }
180 185
181 bool get isInfinite => maxWidth >= double.INFINITY && maxHeight >= double.INFI NITY; 186 bool get isInfinite => maxWidth >= double.INFINITY && maxHeight >= double.INFI NITY;
182 187
188 bool get hasTightWidth => minWidth == maxWidth;
189 bool get hasTightHeight => minHeight == maxHeight;
190 bool get isTight => hasTightWidth && hasTightHeight;
191
192 bool operator ==(other) {
193 if (identical(this, other))
194 return true;
195 return other is BoxConstraints &&
196 minWidth == other.minWidth &&
197 maxWidth == other.maxWidth &&
198 minHeight == other.minHeight &&
199 maxHeight == other.maxHeight;
200 }
183 int get hashCode { 201 int get hashCode {
184 int value = 373; 202 int value = 373;
185 value = 37 * value + minWidth.hashCode; 203 value = 37 * value + minWidth.hashCode;
186 value = 37 * value + maxWidth.hashCode; 204 value = 37 * value + maxWidth.hashCode;
187 value = 37 * value + minHeight.hashCode; 205 value = 37 * value + minHeight.hashCode;
188 value = 37 * value + maxHeight.hashCode; 206 value = 37 * value + maxHeight.hashCode;
189 return value; 207 return value;
190 } 208 }
209
191 String toString() => "BoxConstraints($minWidth<=w<$maxWidth, $minHeight<=h<$ma xHeight)"; 210 String toString() => "BoxConstraints($minWidth<=w<$maxWidth, $minHeight<=h<$ma xHeight)";
192 } 211 }
193 212
194 class BoxHitTestEntry extends HitTestEntry { 213 class BoxHitTestEntry extends HitTestEntry {
195 const BoxHitTestEntry(HitTestTarget target, this.localPosition) : super(target ); 214 const BoxHitTestEntry(HitTestTarget target, this.localPosition) : super(target );
196 final Point localPosition; 215 final Point localPosition;
197 } 216 }
198 217
199 class BoxParentData extends ParentData { 218 class BoxParentData extends ParentData {
200 Point _position = Point.origin; 219 Point _position = Point.origin;
(...skipping 844 matching lines...) Expand 10 before | Expand all | Expand 10 after
1045 result.add(new HitTestEntry(this)); 1064 result.add(new HitTestEntry(this));
1046 return true; 1065 return true;
1047 } 1066 }
1048 1067
1049 void paint(RenderObjectDisplayList canvas) { 1068 void paint(RenderObjectDisplayList canvas) {
1050 if (child != null) 1069 if (child != null)
1051 canvas.paintChild(child, Point.origin); 1070 canvas.paintChild(child, Point.origin);
1052 } 1071 }
1053 1072
1054 void paintFrame() { 1073 void paintFrame() {
1074 sky.tracing.begin('RenderView.paintFrame');
1055 RenderObject.debugDoingPaint = true; 1075 RenderObject.debugDoingPaint = true;
1056 RenderObjectDisplayList canvas = new RenderObjectDisplayList(sky.view.width, sky.view.height); 1076 try {
1057 paint(canvas); 1077 RenderObjectDisplayList canvas = new RenderObjectDisplayList(sky.view.widt h, sky.view.height);
1058 sky.view.picture = canvas.endRecording(); 1078 paint(canvas);
1059 RenderObject.debugDoingPaint = false; 1079 sky.view.picture = canvas.endRecording();
1080 } finally {
1081 RenderObject.debugDoingPaint = false;
1082 sky.tracing.end('RenderView.paintFrame');
1083 }
1060 } 1084 }
1061 1085
1062 } 1086 }
1063 1087
1064 // DEFAULT BEHAVIORS FOR RENDERBOX CONTAINERS 1088 // DEFAULT BEHAVIORS FOR RENDERBOX CONTAINERS
1065 abstract class RenderBoxContainerDefaultsMixin<ChildType extends RenderBox, Pare ntDataType extends ContainerParentDataMixin<ChildType>> implements ContainerRend erObjectMixin<ChildType, ParentDataType> { 1089 abstract class RenderBoxContainerDefaultsMixin<ChildType extends RenderBox, Pare ntDataType extends ContainerParentDataMixin<ChildType>> implements ContainerRend erObjectMixin<ChildType, ParentDataType> {
1066 1090
1067 void defaultHitTestChildren(HitTestResult result, { Point position }) { 1091 void defaultHitTestChildren(HitTestResult result, { Point position }) {
1068 // the x, y parameters have the top left of the node's box as the origin 1092 // the x, y parameters have the top left of the node's box as the origin
1069 ChildType child = lastChild; 1093 ChildType child = lastChild;
(...skipping 11 matching lines...) Expand all
1081 1105
1082 void defaultPaint(RenderObjectDisplayList canvas) { 1106 void defaultPaint(RenderObjectDisplayList canvas) {
1083 RenderBox child = firstChild; 1107 RenderBox child = firstChild;
1084 while (child != null) { 1108 while (child != null) {
1085 assert(child.parentData is ParentDataType); 1109 assert(child.parentData is ParentDataType);
1086 canvas.paintChild(child, child.parentData.position); 1110 canvas.paintChild(child, child.parentData.position);
1087 child = child.parentData.nextSibling; 1111 child = child.parentData.nextSibling;
1088 } 1112 }
1089 } 1113 }
1090 } 1114 }
OLDNEW
« no previous file with comments | « sky/sdk/lib/rendering/block.dart ('k') | sky/sdk/lib/rendering/object.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698