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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 // disappears. | 101 // disappears. |
102 layer_impl->twin_layer_ = NULL; | 102 layer_impl->twin_layer_ = NULL; |
103 twin_layer_ = NULL; | 103 twin_layer_ = NULL; |
104 | 104 |
105 layer_impl->SetIsMask(is_mask_); | 105 layer_impl->SetIsMask(is_mask_); |
106 layer_impl->pile_ = pile_; | 106 layer_impl->pile_ = pile_; |
107 | 107 |
108 // Tilings would be expensive to push, so we swap. | 108 // Tilings would be expensive to push, so we swap. |
109 layer_impl->tilings_.swap(tilings_); | 109 layer_impl->tilings_.swap(tilings_); |
110 | 110 |
111 // Ensure that we don't have any tiles that are out of date. | |
112 if (tilings_) | |
113 tilings_->RemoveTilesInRegion(invalidation_); | |
114 | |
115 layer_impl->tilings_->SetClient(layer_impl); | 111 layer_impl->tilings_->SetClient(layer_impl); |
116 if (tilings_) | 112 if (tilings_) |
117 tilings_->SetClient(this); | 113 tilings_->SetClient(this); |
118 | 114 |
119 layer_impl->raster_page_scale_ = raster_page_scale_; | 115 layer_impl->raster_page_scale_ = raster_page_scale_; |
120 layer_impl->raster_device_scale_ = raster_device_scale_; | 116 layer_impl->raster_device_scale_ = raster_device_scale_; |
121 layer_impl->raster_source_scale_ = raster_source_scale_; | 117 layer_impl->raster_source_scale_ = raster_source_scale_; |
122 layer_impl->raster_contents_scale_ = raster_contents_scale_; | 118 layer_impl->raster_contents_scale_ = raster_contents_scale_; |
123 layer_impl->low_res_raster_contents_scale_ = low_res_raster_contents_scale_; | 119 layer_impl->low_res_raster_contents_scale_ = low_res_raster_contents_scale_; |
124 layer_impl->needs_post_commit_initialization_ = false; | 120 layer_impl->needs_post_commit_initialization_ = false; |
(...skipping 544 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
669 RemoveAllTilings(); | 665 RemoveAllTilings(); |
670 return; | 666 return; |
671 } | 667 } |
672 | 668 |
673 raster_page_scale_ = other->raster_page_scale_; | 669 raster_page_scale_ = other->raster_page_scale_; |
674 raster_device_scale_ = other->raster_device_scale_; | 670 raster_device_scale_ = other->raster_device_scale_; |
675 raster_source_scale_ = other->raster_source_scale_; | 671 raster_source_scale_ = other->raster_source_scale_; |
676 raster_contents_scale_ = other->raster_contents_scale_; | 672 raster_contents_scale_ = other->raster_contents_scale_; |
677 low_res_raster_contents_scale_ = other->low_res_raster_contents_scale_; | 673 low_res_raster_contents_scale_ = other->low_res_raster_contents_scale_; |
678 | 674 |
679 // Union in the other newly exposed regions as invalid. | 675 // The tilings on this layer were swapped here from the active layer on |
680 Region difference_region = Region(gfx::Rect(bounds())); | 676 // activation, so they have not seen the invalidation that was given to |
681 difference_region.Subtract(gfx::Rect(other->bounds())); | 677 // the active layer. So union that invalidation in here, but don't save |
682 invalidation_.Union(difference_region); | 678 // it and pass it back to the active layer again. |
| 679 Region invalidation_from_pending_and_active = |
| 680 UnionRegions(invalidation_, other->invalidation_); |
683 | 681 |
684 bool synced_high_res_tiling = false; | 682 bool synced_high_res_tiling = false; |
685 if (CanHaveTilings()) { | 683 if (CanHaveTilings()) { |
686 synced_high_res_tiling = tilings_->SyncTilings( | 684 synced_high_res_tiling = |
687 *other->tilings_, bounds(), invalidation_, MinimumContentsScale()); | 685 tilings_->SyncTilings(*other->tilings_, |
| 686 bounds(), |
| 687 invalidation_from_pending_and_active, |
| 688 MinimumContentsScale()); |
688 } else { | 689 } else { |
689 RemoveAllTilings(); | 690 RemoveAllTilings(); |
690 } | 691 } |
691 | 692 |
692 // If our MinimumContentsScale has changed to prevent the twin's high res | 693 // If our MinimumContentsScale has changed to prevent the twin's high res |
693 // tiling from being synced, we should reset the raster scale and let it be | 694 // tiling from being synced, we should reset the raster scale and let it be |
694 // recalculated (1) again. This can happen if our bounds shrink to the point | 695 // recalculated (1) again. This can happen if our bounds shrink to the point |
695 // where min contents scale grows. | 696 // where min contents scale grows. |
696 // (1) - TODO(vmpstr) Instead of hoping that this will be recalculated, we | 697 // (1) - TODO(vmpstr) Instead of hoping that this will be recalculated, we |
697 // should refactor this code a little bit and actually recalculate this. | 698 // should refactor this code a little bit and actually recalculate this. |
(...skipping 938 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1636 return iterator_index_ < iterators_.size(); | 1637 return iterator_index_ < iterators_.size(); |
1637 } | 1638 } |
1638 | 1639 |
1639 bool PictureLayerImpl::LayerEvictionTileIterator::IsCorrectType( | 1640 bool PictureLayerImpl::LayerEvictionTileIterator::IsCorrectType( |
1640 PictureLayerTiling::TilingEvictionTileIterator* it) const { | 1641 PictureLayerTiling::TilingEvictionTileIterator* it) const { |
1641 return it->get_type() == iteration_stage_ && | 1642 return it->get_type() == iteration_stage_ && |
1642 (**it)->required_for_activation() == required_for_activation_; | 1643 (**it)->required_for_activation() == required_for_activation_; |
1643 } | 1644 } |
1644 | 1645 |
1645 } // namespace cc | 1646 } // namespace cc |
OLD | NEW |