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

Side by Side Diff: sky/engine/core/painting/Rect.dart

Issue 1233623007: Provide some debug-mode time hooks to visually debug painting and layout. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 5 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/base/debug.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 part of dart.sky; 5 part of dart.sky;
6 6
7 /// Holds 4 floating-point coordinates for a rectangle. 7 /// Holds 4 floating-point coordinates for a rectangle.
8 class Rect { 8 class Rect {
9 Rect(); 9 Rect();
10 10
(...skipping 12 matching lines...) Expand all
23 ..[2] = left + width 23 ..[2] = left + width
24 ..[3] = top + height; 24 ..[3] = top + height;
25 } 25 }
26 26
27 final Float32List _value = new Float32List(4); 27 final Float32List _value = new Float32List(4);
28 double get left => _value[0]; 28 double get left => _value[0];
29 double get top => _value[1]; 29 double get top => _value[1];
30 double get right => _value[2]; 30 double get right => _value[2];
31 double get bottom => _value[3]; 31 double get bottom => _value[3];
32 32
33 Rect shift(Offset offset) {
34 return new Rect.fromLTRB(left + offset.dx, top + offset.dy, right + offset.d x, bottom + offset.dy);
35 }
36 Rect inflate(double delta) {
37 return new Rect.fromLTRB(left - delta, top - delta, right + delta, bottom + delta);
38 }
39
33 double get width => right - left; 40 double get width => right - left;
34 double get height => bottom - top; 41 double get height => bottom - top;
35 42
36 Size get size => new Size(width, height); 43 Size get size => new Size(width, height);
37 44
38 double get shortestSide { 45 double get shortestSide {
39 double w = width.abs(); 46 double w = width.abs();
40 double h = height.abs(); 47 double h = height.abs();
41 return w < h ? w : h; 48 return w < h ? w : h;
42 } 49 }
(...skipping 15 matching lines...) Expand all
58 return false; 65 return false;
59 for (var i = 0; i < 4; ++i) { 66 for (var i = 0; i < 4; ++i) {
60 if (_value[i] != other._value[i]) 67 if (_value[i] != other._value[i])
61 return false; 68 return false;
62 } 69 }
63 return true; 70 return true;
64 } 71 }
65 int get hashCode =>_value.fold(373, (value, item) => (37 * value + item.hashCo de)); 72 int get hashCode =>_value.fold(373, (value, item) => (37 * value + item.hashCo de));
66 String toString() => "Rect.fromLTRB($left, $top, $right, $bottom)"; 73 String toString() => "Rect.fromLTRB($left, $top, $right, $bottom)";
67 } 74 }
OLDNEW
« no previous file with comments | « no previous file | sky/sdk/lib/base/debug.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698