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 763 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
774 return; | 774 return; |
775 } | 775 } |
776 | 776 |
777 twin_tiling->UpdateTilePriority(tile); | 777 twin_tiling->UpdateTilePriority(tile); |
778 } | 778 } |
779 | 779 |
780 void PictureLayerTiling::UpdateTilePriority(Tile* tile) const { | 780 void PictureLayerTiling::UpdateTilePriority(Tile* tile) const { |
781 // TODO(vmpstr): This code should return the priority instead of setting it on | 781 // TODO(vmpstr): This code should return the priority instead of setting it on |
782 // the tile. This should be a part of the change to move tile priority from | 782 // the tile. This should be a part of the change to move tile priority from |
783 // tiles into iterators. | 783 // tiles into iterators. |
| 784 TilePriority::PriorityBin max_tile_priority_bin = |
| 785 client_->GetMaxTilePriorityBin(); |
784 WhichTree tree = client_->GetTree(); | 786 WhichTree tree = client_->GetTree(); |
785 | 787 |
786 DCHECK_EQ(TileAt(tile->tiling_i_index(), tile->tiling_j_index()), tile); | 788 DCHECK_EQ(TileAt(tile->tiling_i_index(), tile->tiling_j_index()), tile); |
787 gfx::Rect tile_bounds = | 789 gfx::Rect tile_bounds = |
788 tiling_data_.TileBounds(tile->tiling_i_index(), tile->tiling_j_index()); | 790 tiling_data_.TileBounds(tile->tiling_i_index(), tile->tiling_j_index()); |
789 | 791 |
790 if (current_visible_rect_.Intersects(tile_bounds)) { | 792 if (max_tile_priority_bin <= TilePriority::NOW && |
| 793 current_visible_rect_.Intersects(tile_bounds)) { |
791 tile->SetPriority(tree, TilePriority(resolution_, TilePriority::NOW, 0)); | 794 tile->SetPriority(tree, TilePriority(resolution_, TilePriority::NOW, 0)); |
792 if (tree == PENDING_TREE) { | 795 if (tree == PENDING_TREE) { |
793 tile->set_required_for_activation( | 796 tile->set_required_for_activation( |
794 IsTileRequiredForActivationIfVisible(tile)); | 797 IsTileRequiredForActivationIfVisible(tile)); |
795 } else { | 798 } else { |
796 tile->set_required_for_draw(IsTileRequiredForDrawIfVisible(tile)); | 799 tile->set_required_for_draw(IsTileRequiredForDrawIfVisible(tile)); |
797 } | 800 } |
798 tile->set_is_occluded(tree, IsTileOccluded(tile)); | 801 tile->set_is_occluded(tree, IsTileOccluded(tile)); |
799 return; | 802 return; |
800 } | 803 } |
801 | 804 |
802 if (tree == PENDING_TREE) | 805 if (tree == PENDING_TREE) |
803 tile->set_required_for_activation(false); | 806 tile->set_required_for_activation(false); |
804 else | 807 else |
805 tile->set_required_for_draw(false); | 808 tile->set_required_for_draw(false); |
806 tile->set_is_occluded(tree, false); | 809 tile->set_is_occluded(tree, false); |
807 | 810 |
808 DCHECK_GT(content_to_screen_scale_, 0.f); | 811 DCHECK_GT(content_to_screen_scale_, 0.f); |
809 float distance_to_visible = | 812 float distance_to_visible = |
810 current_visible_rect_.ManhattanInternalDistance(tile_bounds) * | 813 current_visible_rect_.ManhattanInternalDistance(tile_bounds) * |
811 content_to_screen_scale_; | 814 content_to_screen_scale_; |
812 | 815 |
813 if (current_soon_border_rect_.Intersects(tile_bounds) || | 816 if (max_tile_priority_bin <= TilePriority::SOON && |
814 current_skewport_rect_.Intersects(tile_bounds)) { | 817 (current_soon_border_rect_.Intersects(tile_bounds) || |
| 818 current_skewport_rect_.Intersects(tile_bounds))) { |
815 tile->SetPriority( | 819 tile->SetPriority( |
816 tree, | 820 tree, |
817 TilePriority(resolution_, TilePriority::SOON, distance_to_visible)); | 821 TilePriority(resolution_, TilePriority::SOON, distance_to_visible)); |
818 return; | 822 return; |
819 } | 823 } |
820 | 824 |
821 tile->SetPriority( | 825 tile->SetPriority( |
822 tree, | 826 tree, |
823 TilePriority(resolution_, TilePriority::EVENTUALLY, distance_to_visible)); | 827 TilePriority(resolution_, TilePriority::EVENTUALLY, distance_to_visible)); |
824 } | 828 } |
(...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1255 DCHECK(*this); | 1259 DCHECK(*this); |
1256 do { | 1260 do { |
1257 ++current_eviction_tiles_index_; | 1261 ++current_eviction_tiles_index_; |
1258 } while (current_eviction_tiles_index_ != eviction_tiles_->size() && | 1262 } while (current_eviction_tiles_index_ != eviction_tiles_->size() && |
1259 !(*eviction_tiles_)[current_eviction_tiles_index_]->HasResources()); | 1263 !(*eviction_tiles_)[current_eviction_tiles_index_]->HasResources()); |
1260 | 1264 |
1261 return *this; | 1265 return *this; |
1262 } | 1266 } |
1263 | 1267 |
1264 } // namespace cc | 1268 } // namespace cc |
OLD | NEW |