Chromium Code Reviews| 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 852 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 863 if (!current_tile_ || !TileNeedsRaster(current_tile_)) | 863 if (!current_tile_ || !TileNeedsRaster(current_tile_)) |
| 864 ++(*this); | 864 ++(*this); |
| 865 } | 865 } |
| 866 | 866 |
| 867 PictureLayerTiling::TilingRasterTileIterator::~TilingRasterTileIterator() {} | 867 PictureLayerTiling::TilingRasterTileIterator::~TilingRasterTileIterator() {} |
| 868 | 868 |
| 869 void PictureLayerTiling::TilingRasterTileIterator::AdvancePhase() { | 869 void PictureLayerTiling::TilingRasterTileIterator::AdvancePhase() { |
| 870 DCHECK_LT(type_, TilePriority::EVENTUALLY); | 870 DCHECK_LT(type_, TilePriority::EVENTUALLY); |
| 871 | 871 |
| 872 do { | 872 do { |
| 873 type_ = static_cast<TilePriority::PriorityBin>(type_ + 1); | 873 if (type_ == TilePriority::SOON && !skewport_processed_) |
| 874 if (type_ == TilePriority::EVENTUALLY) { | 874 skewport_processed_ = true; |
| 875 else | |
| 876 type_ = static_cast<TilePriority::PriorityBin>(type_ + 1); | |
| 877 | |
| 878 if (type_ == TilePriority::SOON && skewport_processed_) { | |
| 879 spiral_iterator_ = TilingData::SpiralDifferenceIterator( | |
| 880 &tiling_->tiling_data_, | |
| 881 soon_border_rect_in_content_space_, | |
| 882 skewport_in_content_space_, | |
| 883 visible_rect_in_content_space_); | |
| 884 } else if (type_ == TilePriority::EVENTUALLY) { | |
| 875 spiral_iterator_ = TilingData::SpiralDifferenceIterator( | 885 spiral_iterator_ = TilingData::SpiralDifferenceIterator( |
| 876 &tiling_->tiling_data_, | 886 &tiling_->tiling_data_, |
| 877 eventually_rect_in_content_space_, | 887 eventually_rect_in_content_space_, |
| 878 skewport_in_content_space_, | 888 skewport_in_content_space_, |
| 879 visible_rect_in_content_space_); | 889 soon_border_rect_in_content_space_); |
| 880 } | 890 } |
|
reveman
2014/07/24 12:50:16
I find this code a bit hard to understand. It migh
reveman
2014/07/24 13:12:23
See my comment on the other patch. Maybe an enum f
vmpstr
2014/07/24 16:33:14
Done.
| |
| 881 | 891 |
| 882 while (spiral_iterator_) { | 892 while (spiral_iterator_) { |
| 883 current_tile_ = tiling_->TileAt(spiral_iterator_.index_x(), | 893 current_tile_ = tiling_->TileAt(spiral_iterator_.index_x(), |
| 884 spiral_iterator_.index_y()); | 894 spiral_iterator_.index_y()); |
| 885 if (current_tile_ && TileNeedsRaster(current_tile_)) | 895 if (current_tile_ && TileNeedsRaster(current_tile_)) |
| 886 break; | 896 break; |
| 887 ++spiral_iterator_; | 897 ++spiral_iterator_; |
| 888 } | 898 } |
| 889 | 899 |
| 890 if (!spiral_iterator_ && type_ == TilePriority::EVENTUALLY) { | 900 if (!spiral_iterator_ && type_ == TilePriority::EVENTUALLY) { |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 905 ++visible_iterator_; | 915 ++visible_iterator_; |
| 906 if (!visible_iterator_) { | 916 if (!visible_iterator_) { |
| 907 AdvancePhase(); | 917 AdvancePhase(); |
| 908 return *this; | 918 return *this; |
| 909 } | 919 } |
| 910 next_index = visible_iterator_.index(); | 920 next_index = visible_iterator_.index(); |
| 911 break; | 921 break; |
| 912 case TilePriority::SOON: | 922 case TilePriority::SOON: |
| 913 ++spiral_iterator_; | 923 ++spiral_iterator_; |
| 914 if (!spiral_iterator_) { | 924 if (!spiral_iterator_) { |
| 915 if (skewport_processed_) { | 925 AdvancePhase(); |
| 916 AdvancePhase(); | 926 return *this; |
| 917 return *this; | |
| 918 } | |
| 919 skewport_processed_ = true; | |
| 920 spiral_iterator_ = TilingData::SpiralDifferenceIterator( | |
| 921 &tiling_->tiling_data_, | |
| 922 soon_border_rect_in_content_space_, | |
| 923 skewport_in_content_space_, | |
| 924 visible_rect_in_content_space_); | |
| 925 if (!spiral_iterator_) { | |
| 926 AdvancePhase(); | |
| 927 return *this; | |
| 928 } | |
| 929 } | 927 } |
| 930 next_index = spiral_iterator_.index(); | 928 next_index = spiral_iterator_.index(); |
| 931 break; | 929 break; |
| 932 case TilePriority::EVENTUALLY: | 930 case TilePriority::EVENTUALLY: |
| 933 ++spiral_iterator_; | 931 ++spiral_iterator_; |
| 934 if (!spiral_iterator_) { | 932 if (!spiral_iterator_) { |
| 935 current_tile_ = NULL; | 933 current_tile_ = NULL; |
| 936 return *this; | 934 return *this; |
| 937 } | 935 } |
| 938 next_index = spiral_iterator_.index(); | 936 next_index = spiral_iterator_.index(); |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 981 DCHECK(*this); | 979 DCHECK(*this); |
| 982 do { | 980 do { |
| 983 ++tile_iterator_; | 981 ++tile_iterator_; |
| 984 } while (tile_iterator_ != tiling_->eviction_tiles_cache_.end() && | 982 } while (tile_iterator_ != tiling_->eviction_tiles_cache_.end() && |
| 985 (!(*tile_iterator_)->HasResources())); | 983 (!(*tile_iterator_)->HasResources())); |
| 986 | 984 |
| 987 return *this; | 985 return *this; |
| 988 } | 986 } |
| 989 | 987 |
| 990 } // namespace cc | 988 } // namespace cc |
| OLD | NEW |