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 675 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
686 tile_query_rect = | 686 tile_query_rect = |
687 gfx::ScaleToEnclosingRect(tile_query_rect, 1.0f / contents_scale_); | 687 gfx::ScaleToEnclosingRect(tile_query_rect, 1.0f / contents_scale_); |
688 } | 688 } |
689 | 689 |
690 return current_occlusion_in_layer_space_.IsOccluded(tile_query_rect); | 690 return current_occlusion_in_layer_space_.IsOccluded(tile_query_rect); |
691 } | 691 } |
692 | 692 |
693 bool PictureLayerTiling::IsTileRequiredForActivation(const Tile* tile) const { | 693 bool PictureLayerTiling::IsTileRequiredForActivation(const Tile* tile) const { |
694 DCHECK_EQ(PENDING_TREE, client_->GetTree()); | 694 DCHECK_EQ(PENDING_TREE, client_->GetTree()); |
695 | 695 |
696 // Note that although this function will determine whether tile is required | 696 // Note that although this function will determine whether tile is required |
vmpstr
2014/10/24 18:02:24
Can you remove "although" here (while here :) )
ernstm
2014/10/27 21:13:56
Done.
| |
697 // for activation assuming that it is in visible (ie in the viewport). That is | 697 // for activation assuming that it is in visible (ie in the viewport). That is |
698 // to say, even if the tile is outside of the viewport, it will be treated as | 698 // to say, even if the tile is outside of the viewport, it will be treated as |
699 // if it was inside (there are no explicit checks for this). Hence, this | 699 // if it was inside (there are no explicit checks for this). Hence, this |
700 // function is only called for visible tiles to ensure we don't block | 700 // function is only called for visible tiles to ensure we don't block |
701 // activation on tiles outside of the viewport. | 701 // activation on tiles outside of the viewport. |
702 | 702 |
703 // If we are not allowed to mark tiles as required for activation, then don't | 703 // If we are not allowed to mark tiles as required for activation, then don't |
704 // do it. | 704 // do it. |
705 if (!can_require_tiles_for_activation_) | 705 if (!can_require_tiles_for_activation_) |
706 return false; | 706 return false; |
(...skipping 20 matching lines...) Expand all Loading... | |
727 Tile* twin_tile = | 727 Tile* twin_tile = |
728 twin_tiling->TileAt(tile->tiling_i_index(), tile->tiling_j_index()); | 728 twin_tiling->TileAt(tile->tiling_i_index(), tile->tiling_j_index()); |
729 // If twin tile is missing, it might not have a recording, so we don't need | 729 // If twin tile is missing, it might not have a recording, so we don't need |
730 // this tile to be required for activation. | 730 // this tile to be required for activation. |
731 if (!twin_tile) | 731 if (!twin_tile) |
732 return false; | 732 return false; |
733 | 733 |
734 return true; | 734 return true; |
735 } | 735 } |
736 | 736 |
737 bool PictureLayerTiling::IsTileRequiredForDraw(const Tile* tile) const { | |
738 DCHECK_EQ(ACTIVE_TREE, client_->GetTree()); | |
739 | |
740 // Note that although this function will determine whether tile is required | |
vmpstr
2014/10/24 18:02:24
Same here.
ernstm
2014/10/27 21:13:56
Done.
| |
741 // for draw assuming that it is in visible (ie in the viewport). That is | |
742 // to say, even if the tile is outside of the viewport, it will be treated as | |
743 // if it was inside (there are no explicit checks for this). Hence, this | |
744 // function is only called for visible tiles to ensure we don't block | |
745 // activation on tiles outside of the viewport. | |
vmpstr
2014/10/24 18:02:24
This is not correct, this should say something sim
enne (OOO)
2014/10/24 19:16:28
"activation", eh?
I know that this is a copy-past
ernstm
2014/10/27 21:13:56
Done.
| |
746 | |
747 if (resolution_ != HIGH_RESOLUTION) | |
748 return false; | |
749 | |
750 if (IsTileOccluded(tile)) | |
751 return false; | |
752 | |
753 return true; | |
754 } | |
755 | |
737 void PictureLayerTiling::UpdateTileAndTwinPriority(Tile* tile) const { | 756 void PictureLayerTiling::UpdateTileAndTwinPriority(Tile* tile) const { |
738 UpdateTilePriority(tile); | 757 UpdateTilePriority(tile); |
739 | 758 |
740 const PictureLayerTiling* twin_tiling = client_->GetTwinTiling(this); | 759 const PictureLayerTiling* twin_tiling = client_->GetTwinTiling(this); |
741 if (!tile->is_shared() || !twin_tiling) { | 760 if (!tile->is_shared() || !twin_tiling) { |
742 WhichTree tree = client_->GetTree(); | 761 WhichTree tree = client_->GetTree(); |
743 WhichTree twin_tree = tree == ACTIVE_TREE ? PENDING_TREE : ACTIVE_TREE; | 762 WhichTree twin_tree = tree == ACTIVE_TREE ? PENDING_TREE : ACTIVE_TREE; |
744 tile->SetPriority(twin_tree, TilePriority()); | 763 tile->SetPriority(twin_tree, TilePriority()); |
745 tile->set_is_occluded(twin_tree, false); | 764 tile->set_is_occluded(twin_tree, false); |
746 if (twin_tree == PENDING_TREE) | 765 if (twin_tree == PENDING_TREE) |
747 tile->set_required_for_activation(false); | 766 tile->set_required_for_activation(false); |
767 else | |
768 tile->set_required_for_draw(false); | |
748 return; | 769 return; |
749 } | 770 } |
750 | 771 |
751 twin_tiling->UpdateTilePriority(tile); | 772 twin_tiling->UpdateTilePriority(tile); |
752 } | 773 } |
753 | 774 |
754 void PictureLayerTiling::UpdateTilePriority(Tile* tile) const { | 775 void PictureLayerTiling::UpdateTilePriority(Tile* tile) const { |
755 // TODO(vmpstr): This code should return the priority instead of setting it on | 776 // TODO(vmpstr): This code should return the priority instead of setting it on |
756 // the tile. This should be a part of the change to move tile priority from | 777 // the tile. This should be a part of the change to move tile priority from |
757 // tiles into iterators. | 778 // tiles into iterators. |
758 WhichTree tree = client_->GetTree(); | 779 WhichTree tree = client_->GetTree(); |
759 | 780 |
760 DCHECK_EQ(TileAt(tile->tiling_i_index(), tile->tiling_j_index()), tile); | 781 DCHECK_EQ(TileAt(tile->tiling_i_index(), tile->tiling_j_index()), tile); |
761 gfx::Rect tile_bounds = | 782 gfx::Rect tile_bounds = |
762 tiling_data_.TileBounds(tile->tiling_i_index(), tile->tiling_j_index()); | 783 tiling_data_.TileBounds(tile->tiling_i_index(), tile->tiling_j_index()); |
763 | 784 |
764 if (current_visible_rect_.Intersects(tile_bounds)) { | 785 if (current_visible_rect_.Intersects(tile_bounds)) { |
765 tile->SetPriority(tree, TilePriority(resolution_, TilePriority::NOW, 0)); | 786 tile->SetPriority(tree, TilePriority(resolution_, TilePriority::NOW, 0)); |
766 if (tree == PENDING_TREE) | 787 if (tree == PENDING_TREE) |
767 tile->set_required_for_activation(IsTileRequiredForActivation(tile)); | 788 tile->set_required_for_activation(IsTileRequiredForActivation(tile)); |
789 else | |
790 tile->set_required_for_draw(IsTileRequiredForDraw(tile)); | |
768 tile->set_is_occluded(tree, IsTileOccluded(tile)); | 791 tile->set_is_occluded(tree, IsTileOccluded(tile)); |
769 return; | 792 return; |
770 } | 793 } |
771 | 794 |
772 if (tree == PENDING_TREE) | 795 if (tree == PENDING_TREE) |
773 tile->set_required_for_activation(false); | 796 tile->set_required_for_activation(false); |
797 else | |
798 tile->set_required_for_draw(false); | |
774 tile->set_is_occluded(tree, false); | 799 tile->set_is_occluded(tree, false); |
775 | 800 |
776 DCHECK_GT(content_to_screen_scale_, 0.f); | 801 DCHECK_GT(content_to_screen_scale_, 0.f); |
777 float distance_to_visible = | 802 float distance_to_visible = |
778 current_visible_rect_.ManhattanInternalDistance(tile_bounds) * | 803 current_visible_rect_.ManhattanInternalDistance(tile_bounds) * |
779 content_to_screen_scale_; | 804 content_to_screen_scale_; |
780 | 805 |
781 if (current_soon_border_rect_.Intersects(tile_bounds) || | 806 if (current_soon_border_rect_.Intersects(tile_bounds) || |
782 current_skewport_rect_.Intersects(tile_bounds)) { | 807 current_skewport_rect_.Intersects(tile_bounds)) { |
783 tile->SetPriority( | 808 tile->SetPriority( |
(...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1223 DCHECK(*this); | 1248 DCHECK(*this); |
1224 do { | 1249 do { |
1225 ++current_eviction_tiles_index_; | 1250 ++current_eviction_tiles_index_; |
1226 } while (current_eviction_tiles_index_ != eviction_tiles_->size() && | 1251 } while (current_eviction_tiles_index_ != eviction_tiles_->size() && |
1227 !(*eviction_tiles_)[current_eviction_tiles_index_]->HasResources()); | 1252 !(*eviction_tiles_)[current_eviction_tiles_index_]->HasResources()); |
1228 | 1253 |
1229 return *this; | 1254 return *this; |
1230 } | 1255 } |
1231 | 1256 |
1232 } // namespace cc | 1257 } // namespace cc |
OLD | NEW |