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 #include <set> | 10 #include <set> |
(...skipping 746 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
757 return; | 757 return; |
758 } | 758 } |
759 | 759 |
760 twin_tiling->UpdateTilePriority(tile); | 760 twin_tiling->UpdateTilePriority(tile); |
761 } | 761 } |
762 | 762 |
763 void PictureLayerTiling::UpdateTilePriority(Tile* tile) const { | 763 void PictureLayerTiling::UpdateTilePriority(Tile* tile) const { |
764 // TODO(vmpstr): This code should return the priority instead of setting it on | 764 // TODO(vmpstr): This code should return the priority instead of setting it on |
765 // the tile. This should be a part of the change to move tile priority from | 765 // the tile. This should be a part of the change to move tile priority from |
766 // tiles into iterators. | 766 // tiles into iterators. |
| 767 TilePriority::PriorityBin max_tile_priority_bin = |
| 768 client_->GetMaxTilePriorityBin(); |
767 WhichTree tree = client_->GetTree(); | 769 WhichTree tree = client_->GetTree(); |
768 | 770 |
769 DCHECK_EQ(TileAt(tile->tiling_i_index(), tile->tiling_j_index()), tile); | 771 DCHECK_EQ(TileAt(tile->tiling_i_index(), tile->tiling_j_index()), tile); |
770 gfx::Rect tile_bounds = | 772 gfx::Rect tile_bounds = |
771 tiling_data_.TileBounds(tile->tiling_i_index(), tile->tiling_j_index()); | 773 tiling_data_.TileBounds(tile->tiling_i_index(), tile->tiling_j_index()); |
772 | 774 |
773 if (current_visible_rect_.Intersects(tile_bounds)) { | 775 if (max_tile_priority_bin <= TilePriority::NOW && |
| 776 current_visible_rect_.Intersects(tile_bounds)) { |
774 tile->SetPriority(tree, TilePriority(resolution_, TilePriority::NOW, 0)); | 777 tile->SetPriority(tree, TilePriority(resolution_, TilePriority::NOW, 0)); |
775 if (tree == PENDING_TREE) | 778 if (tree == PENDING_TREE) |
776 tile->set_required_for_activation(IsTileRequiredForActivation(tile)); | 779 tile->set_required_for_activation(IsTileRequiredForActivation(tile)); |
777 tile->set_is_occluded(tree, IsTileOccluded(tile)); | 780 tile->set_is_occluded(tree, IsTileOccluded(tile)); |
778 return; | 781 return; |
779 } | 782 } |
780 | 783 |
781 if (tree == PENDING_TREE) | 784 if (tree == PENDING_TREE) |
782 tile->set_required_for_activation(false); | 785 tile->set_required_for_activation(false); |
783 tile->set_is_occluded(tree, false); | 786 tile->set_is_occluded(tree, false); |
784 | 787 |
785 DCHECK_GT(content_to_screen_scale_, 0.f); | 788 DCHECK_GT(content_to_screen_scale_, 0.f); |
786 float distance_to_visible = | 789 float distance_to_visible = |
787 current_visible_rect_.ManhattanInternalDistance(tile_bounds) * | 790 current_visible_rect_.ManhattanInternalDistance(tile_bounds) * |
788 content_to_screen_scale_; | 791 content_to_screen_scale_; |
789 | 792 |
790 if (current_soon_border_rect_.Intersects(tile_bounds) || | 793 if (max_tile_priority_bin <= TilePriority::SOON && |
791 current_skewport_rect_.Intersects(tile_bounds)) { | 794 (current_soon_border_rect_.Intersects(tile_bounds) || |
| 795 current_skewport_rect_.Intersects(tile_bounds))) { |
792 tile->SetPriority( | 796 tile->SetPriority( |
793 tree, | 797 tree, |
794 TilePriority(resolution_, TilePriority::SOON, distance_to_visible)); | 798 TilePriority(resolution_, TilePriority::SOON, distance_to_visible)); |
795 return; | 799 return; |
796 } | 800 } |
797 | 801 |
798 tile->SetPriority( | 802 tile->SetPriority( |
799 tree, | 803 tree, |
800 TilePriority(resolution_, TilePriority::EVENTUALLY, distance_to_visible)); | 804 TilePriority(resolution_, TilePriority::EVENTUALLY, distance_to_visible)); |
801 } | 805 } |
(...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1232 DCHECK(*this); | 1236 DCHECK(*this); |
1233 do { | 1237 do { |
1234 ++current_eviction_tiles_index_; | 1238 ++current_eviction_tiles_index_; |
1235 } while (current_eviction_tiles_index_ != eviction_tiles_->size() && | 1239 } while (current_eviction_tiles_index_ != eviction_tiles_->size() && |
1236 !(*eviction_tiles_)[current_eviction_tiles_index_]->HasResources()); | 1240 !(*eviction_tiles_)[current_eviction_tiles_index_]->HasResources()); |
1237 | 1241 |
1238 return *this; | 1242 return *this; |
1239 } | 1243 } |
1240 | 1244 |
1241 } // namespace cc | 1245 } // namespace cc |
OLD | NEW |