| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <!-- | 2 <!-- |
| 3 Copyright (c) 2014 The Chromium Authors. All rights reserved. | 3 Copyright (c) 2014 The Chromium Authors. All rights reserved. |
| 4 Use of this source code is governed by a BSD-style license that can be | 4 Use of this source code is governed by a BSD-style license that can be |
| 5 found in the LICENSE file. | 5 found in the LICENSE file. |
| 6 --> | 6 --> |
| 7 <link rel="import" href="/tracing/base/base.html"> | 7 <link rel="import" href="/tracing/base/base.html"> |
| 8 <link rel="import" href="/tracing/base/math.html"> | 8 <link rel="import" href="/tracing/base/math/math.html"> |
| 9 <link rel="import" href="/tracing/base/rect.html"> | 9 <link rel="import" href="/tracing/base/math/rect.html"> |
| 10 | 10 |
| 11 <script> | 11 <script> |
| 12 'use strict'; | 12 'use strict'; |
| 13 | 13 |
| 14 /** | 14 /** |
| 15 * @fileoverview 2D bounding box computations. | 15 * @fileoverview 2D bounding box computations. |
| 16 */ | 16 */ |
| 17 tr.exportTo('tr.b', function() { | 17 tr.exportTo('tr.b.math', function() { |
| 18 /** | 18 /** |
| 19 * Tracks a 2D bounding box. | 19 * Tracks a 2D bounding box. |
| 20 * @constructor | 20 * @constructor |
| 21 */ | 21 */ |
| 22 function BBox2() { | 22 function BBox2() { |
| 23 this.isEmpty_ = true; | 23 this.isEmpty_ = true; |
| 24 this.min_ = undefined; | 24 this.min_ = undefined; |
| 25 this.max_ = undefined; | 25 this.max_ = undefined; |
| 26 } | 26 } |
| 27 | 27 |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 }, | 134 }, |
| 135 | 135 |
| 136 toString: function() { | 136 toString: function() { |
| 137 if (this.isEmpty_) | 137 if (this.isEmpty_) |
| 138 return 'empty'; | 138 return 'empty'; |
| 139 return 'min=(' + this.min_[0] + ',' + this.min_[1] + ') ' + | 139 return 'min=(' + this.min_[0] + ',' + this.min_[1] + ') ' + |
| 140 'max=(' + this.max_[0] + ',' + this.max_[1] + ')'; | 140 'max=(' + this.max_[0] + ',' + this.max_[1] + ')'; |
| 141 }, | 141 }, |
| 142 | 142 |
| 143 asRect: function() { | 143 asRect: function() { |
| 144 return tr.b.Rect.fromXYWH( | 144 return tr.b.math.Rect.fromXYWH( |
| 145 this.min_[0], | 145 this.min_[0], |
| 146 this.min_[1], | 146 this.min_[1], |
| 147 this.max_[0] - this.min_[0], | 147 this.max_[0] - this.min_[0], |
| 148 this.max_[1] - this.min_[1]); | 148 this.max_[1] - this.min_[1]); |
| 149 } | 149 } |
| 150 }; | 150 }; |
| 151 | 151 |
| 152 return { | 152 return { |
| 153 BBox2, | 153 BBox2, |
| 154 }; | 154 }; |
| 155 }); | 155 }); |
| 156 </script> | 156 </script> |
| OLD | NEW |