| 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 540 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 665 RemoveAllTilings(); | 661 RemoveAllTilings(); |
| 666 return; | 662 return; |
| 667 } | 663 } |
| 668 | 664 |
| 669 raster_page_scale_ = other->raster_page_scale_; | 665 raster_page_scale_ = other->raster_page_scale_; |
| 670 raster_device_scale_ = other->raster_device_scale_; | 666 raster_device_scale_ = other->raster_device_scale_; |
| 671 raster_source_scale_ = other->raster_source_scale_; | 667 raster_source_scale_ = other->raster_source_scale_; |
| 672 raster_contents_scale_ = other->raster_contents_scale_; | 668 raster_contents_scale_ = other->raster_contents_scale_; |
| 673 low_res_raster_contents_scale_ = other->low_res_raster_contents_scale_; | 669 low_res_raster_contents_scale_ = other->low_res_raster_contents_scale_; |
| 674 | 670 |
| 675 // Union in the other newly exposed regions as invalid. | 671 // The tilings on this layer were swapped here from the active layer on |
| 676 Region difference_region = Region(gfx::Rect(bounds())); | 672 // activation, so they have not seen the invalidation that was given to |
| 677 difference_region.Subtract(gfx::Rect(other->bounds())); | 673 // the active layer. So union that invalidation in here, but don't save |
| 678 invalidation_.Union(difference_region); | 674 // it and pass it back to the active layer again. |
| 675 Region invalidation_from_pending_and_active = |
| 676 UnionRegions(invalidation_, other->invalidation_); |
| 679 | 677 |
| 680 bool synced_high_res_tiling = false; | 678 bool synced_high_res_tiling = false; |
| 681 if (CanHaveTilings()) { | 679 if (CanHaveTilings()) { |
| 682 synced_high_res_tiling = tilings_->SyncTilings( | 680 synced_high_res_tiling = |
| 683 *other->tilings_, bounds(), invalidation_, MinimumContentsScale()); | 681 tilings_->SyncTilings(*other->tilings_, |
| 682 bounds(), |
| 683 invalidation_from_pending_and_active, |
| 684 MinimumContentsScale()); |
| 684 } else { | 685 } else { |
| 685 RemoveAllTilings(); | 686 RemoveAllTilings(); |
| 686 } | 687 } |
| 687 | 688 |
| 688 // If our MinimumContentsScale has changed to prevent the twin's high res | 689 // If our MinimumContentsScale has changed to prevent the twin's high res |
| 689 // tiling from being synced, we should reset the raster scale and let it be | 690 // tiling from being synced, we should reset the raster scale and let it be |
| 690 // recalculated (1) again. This can happen if our bounds shrink to the point | 691 // recalculated (1) again. This can happen if our bounds shrink to the point |
| 691 // where min contents scale grows. | 692 // where min contents scale grows. |
| 692 // (1) - TODO(vmpstr) Instead of hoping that this will be recalculated, we | 693 // (1) - TODO(vmpstr) Instead of hoping that this will be recalculated, we |
| 693 // should refactor this code a little bit and actually recalculate this. | 694 // should refactor this code a little bit and actually recalculate this. |
| (...skipping 935 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1629 return iterator_index_ < iterators_.size(); | 1630 return iterator_index_ < iterators_.size(); |
| 1630 } | 1631 } |
| 1631 | 1632 |
| 1632 bool PictureLayerImpl::LayerEvictionTileIterator::IsCorrectType( | 1633 bool PictureLayerImpl::LayerEvictionTileIterator::IsCorrectType( |
| 1633 PictureLayerTiling::TilingEvictionTileIterator* it) const { | 1634 PictureLayerTiling::TilingEvictionTileIterator* it) const { |
| 1634 return it->get_type() == iteration_stage_ && | 1635 return it->get_type() == iteration_stage_ && |
| 1635 (**it)->required_for_activation() == required_for_activation_; | 1636 (**it)->required_for_activation() == required_for_activation_; |
| 1636 } | 1637 } |
| 1637 | 1638 |
| 1638 } // namespace cc | 1639 } // namespace cc |
| OLD | NEW |