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

Side by Side Diff: tracing/tracing/extras/chrome/cc/region.html

Issue 2771723003: [tracing] Move math utilities from base into their own subdirectory (attempt 2) (Closed)
Patch Set: rebase Created 3 years, 9 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 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <!-- 2 <!--
3 Copyright (c) 2013 The Chromium Authors. All rights reserved. 3 Copyright (c) 2013 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 7
8 <link rel="import" href="/tracing/base/rect.html"> 8 <link rel="import" href="/tracing/base/math/rect.html">
9 <script> 9 <script>
10 'use strict'; 10 'use strict';
11 11
12 tr.exportTo('tr.e.cc', function() { 12 tr.exportTo('tr.e.cc', function() {
13 /** 13 /**
14 * @constructor 14 * @constructor
15 */ 15 */
16 function Region() { 16 function Region() {
17 this.rects = []; 17 this.rects = [];
18 } 18 }
19 19
20 Region.fromArray = function(array) { 20 Region.fromArray = function(array) {
21 if (array.length % 4 !== 0) 21 if (array.length % 4 !== 0)
22 throw new Error('Array must consist be a multiple of 4 in length'); 22 throw new Error('Array must consist be a multiple of 4 in length');
23 23
24 var r = new Region(); 24 var r = new Region();
25 for (var i = 0; i < array.length; i += 4) { 25 for (var i = 0; i < array.length; i += 4) {
26 r.rects.push(tr.b.Rect.fromXYWH(array[i], array[i + 1], 26 r.rects.push(tr.b.math.Rect.fromXYWH(array[i], array[i + 1],
27 array[i + 2], array[i + 3])); 27 array[i + 2], array[i + 3]));
28 } 28 }
29 return r; 29 return r;
30 }; 30 };
31 31
32 /** 32 /**
33 * @return {Region} If array is undefined, returns an empty region. Otherwise 33 * @return {Region} If array is undefined, returns an empty region. Otherwise
34 * returns Region.fromArray(array). 34 * returns Region.fromArray(array).
35 */ 35 */
36 Region.fromArrayOrUndefined = function(array) { 36 Region.fromArrayOrUndefined = function(array) {
(...skipping 16 matching lines...) Expand all
53 addRect: function(r) { 53 addRect: function(r) {
54 this.rects.push(r); 54 this.rects.push(r);
55 } 55 }
56 }; 56 };
57 57
58 return { 58 return {
59 Region, 59 Region,
60 }; 60 };
61 }); 61 });
62 </script> 62 </script>
OLDNEW
« no previous file with comments | « tracing/tracing/extras/chrome/cc/picture.html ('k') | tracing/tracing/extras/chrome/cc/render_pass.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698