OLD | NEW |
(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 */ |
| 5 'use strict'; |
| 6 |
| 7 base.require('base.bbox2'); |
| 8 base.require('model.constants'); |
| 9 |
| 10 base.exportTo('ccfv.model', function() { |
| 11 |
| 12 /** |
| 13 * Represents a cc::LayerTreeImpl |
| 14 * |
| 15 * @constructor |
| 16 */ |
| 17 function LayerTreeImpl(which_tree) { |
| 18 this.which_tree = which_tree; |
| 19 this.tiles = []; |
| 20 this.tileBBox_ = undefined; |
| 21 }; |
| 22 |
| 23 LayerTreeImpl.prototype = { |
| 24 resetTiles: function() { |
| 25 this.tilse = []; |
| 26 this.tileBBox_ = undefined; |
| 27 }, |
| 28 |
| 29 get tileBBox() { |
| 30 if (!this.tileBBox_) { |
| 31 var bbox = new base.BBox2(); |
| 32 for (var i = 0; i < this.tiles.length; i++) { |
| 33 var tile = this.tiles[i]; |
| 34 var priority = tile.priority[this.which_tree]; |
| 35 if (!priority.current_screen_quad) |
| 36 continue; |
| 37 bbox.addQuad(priority.current_screen_quad); |
| 38 } |
| 39 this.tileBBox_ = bbox; |
| 40 } |
| 41 return this.tileBBox_; |
| 42 }, |
| 43 |
| 44 }; |
| 45 |
| 46 return { |
| 47 LayerTreeImpl: LayerTreeImpl |
| 48 } |
| 49 }); |
| 50 |
OLD | NEW |