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 772 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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 // As a simplification, only allow activating to skip twin tiles that the |
790 // active layer is also missing when both this layer and its twin have 2 | 790 // active layer is also missing when both this layer and its twin have 2 |
791 // tilings (high and low). This avoids having to iterate/track coverage of | 791 // tilings (high and low). This avoids having to iterate/track coverage of |
792 // non-ideal tilings during the last draw call on the active layer. | 792 // non-ideal tilings during the last draw call on the active layer. |
793 if (high_res && low_res && tilings_->num_tilings() == 2 && | 793 if (ShouldHaveLowResTiling()) { |
reveman
2014/05/12 02:30:52
why this change? is this broken before this change
Sergey
2014/05/12 08:07:21
If you set create_low_res_tiling=false, you will g
reveman
2014/05/12 15:44:04
Probably not but if you're fixing a bug in the imp
Sergey
2014/05/12 23:37:47
There was one, let me make sure we have it... Actu
Sergey
2014/05/13 05:37:44
Found that test cases once again: NothingRequiredI
| |
794 twin_layer_ && twin_layer_->tilings_->num_tilings() == 2) { | 794 if (high_res && low_res && tilings_->num_tilings() == 2 && |
795 twin_low_res = GetTwinTiling(low_res); | 795 twin_layer_ && twin_layer_->tilings_->num_tilings() == 2) { |
796 if (twin_low_res) | 796 twin_low_res = GetTwinTiling(low_res); |
797 if (twin_low_res) | |
798 twin_high_res = GetTwinTiling(high_res); | |
799 } | |
800 } else { | |
801 if (high_res && tilings_->num_tilings() == 1 && | |
802 twin_layer_ && twin_layer_->tilings_->num_tilings() == 1) { | |
797 twin_high_res = GetTwinTiling(high_res); | 803 twin_high_res = GetTwinTiling(high_res); |
804 } | |
798 } | 805 } |
806 | |
799 // If this layer and its twin have different transforms, then don't compare | 807 // If this layer and its twin have different transforms, then don't compare |
800 // them and only allow activating to high res tiles, since tiles on each layer | 808 // them and only allow activating to high res tiles, since tiles on each layer |
801 // will be in different places on screen. | 809 // will be in different places on screen. |
802 if (!twin_high_res || !twin_low_res || | 810 |
803 twin_layer_->layer_tree_impl()->RequiresHighResToDraw() || | 811 if (ShouldHaveLowResTiling()) { |
804 draw_properties().screen_space_transform != | 812 if (!twin_high_res || !twin_low_res || |
805 twin_layer_->draw_properties().screen_space_transform) { | 813 twin_layer_->layer_tree_impl()->RequiresHighResToDraw() || |
806 twin_high_res = NULL; | 814 draw_properties().screen_space_transform != |
807 twin_low_res = NULL; | 815 twin_layer_->draw_properties().screen_space_transform) { |
816 twin_high_res = NULL; | |
817 twin_low_res = NULL; | |
818 } | |
819 } else { | |
820 if (!twin_high_res || | |
821 twin_layer_->layer_tree_impl()->RequiresHighResToDraw() || | |
822 draw_properties().screen_space_transform != | |
823 twin_layer_->draw_properties().screen_space_transform) { | |
824 twin_high_res = NULL; | |
825 } | |
808 } | 826 } |
809 | 827 |
810 // As a second pass, mark as required any visible high res tiles not filled in | 828 // 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. | 829 // by acceptable non-ideal tiles from the first pass. |
812 if (MarkVisibleTilesAsRequired( | 830 if (MarkVisibleTilesAsRequired( |
813 high_res, twin_high_res, contents_scale_x(), rect, missing_region)) { | 831 high_res, twin_high_res, contents_scale_x(), rect, missing_region) && |
832 ShouldHaveLowResTiling()) { | |
reveman
2014/05/12 15:44:04
is this required?
Sergey
2014/05/12 23:37:47
Actually, this one is more required, then the abov
| |
814 // As an optional third pass, if a high res tile was skipped because its | 833 // 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 | 834 // 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 | 835 // in case the active twin is substituting those for missing high res |
817 // content. | 836 // content. |
818 MarkVisibleTilesAsRequired( | 837 MarkVisibleTilesAsRequired( |
819 low_res, twin_low_res, contents_scale_x(), rect, missing_region); | 838 low_res, twin_low_res, contents_scale_x(), rect, missing_region); |
820 } | 839 } |
821 } | 840 } |
822 | 841 |
823 bool PictureLayerImpl::MarkVisibleTilesAsRequired( | 842 bool PictureLayerImpl::MarkVisibleTilesAsRequired( |
(...skipping 684 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1508 return iterator_index_ < iterators_.size(); | 1527 return iterator_index_ < iterators_.size(); |
1509 } | 1528 } |
1510 | 1529 |
1511 bool PictureLayerImpl::LayerEvictionTileIterator::IsCorrectType( | 1530 bool PictureLayerImpl::LayerEvictionTileIterator::IsCorrectType( |
1512 PictureLayerTiling::TilingEvictionTileIterator* it) const { | 1531 PictureLayerTiling::TilingEvictionTileIterator* it) const { |
1513 return it->get_type() == iteration_stage_ && | 1532 return it->get_type() == iteration_stage_ && |
1514 (**it)->required_for_activation() == required_for_activation_; | 1533 (**it)->required_for_activation() == required_for_activation_; |
1515 } | 1534 } |
1516 | 1535 |
1517 } // namespace cc | 1536 } // namespace cc |
OLD | NEW |