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

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

Issue 1209413004: Instead of applying a transform for every RenderObject, pass down an Offset for where to paint. (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
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
11 Rect.fromLTRB(double left, double top, double right, double bottom) { 11 Rect.fromLTRB(double left, double top, double right, double bottom) {
12 _value 12 _value
13 ..[0] = left 13 ..[0] = left
14 ..[1] = top 14 ..[1] = top
15 ..[2] = right 15 ..[2] = right
16 ..[3] = bottom; 16 ..[3] = bottom;
17 } 17 }
18 18
19 Rect.fromLTWH(double left, double top, double width, double height) {
20 _value
21 ..[0] = left
22 ..[1] = top
23 ..[2] = left + width
24 ..[3] = top + height;
25 }
26
19 Rect.fromPointAndSize(Point point, Size size) { 27 Rect.fromPointAndSize(Point point, Size size) {
20 _value 28 _value
21 ..[0] = point.x 29 ..[0] = point.x
22 ..[1] = point.y 30 ..[1] = point.y
23 ..[2] = point.x + size.width 31 ..[2] = point.x + size.width
24 ..[3] = point.y + size.height; 32 ..[3] = point.y + size.height;
25 } 33 }
26 34
27 // assumes top-left corner is at the origin (0,0) 35 // assumes top-left corner is at the origin (0,0)
28 Rect.fromSize(Size size) { 36 Rect.fromSize(Size size) {
(...skipping 27 matching lines...) Expand all
56 return false; 64 return false;
57 for (var i = 0; i < 4; ++i) { 65 for (var i = 0; i < 4; ++i) {
58 if (_value[i] != other._value[i]) 66 if (_value[i] != other._value[i])
59 return false; 67 return false;
60 } 68 }
61 return true; 69 return true;
62 } 70 }
63 int get hashCode =>_value.fold(373, (value, item) => (37 * value + item.hashCo de)); 71 int get hashCode =>_value.fold(373, (value, item) => (37 * value + item.hashCo de));
64 String toString() => "Rect.fromLTRB($left, $top, $right, $bottom)"; 72 String toString() => "Rect.fromLTRB($left, $top, $right, $bottom)";
65 } 73 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698