OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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 #include "cc/tile.h" | 5 #include "cc/tile.h" |
6 | 6 |
7 #include "cc/tile_manager.h" | 7 #include "cc/tile_manager.h" |
8 #include "third_party/khronos/GLES2/gl2.h" | 8 #include "third_party/khronos/GLES2/gl2.h" |
9 | 9 |
10 namespace cc { | 10 namespace cc { |
11 | 11 |
12 Tile::Tile(TileManager* tile_manager, | 12 Tile::Tile(TileManager* tile_manager, |
13 PicturePileImpl* picture_pile, | 13 PicturePileImpl* picture_pile, |
14 gfx::Size tile_size, | 14 gfx::Size tile_size, |
15 GLenum format, | 15 GLenum format, |
16 gfx::Rect rect_inside_picture) | 16 gfx::Rect rect_inside_picture, |
| 17 float contents_scale) |
17 : tile_manager_(tile_manager), | 18 : tile_manager_(tile_manager), |
18 picture_pile_(picture_pile), | 19 picture_pile_(picture_pile), |
19 tile_size_(tile_size), | 20 tile_size_(tile_size), |
20 format_(format), | 21 format_(format), |
21 rect_inside_picture_(rect_inside_picture) { | 22 rect_inside_picture_(rect_inside_picture), |
| 23 contents_scale_(contents_scale) { |
22 tile_manager_->RegisterTile(this); | 24 tile_manager_->RegisterTile(this); |
23 } | 25 } |
24 | 26 |
25 Tile::~Tile() { | 27 Tile::~Tile() { |
26 tile_manager_->UnregisterTile(this); | 28 tile_manager_->UnregisterTile(this); |
27 } | 29 } |
28 | 30 |
29 void Tile::set_priority(WhichTree tree, const TilePriority& priority) { | 31 void Tile::set_priority(WhichTree tree, const TilePriority& priority) { |
30 tile_manager_->WillModifyTilePriority(this, tree, priority); | 32 tile_manager_->WillModifyTilePriority(this, tree, priority); |
31 priority_[tree] = priority; | 33 priority_[tree] = priority; |
32 } | 34 } |
33 | 35 |
34 size_t Tile::bytes_consumed_if_allocated() const { | 36 size_t Tile::bytes_consumed_if_allocated() const { |
35 DCHECK(format_ == GL_RGBA); | 37 DCHECK(format_ == GL_RGBA); |
36 return 4 * tile_size_.width() * tile_size_.height(); | 38 return 4 * tile_size_.width() * tile_size_.height(); |
37 } | 39 } |
38 | 40 |
39 } // namespace cc | 41 } // namespace cc |
OLD | NEW |