Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(508)

Side by Side Diff: cc/resources/picture_layer_tiling.cc

Issue 413053004: cc: Fix tiling raster iterator to process all tiles correctly. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: update Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cc/resources/picture_layer_tiling.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 819 matching lines...) Expand 10 before | Expand all | Expand 10 after
830 eviction_cache_tree_priority_ = tree_priority; 830 eviction_cache_tree_priority_ = tree_priority;
831 } 831 }
832 832
833 PictureLayerTiling::TilingRasterTileIterator::TilingRasterTileIterator() 833 PictureLayerTiling::TilingRasterTileIterator::TilingRasterTileIterator()
834 : tiling_(NULL), current_tile_(NULL) {} 834 : tiling_(NULL), current_tile_(NULL) {}
835 835
836 PictureLayerTiling::TilingRasterTileIterator::TilingRasterTileIterator( 836 PictureLayerTiling::TilingRasterTileIterator::TilingRasterTileIterator(
837 PictureLayerTiling* tiling, 837 PictureLayerTiling* tiling,
838 WhichTree tree) 838 WhichTree tree)
839 : tiling_(tiling), 839 : tiling_(tiling),
840 type_(TilePriority::NOW), 840 phase_(VISIBLE_RECT),
841 visible_rect_in_content_space_( 841 visible_rect_in_content_space_(
842 tiling_->current_visible_rect_in_content_space_), 842 tiling_->current_visible_rect_in_content_space_),
843 skewport_in_content_space_(tiling_->current_skewport_), 843 skewport_in_content_space_(tiling_->current_skewport_),
844 eventually_rect_in_content_space_(tiling_->current_eventually_rect_), 844 eventually_rect_in_content_space_(tiling_->current_eventually_rect_),
845 soon_border_rect_in_content_space_(tiling_->current_soon_border_rect_), 845 soon_border_rect_in_content_space_(tiling_->current_soon_border_rect_),
846 tree_(tree), 846 tree_(tree),
847 current_tile_(NULL), 847 current_tile_(NULL),
848 visible_iterator_(&tiling->tiling_data_, 848 visible_iterator_(&tiling->tiling_data_,
849 visible_rect_in_content_space_, 849 visible_rect_in_content_space_,
850 true /* include_borders */), 850 true /* include_borders */),
851 spiral_iterator_(&tiling->tiling_data_, 851 spiral_iterator_(&tiling->tiling_data_,
852 skewport_in_content_space_, 852 skewport_in_content_space_,
853 visible_rect_in_content_space_, 853 visible_rect_in_content_space_,
854 visible_rect_in_content_space_), 854 visible_rect_in_content_space_) {
855 skewport_processed_(false) {
856 if (!visible_iterator_) { 855 if (!visible_iterator_) {
857 AdvancePhase(); 856 AdvancePhase();
858 return; 857 return;
859 } 858 }
860 859
861 current_tile_ = 860 current_tile_ =
862 tiling_->TileAt(visible_iterator_.index_x(), visible_iterator_.index_y()); 861 tiling_->TileAt(visible_iterator_.index_x(), visible_iterator_.index_y());
863 if (!current_tile_ || !TileNeedsRaster(current_tile_)) 862 if (!current_tile_ || !TileNeedsRaster(current_tile_))
864 ++(*this); 863 ++(*this);
865 } 864 }
866 865
867 PictureLayerTiling::TilingRasterTileIterator::~TilingRasterTileIterator() {} 866 PictureLayerTiling::TilingRasterTileIterator::~TilingRasterTileIterator() {}
868 867
869 void PictureLayerTiling::TilingRasterTileIterator::AdvancePhase() { 868 void PictureLayerTiling::TilingRasterTileIterator::AdvancePhase() {
870 DCHECK_LT(type_, TilePriority::EVENTUALLY); 869 DCHECK_LT(phase_, EVENTUALLY_RECT);
871 870
872 do { 871 do {
873 type_ = static_cast<TilePriority::PriorityBin>(type_ + 1); 872 phase_ = static_cast<Phase>(phase_ + 1);
874 if (type_ == TilePriority::EVENTUALLY) { 873
874 if (phase_ == SOON_BORDER_RECT) {
reveman 2014/07/24 16:38:49 nit: I would prefer a switch statement with all ph
vmpstr 2014/07/24 16:44:25 Can I push this nit off into the optimization patc
reveman 2014/07/24 16:54:18 sure, part of that patch is fine.
875 spiral_iterator_ = TilingData::SpiralDifferenceIterator(
876 &tiling_->tiling_data_,
877 soon_border_rect_in_content_space_,
878 skewport_in_content_space_,
879 visible_rect_in_content_space_);
880 } else if (phase_ == EVENTUALLY_RECT) {
875 spiral_iterator_ = TilingData::SpiralDifferenceIterator( 881 spiral_iterator_ = TilingData::SpiralDifferenceIterator(
876 &tiling_->tiling_data_, 882 &tiling_->tiling_data_,
877 eventually_rect_in_content_space_, 883 eventually_rect_in_content_space_,
878 skewport_in_content_space_, 884 skewport_in_content_space_,
879 visible_rect_in_content_space_); 885 soon_border_rect_in_content_space_);
880 } 886 }
881 887
882 while (spiral_iterator_) { 888 while (spiral_iterator_) {
883 current_tile_ = tiling_->TileAt(spiral_iterator_.index_x(), 889 current_tile_ = tiling_->TileAt(spiral_iterator_.index_x(),
884 spiral_iterator_.index_y()); 890 spiral_iterator_.index_y());
885 if (current_tile_ && TileNeedsRaster(current_tile_)) 891 if (current_tile_ && TileNeedsRaster(current_tile_))
886 break; 892 break;
887 ++spiral_iterator_; 893 ++spiral_iterator_;
888 } 894 }
889 895
890 if (!spiral_iterator_ && type_ == TilePriority::EVENTUALLY) { 896 if (!spiral_iterator_ && phase_ == EVENTUALLY_RECT) {
891 current_tile_ = NULL; 897 current_tile_ = NULL;
892 break; 898 break;
893 } 899 }
894 } while (!spiral_iterator_); 900 } while (!spiral_iterator_);
895 } 901 }
896 902
897 PictureLayerTiling::TilingRasterTileIterator& 903 PictureLayerTiling::TilingRasterTileIterator&
898 PictureLayerTiling::TilingRasterTileIterator:: 904 PictureLayerTiling::TilingRasterTileIterator::
899 operator++() { 905 operator++() {
900 current_tile_ = NULL; 906 current_tile_ = NULL;
901 while (!current_tile_ || !TileNeedsRaster(current_tile_)) { 907 while (!current_tile_ || !TileNeedsRaster(current_tile_)) {
902 std::pair<int, int> next_index; 908 std::pair<int, int> next_index;
903 switch (type_) { 909 switch (phase_) {
904 case TilePriority::NOW: 910 case VISIBLE_RECT:
905 ++visible_iterator_; 911 ++visible_iterator_;
906 if (!visible_iterator_) { 912 if (!visible_iterator_) {
907 AdvancePhase(); 913 AdvancePhase();
908 return *this; 914 return *this;
909 } 915 }
910 next_index = visible_iterator_.index(); 916 next_index = visible_iterator_.index();
911 break; 917 break;
912 case TilePriority::SOON: 918 case SKEWPORT_RECT:
919 case SOON_BORDER_RECT:
913 ++spiral_iterator_; 920 ++spiral_iterator_;
914 if (!spiral_iterator_) { 921 if (!spiral_iterator_) {
915 if (skewport_processed_) { 922 AdvancePhase();
916 AdvancePhase(); 923 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 } 924 }
930 next_index = spiral_iterator_.index(); 925 next_index = spiral_iterator_.index();
931 break; 926 break;
932 case TilePriority::EVENTUALLY: 927 case EVENTUALLY_RECT:
933 ++spiral_iterator_; 928 ++spiral_iterator_;
934 if (!spiral_iterator_) { 929 if (!spiral_iterator_) {
935 current_tile_ = NULL; 930 current_tile_ = NULL;
936 return *this; 931 return *this;
937 } 932 }
938 next_index = spiral_iterator_.index(); 933 next_index = spiral_iterator_.index();
939 break; 934 break;
940 } 935 }
941 current_tile_ = tiling_->TileAt(next_index.first, next_index.second); 936 current_tile_ = tiling_->TileAt(next_index.first, next_index.second);
942 } 937 }
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
981 DCHECK(*this); 976 DCHECK(*this);
982 do { 977 do {
983 ++tile_iterator_; 978 ++tile_iterator_;
984 } while (tile_iterator_ != tiling_->eviction_tiles_cache_.end() && 979 } while (tile_iterator_ != tiling_->eviction_tiles_cache_.end() &&
985 (!(*tile_iterator_)->HasResources())); 980 (!(*tile_iterator_)->HasResources()));
986 981
987 return *this; 982 return *this;
988 } 983 }
989 984
990 } // namespace cc 985 } // namespace cc
OLDNEW
« no previous file with comments | « cc/resources/picture_layer_tiling.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698