| 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 // Remove invalidated tiles from what will become a recycle tree. |
| 112 if (tilings_) |
| 113 tilings_->RemoveTilesInRegion(invalidation_); |
| 114 |
| 111 layer_impl->tilings_->SetClient(layer_impl); | 115 layer_impl->tilings_->SetClient(layer_impl); |
| 112 if (tilings_) | 116 if (tilings_) |
| 113 tilings_->SetClient(this); | 117 tilings_->SetClient(this); |
| 114 | 118 |
| 115 layer_impl->raster_page_scale_ = raster_page_scale_; | 119 layer_impl->raster_page_scale_ = raster_page_scale_; |
| 116 layer_impl->raster_device_scale_ = raster_device_scale_; | 120 layer_impl->raster_device_scale_ = raster_device_scale_; |
| 117 layer_impl->raster_source_scale_ = raster_source_scale_; | 121 layer_impl->raster_source_scale_ = raster_source_scale_; |
| 118 layer_impl->raster_contents_scale_ = raster_contents_scale_; | 122 layer_impl->raster_contents_scale_ = raster_contents_scale_; |
| 119 layer_impl->low_res_raster_contents_scale_ = low_res_raster_contents_scale_; | 123 layer_impl->low_res_raster_contents_scale_ = low_res_raster_contents_scale_; |
| 120 layer_impl->needs_post_commit_initialization_ = false; | 124 layer_impl->needs_post_commit_initialization_ = false; |
| (...skipping 542 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 663 RemoveAllTilings(); | 667 RemoveAllTilings(); |
| 664 return; | 668 return; |
| 665 } | 669 } |
| 666 | 670 |
| 667 raster_page_scale_ = other->raster_page_scale_; | 671 raster_page_scale_ = other->raster_page_scale_; |
| 668 raster_device_scale_ = other->raster_device_scale_; | 672 raster_device_scale_ = other->raster_device_scale_; |
| 669 raster_source_scale_ = other->raster_source_scale_; | 673 raster_source_scale_ = other->raster_source_scale_; |
| 670 raster_contents_scale_ = other->raster_contents_scale_; | 674 raster_contents_scale_ = other->raster_contents_scale_; |
| 671 low_res_raster_contents_scale_ = other->low_res_raster_contents_scale_; | 675 low_res_raster_contents_scale_ = other->low_res_raster_contents_scale_; |
| 672 | 676 |
| 673 // The tilings on this layer were swapped here from the active layer on | |
| 674 // activation, so they have not seen the invalidation that was given to | |
| 675 // the active layer. So union that invalidation in here, but don't save | |
| 676 // it and pass it back to the active layer again. | |
| 677 Region invalidation_from_pending_and_active = | |
| 678 UnionRegions(invalidation_, other->invalidation_); | |
| 679 | |
| 680 bool synced_high_res_tiling = false; | 677 bool synced_high_res_tiling = false; |
| 681 if (CanHaveTilings()) { | 678 if (CanHaveTilings()) { |
| 682 synced_high_res_tiling = | 679 synced_high_res_tiling = tilings_->SyncTilings( |
| 683 tilings_->SyncTilings(*other->tilings_, | 680 *other->tilings_, bounds(), invalidation_, MinimumContentsScale()); |
| 684 bounds(), | |
| 685 invalidation_from_pending_and_active, | |
| 686 MinimumContentsScale()); | |
| 687 } else { | 681 } else { |
| 688 RemoveAllTilings(); | 682 RemoveAllTilings(); |
| 689 } | 683 } |
| 690 | 684 |
| 691 // If our MinimumContentsScale has changed to prevent the twin's high res | 685 // If our MinimumContentsScale has changed to prevent the twin's high res |
| 692 // tiling from being synced, we should reset the raster scale and let it be | 686 // tiling from being synced, we should reset the raster scale and let it be |
| 693 // recalculated (1) again. This can happen if our bounds shrink to the point | 687 // recalculated (1) again. This can happen if our bounds shrink to the point |
| 694 // where min contents scale grows. | 688 // where min contents scale grows. |
| 695 // (1) - TODO(vmpstr) Instead of hoping that this will be recalculated, we | 689 // (1) - TODO(vmpstr) Instead of hoping that this will be recalculated, we |
| 696 // should refactor this code a little bit and actually recalculate this. | 690 // should refactor this code a little bit and actually recalculate this. |
| (...skipping 938 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1635 return iterator_index_ < iterators_.size(); | 1629 return iterator_index_ < iterators_.size(); |
| 1636 } | 1630 } |
| 1637 | 1631 |
| 1638 bool PictureLayerImpl::LayerEvictionTileIterator::IsCorrectType( | 1632 bool PictureLayerImpl::LayerEvictionTileIterator::IsCorrectType( |
| 1639 PictureLayerTiling::TilingEvictionTileIterator* it) const { | 1633 PictureLayerTiling::TilingEvictionTileIterator* it) const { |
| 1640 return it->get_type() == iteration_stage_ && | 1634 return it->get_type() == iteration_stage_ && |
| 1641 (**it)->required_for_activation() == required_for_activation_; | 1635 (**it)->required_for_activation() == required_for_activation_; |
| 1642 } | 1636 } |
| 1643 | 1637 |
| 1644 } // namespace cc | 1638 } // namespace cc |
| OLD | NEW |