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/resources/picture_layer_tiling.h" | 5 #include "cc/resources/picture_layer_tiling.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <cmath> | 8 #include <cmath> |
9 #include <limits> | 9 #include <limits> |
10 | 10 |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
104 return opaque_region; | 104 return opaque_region; |
105 } | 105 } |
106 | 106 |
107 void PictureLayerTiling::SetCanUseLCDText(bool can_use_lcd_text) { | 107 void PictureLayerTiling::SetCanUseLCDText(bool can_use_lcd_text) { |
108 for (TileMap::iterator it = tiles_.begin(); it != tiles_.end(); ++it) | 108 for (TileMap::iterator it = tiles_.begin(); it != tiles_.end(); ++it) |
109 it->second->set_can_use_lcd_text(can_use_lcd_text); | 109 it->second->set_can_use_lcd_text(can_use_lcd_text); |
110 } | 110 } |
111 | 111 |
112 void PictureLayerTiling::CreateMissingTilesInLiveTilesRect() { | 112 void PictureLayerTiling::CreateMissingTilesInLiveTilesRect() { |
113 const PictureLayerTiling* twin_tiling = client_->GetTwinTiling(this); | 113 const PictureLayerTiling* twin_tiling = client_->GetTwinTiling(this); |
114 for (TilingData::Iterator iter(&tiling_data_, live_tiles_rect_); iter; | 114 bool include_borders = true; |
115 for (TilingData::Iterator iter( | |
116 &tiling_data_, live_tiles_rect_, include_borders); | |
117 iter; | |
115 ++iter) { | 118 ++iter) { |
116 TileMapKey key = iter.index(); | 119 TileMapKey key = iter.index(); |
117 TileMap::iterator find = tiles_.find(key); | 120 TileMap::iterator find = tiles_.find(key); |
118 if (find != tiles_.end()) | 121 if (find != tiles_.end()) |
119 continue; | 122 continue; |
120 CreateTile(key.first, key.second, twin_tiling); | 123 CreateTile(key.first, key.second, twin_tiling); |
121 } | 124 } |
122 } | 125 } |
123 | 126 |
124 void PictureLayerTiling::SetLayerBounds(const gfx::Size& layer_bounds) { | 127 void PictureLayerTiling::SetLayerBounds(const gfx::Size& layer_bounds) { |
(...skipping 30 matching lines...) Expand all Loading... | |
155 | 158 |
156 void PictureLayerTiling::Invalidate(const Region& layer_region) { | 159 void PictureLayerTiling::Invalidate(const Region& layer_region) { |
157 std::vector<TileMapKey> new_tile_keys; | 160 std::vector<TileMapKey> new_tile_keys; |
158 for (Region::Iterator iter(layer_region); iter.has_rect(); iter.next()) { | 161 for (Region::Iterator iter(layer_region); iter.has_rect(); iter.next()) { |
159 gfx::Rect layer_rect = iter.rect(); | 162 gfx::Rect layer_rect = iter.rect(); |
160 gfx::Rect content_rect = | 163 gfx::Rect content_rect = |
161 gfx::ScaleToEnclosingRect(layer_rect, contents_scale_); | 164 gfx::ScaleToEnclosingRect(layer_rect, contents_scale_); |
162 content_rect.Intersect(live_tiles_rect_); | 165 content_rect.Intersect(live_tiles_rect_); |
163 if (content_rect.IsEmpty()) | 166 if (content_rect.IsEmpty()) |
164 continue; | 167 continue; |
165 for (TilingData::Iterator iter(&tiling_data_, content_rect); iter; ++iter) { | 168 bool include_borders = true; |
169 for (TilingData::Iterator iter( | |
170 &tiling_data_, content_rect, include_borders); | |
171 iter; | |
172 ++iter) { | |
166 TileMapKey key(iter.index()); | 173 TileMapKey key(iter.index()); |
167 TileMap::iterator find = tiles_.find(key); | 174 TileMap::iterator find = tiles_.find(key); |
168 if (find == tiles_.end()) | 175 if (find == tiles_.end()) |
169 continue; | 176 continue; |
170 tiles_.erase(find); | 177 tiles_.erase(find); |
171 new_tile_keys.push_back(key); | 178 new_tile_keys.push_back(key); |
172 } | 179 } |
173 } | 180 } |
174 | 181 |
175 const PictureLayerTiling* twin_tiling = client_->GetTwinTiling(this); | 182 const PictureLayerTiling* twin_tiling = client_->GetTwinTiling(this); |
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
428 | 435 |
429 current_visible_rect_in_content_space_ = visible_rect_in_content_space; | 436 current_visible_rect_in_content_space_ = visible_rect_in_content_space; |
430 current_skewport_ = skewport; | 437 current_skewport_ = skewport; |
431 current_eventually_rect_ = eventually_rect; | 438 current_eventually_rect_ = eventually_rect; |
432 | 439 |
433 TilePriority now_priority(resolution_, TilePriority::NOW, 0); | 440 TilePriority now_priority(resolution_, TilePriority::NOW, 0); |
434 float content_to_screen_scale = | 441 float content_to_screen_scale = |
435 1.0f / (contents_scale_ * layer_contents_scale); | 442 1.0f / (contents_scale_ * layer_contents_scale); |
436 | 443 |
437 // Assign now priority to all visible tiles. | 444 // Assign now priority to all visible tiles. |
438 for (TilingData::Iterator iter(&tiling_data_, visible_rect_in_content_space); | 445 bool include_borders = true; |
446 for (TilingData::Iterator iter( | |
447 &tiling_data_, visible_rect_in_content_space, include_borders); | |
439 iter; | 448 iter; |
440 ++iter) { | 449 ++iter) { |
441 TileMap::iterator find = tiles_.find(iter.index()); | 450 TileMap::iterator find = tiles_.find(iter.index()); |
442 if (find == tiles_.end()) | 451 if (find == tiles_.end()) |
443 continue; | 452 continue; |
444 Tile* tile = find->second.get(); | 453 Tile* tile = find->second.get(); |
445 | 454 |
446 tile->SetPriority(tree, now_priority); | 455 tile->SetPriority(tree, now_priority); |
447 } | 456 } |
448 | 457 |
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
730 PictureLayerTiling* tiling, | 739 PictureLayerTiling* tiling, |
731 WhichTree tree) | 740 WhichTree tree) |
732 : tiling_(tiling), | 741 : tiling_(tiling), |
733 type_(VISIBLE), | 742 type_(VISIBLE), |
734 visible_rect_in_content_space_( | 743 visible_rect_in_content_space_( |
735 tiling_->current_visible_rect_in_content_space_), | 744 tiling_->current_visible_rect_in_content_space_), |
736 skewport_in_content_space_(tiling_->current_skewport_), | 745 skewport_in_content_space_(tiling_->current_skewport_), |
737 eventually_rect_in_content_space_(tiling_->current_eventually_rect_), | 746 eventually_rect_in_content_space_(tiling_->current_eventually_rect_), |
738 tree_(tree), | 747 tree_(tree), |
739 current_tile_(NULL), | 748 current_tile_(NULL), |
740 visible_iterator_(&tiling->tiling_data_, visible_rect_in_content_space_), | 749 visible_iterator_(&tiling->tiling_data_, |
750 visible_rect_in_content_space_, | |
751 true), | |
danakj
2014/03/17 23:46:07
can you add comment that this bool is include_bord
enne (OOO)
2014/03/17 23:53:09
Ok sure. Comments always feel awkward to me, so I
| |
741 spiral_iterator_(&tiling->tiling_data_, | 752 spiral_iterator_(&tiling->tiling_data_, |
742 skewport_in_content_space_, | 753 skewport_in_content_space_, |
743 visible_rect_in_content_space_, | 754 visible_rect_in_content_space_, |
744 visible_rect_in_content_space_) { | 755 visible_rect_in_content_space_) { |
745 if (!visible_iterator_) { | 756 if (!visible_iterator_) { |
746 AdvancePhase(); | 757 AdvancePhase(); |
747 return; | 758 return; |
748 } | 759 } |
749 | 760 |
750 current_tile_ = | 761 current_tile_ = |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
810 return *this; | 821 return *this; |
811 next_index = spiral_iterator_.index(); | 822 next_index = spiral_iterator_.index(); |
812 break; | 823 break; |
813 } | 824 } |
814 current_tile_ = tiling_->TileAt(next_index.first, next_index.second); | 825 current_tile_ = tiling_->TileAt(next_index.first, next_index.second); |
815 } | 826 } |
816 return *this; | 827 return *this; |
817 } | 828 } |
818 | 829 |
819 } // namespace cc | 830 } // namespace cc |
OLD | NEW |