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/layers/picture_layer_impl.h" | 5 #include "cc/layers/picture_layer_impl.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <limits> | 8 #include <limits> |
| 9 | 9 |
| 10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
| (...skipping 768 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 779 } | 779 } |
| 780 DCHECK(high_res) << "There must be one high res tiling"; | 780 DCHECK(high_res) << "There must be one high res tiling"; |
| 781 | 781 |
| 782 // If these pointers are null (because no twin, no matching tiling, or the | 782 // If these pointers are null (because no twin, no matching tiling, or the |
| 783 // simpification just below), then high res tiles will be required to fill any | 783 // simpification just below), then high res tiles will be required to fill any |
| 784 // holes left by the first pass above. If the pointers are valid, then this | 784 // holes left by the first pass above. If the pointers are valid, then this |
| 785 // layer is allowed to skip any tiles that are not ready on its twin. | 785 // layer is allowed to skip any tiles that are not ready on its twin. |
| 786 const PictureLayerTiling* twin_high_res = NULL; | 786 const PictureLayerTiling* twin_high_res = NULL; |
| 787 const PictureLayerTiling* twin_low_res = NULL; | 787 const PictureLayerTiling* twin_low_res = NULL; |
| 788 | 788 |
| 789 // As a simplification, only allow activating to skip twin tiles that the | 789 if (twin_layer_) { |
| 790 // active layer is also missing when both this layer and its twin have 2 | 790 // As a simplification, only allow activating to skip twin tiles that the |
| 791 // tilings (high and low). This avoids having to iterate/track coverage of | 791 // active layer is also missing when both this layer and its twin have |
| 792 // non-ideal tilings during the last draw call on the active layer. | 792 // "simple" sets of tilings: only 2 tilings (high and low) or only 1 high |
| 793 if (high_res && low_res && tilings_->num_tilings() == 2 && | 793 // res tiling. This avoids having to iterate/track coverage of non-ideal |
| 794 twin_layer_ && twin_layer_->tilings_->num_tilings() == 2) { | 794 // tilings during the last draw call on the active layer. |
| 795 twin_low_res = GetTwinTiling(low_res); | 795 if (tilings_->num_tilings() <= 2 && |
| 796 if (twin_low_res) | 796 twin_layer_->tilings_->num_tilings() <= tilings_->num_tilings()) { |
|
Sergey
2014/05/19 08:18:27
This condition forbids a case 4 from previous comm
| |
| 797 twin_high_res = GetTwinTiling(high_res); | 797 twin_low_res = low_res ? GetTwinTiling(low_res) : NULL; |
| 798 } | 798 twin_high_res = high_res ? GetTwinTiling(high_res) : NULL; |
| 799 // If this layer and its twin have different transforms, then don't compare | 799 } |
| 800 // them and only allow activating to high res tiles, since tiles on each layer | 800 |
| 801 // will be in different places on screen. | 801 // If this layer and its twin have different transforms, then don't compare |
| 802 if (!twin_high_res || !twin_low_res || | 802 // them and only allow activating to high res tiles, since tiles on each |
| 803 twin_layer_->layer_tree_impl()->RequiresHighResToDraw() || | 803 // layer will be in different places on screen. |
| 804 draw_properties().screen_space_transform != | 804 if (twin_layer_->layer_tree_impl()->RequiresHighResToDraw() || |
| 805 twin_layer_->draw_properties().screen_space_transform) { | 805 draw_properties().screen_space_transform != |
| 806 twin_high_res = NULL; | 806 twin_layer_->draw_properties().screen_space_transform) { |
| 807 twin_low_res = NULL; | 807 twin_high_res = NULL; |
| 808 twin_low_res = NULL; | |
| 809 } | |
| 808 } | 810 } |
| 809 | 811 |
| 810 // As a second pass, mark as required any visible high res tiles not filled in | 812 // As a second pass, mark as required any visible high res tiles not filled in |
| 811 // by acceptable non-ideal tiles from the first pass. | 813 // by acceptable non-ideal tiles from the first pass. |
| 812 if (MarkVisibleTilesAsRequired( | 814 if (MarkVisibleTilesAsRequired( |
| 813 high_res, twin_high_res, contents_scale_x(), rect, missing_region)) { | 815 high_res, twin_high_res, contents_scale_x(), rect, missing_region)) { |
| 814 // As an optional third pass, if a high res tile was skipped because its | 816 // As an optional third pass, if a high res tile was skipped because its |
| 815 // twin was also missing, then fall back to mark low res tiles as required | 817 // twin was also missing, then fall back to mark low res tiles as required |
| 816 // in case the active twin is substituting those for missing high res | 818 // in case the active twin is substituting those for missing high res |
| 817 // content. | 819 // content. Only suitable, when low res is enabled. |
| 818 MarkVisibleTilesAsRequired( | 820 if (low_res) { |
| 819 low_res, twin_low_res, contents_scale_x(), rect, missing_region); | 821 MarkVisibleTilesAsRequired( |
| 822 low_res, twin_low_res, contents_scale_x(), rect, missing_region); | |
| 823 } | |
| 820 } | 824 } |
| 821 } | 825 } |
| 822 | 826 |
| 823 bool PictureLayerImpl::MarkVisibleTilesAsRequired( | 827 bool PictureLayerImpl::MarkVisibleTilesAsRequired( |
| 824 PictureLayerTiling* tiling, | 828 PictureLayerTiling* tiling, |
| 825 const PictureLayerTiling* optional_twin_tiling, | 829 const PictureLayerTiling* optional_twin_tiling, |
| 826 float contents_scale, | 830 float contents_scale, |
| 827 const gfx::Rect& rect, | 831 const gfx::Rect& rect, |
| 828 const Region& missing_region) const { | 832 const Region& missing_region) const { |
| 829 bool twin_had_missing_tile = false; | 833 bool twin_had_missing_tile = false; |
| (...skipping 678 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1508 return iterator_index_ < iterators_.size(); | 1512 return iterator_index_ < iterators_.size(); |
| 1509 } | 1513 } |
| 1510 | 1514 |
| 1511 bool PictureLayerImpl::LayerEvictionTileIterator::IsCorrectType( | 1515 bool PictureLayerImpl::LayerEvictionTileIterator::IsCorrectType( |
| 1512 PictureLayerTiling::TilingEvictionTileIterator* it) const { | 1516 PictureLayerTiling::TilingEvictionTileIterator* it) const { |
| 1513 return it->get_type() == iteration_stage_ && | 1517 return it->get_type() == iteration_stage_ && |
| 1514 (**it)->required_for_activation() == required_for_activation_; | 1518 (**it)->required_for_activation() == required_for_activation_; |
| 1515 } | 1519 } |
| 1516 | 1520 |
| 1517 } // namespace cc | 1521 } // namespace cc |
| OLD | NEW |