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

Side by Side Diff: tools/cc-frame-viewer/src/base/rect2.js

Issue 15736032: Remove old cc-frame-viewer now that it is upstreamed into trace_viewer (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 'use strict';
5
6 /**
7 * @fileoverview Quick range computations.
8 */
9 base.require('base.gl_matrix');
10
11 base.exportTo('base', function() {
12
13 /**
14 * Tracks a 2D bounding box.
15 * @constructor
16 */
17 function Rect2() {
18 this.left = 0;
19 this.top = 0;
20 this.width = 0;
21 this.height = 0;
22 };
23 Rect2.FromXYWH = function(x, y, w, h) {
24 var rect = new Rect2();
25 rect.left = x;
26 rect.top = y;
27 rect.width = w;
28 rect.height = h;
29 return rect;
30 }
31
32 Rect2.prototype = {
33 __proto__: Object.prototype,
34
35 translateXY: function(x, y) {
36 this.left += x;
37 this.top += y;
38 },
39
40 enlarge: function(pad) {
41 this.left -= pad;
42 this.top -= pad;
43 this.width += 2*pad;
44 this.height += 2*pad;
45 },
46
47 get right() {
48 return this.left + this.width;
49 },
50
51 get bottom() {
52 return this.left + this.width;
53 }
54 };
55
56 return {
57 Rect2: Rect2
58 };
59
60 });
OLDNEW
« no previous file with comments | « tools/cc-frame-viewer/src/base/range_test.html ('k') | tools/cc-frame-viewer/src/base/unittest.css » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698