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/tiles/picture_layer_tiling.h" | 5 #include "cc/tiles/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 827 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
838 MakePrioritizedTile(tile, ComputePriorityRectTypeForTile(tile)); | 838 MakePrioritizedTile(tile, ComputePriorityRectTypeForTile(tile)); |
839 result.insert(std::make_pair(prioritized_tile.tile(), prioritized_tile)); | 839 result.insert(std::make_pair(prioritized_tile.tile(), prioritized_tile)); |
840 } | 840 } |
841 return result; | 841 return result; |
842 } | 842 } |
843 | 843 |
844 TilePriority PictureLayerTiling::ComputePriorityForTile( | 844 TilePriority PictureLayerTiling::ComputePriorityForTile( |
845 const Tile* tile, | 845 const Tile* tile, |
846 PriorityRectType priority_rect_type) const { | 846 PriorityRectType priority_rect_type) const { |
847 // TODO(vmpstr): See if this can be moved to iterators. | 847 // TODO(vmpstr): See if this can be moved to iterators. |
848 TilePriority::PriorityBin max_tile_priority_bin = | |
849 client_->GetMaxTilePriorityBin(); | |
850 | |
851 DCHECK_EQ(ComputePriorityRectTypeForTile(tile), priority_rect_type); | 848 DCHECK_EQ(ComputePriorityRectTypeForTile(tile), priority_rect_type); |
852 DCHECK_EQ(TileAt(tile->tiling_i_index(), tile->tiling_j_index()), tile); | 849 DCHECK_EQ(TileAt(tile->tiling_i_index(), tile->tiling_j_index()), tile); |
853 | 850 |
854 TilePriority::PriorityBin priority_bin = max_tile_priority_bin; | 851 TilePriority::PriorityBin priority_bin = client_->GetMaxTilePriorityBin(); |
855 | 852 |
856 switch (priority_rect_type) { | 853 switch (priority_rect_type) { |
857 case VISIBLE_RECT: | 854 case VISIBLE_RECT: |
858 return TilePriority(resolution_, priority_bin, 0); | 855 return TilePriority(resolution_, priority_bin, 0); |
859 case PENDING_VISIBLE_RECT: | 856 case PENDING_VISIBLE_RECT: |
860 if (max_tile_priority_bin <= TilePriority::SOON) | 857 if (priority_bin < TilePriority::SOON) |
861 return TilePriority(resolution_, TilePriority::SOON, 0); | 858 priority_bin = TilePriority::SOON; |
862 priority_bin = TilePriority::EVENTUALLY; | 859 return TilePriority(resolution_, priority_bin, 0); |
863 break; | |
864 case SKEWPORT_RECT: | 860 case SKEWPORT_RECT: |
865 case SOON_BORDER_RECT: | 861 case SOON_BORDER_RECT: |
866 if (max_tile_priority_bin <= TilePriority::SOON) | 862 if (priority_bin < TilePriority::SOON) |
867 priority_bin = TilePriority::SOON; | 863 priority_bin = TilePriority::SOON; |
868 break; | 864 break; |
869 case EVENTUALLY_RECT: | 865 case EVENTUALLY_RECT: |
870 priority_bin = TilePriority::EVENTUALLY; | 866 priority_bin = TilePriority::EVENTUALLY; |
871 break; | 867 break; |
872 } | 868 } |
873 | 869 |
874 gfx::Rect tile_bounds = | 870 gfx::Rect tile_bounds = |
875 tiling_data_.TileBounds(tile->tiling_i_index(), tile->tiling_j_index()); | 871 tiling_data_.TileBounds(tile->tiling_i_index(), tile->tiling_j_index()); |
876 DCHECK_GT(current_content_to_screen_scale_, 0.f); | 872 DCHECK_GT(current_content_to_screen_scale_, 0.f); |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1078 break; | 1074 break; |
1079 } | 1075 } |
1080 | 1076 |
1081 gfx::Rect result(origin_x, origin_y, width, height); | 1077 gfx::Rect result(origin_x, origin_y, width, height); |
1082 if (cache) | 1078 if (cache) |
1083 cache->previous_result = result; | 1079 cache->previous_result = result; |
1084 return result; | 1080 return result; |
1085 } | 1081 } |
1086 | 1082 |
1087 } // namespace cc | 1083 } // namespace cc |
OLD | NEW |