| 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 #include <set> | 9 #include <set> |
| 10 | 10 |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 // Twin relationships should never change once established. | 115 // Twin relationships should never change once established. |
| 116 DCHECK_IMPLIES(twin_layer_, twin_layer_ == layer_impl); | 116 DCHECK_IMPLIES(twin_layer_, twin_layer_ == layer_impl); |
| 117 DCHECK_IMPLIES(twin_layer_, layer_impl->twin_layer_ == this); | 117 DCHECK_IMPLIES(twin_layer_, layer_impl->twin_layer_ == this); |
| 118 // The twin relationship does not need to exist before the first | 118 // The twin relationship does not need to exist before the first |
| 119 // PushPropertiesTo from pending to active layer since before that the active | 119 // PushPropertiesTo from pending to active layer since before that the active |
| 120 // layer can not have a pile or tilings, it has only been created and inserted | 120 // layer can not have a pile or tilings, it has only been created and inserted |
| 121 // into the tree at that point. | 121 // into the tree at that point. |
| 122 twin_layer_ = layer_impl; | 122 twin_layer_ = layer_impl; |
| 123 layer_impl->twin_layer_ = this; | 123 layer_impl->twin_layer_ = this; |
| 124 | 124 |
| 125 layer_impl->pile_ = pile_; | 125 layer_impl->UpdatePile(pile_); |
| 126 | 126 |
| 127 DCHECK(!pile_->is_solid_color() || !tilings_->num_tilings()); | 127 DCHECK(!pile_->is_solid_color() || !tilings_->num_tilings()); |
| 128 // Tilings would be expensive to push, so we swap. | 128 // Tilings would be expensive to push, so we swap. |
| 129 layer_impl->tilings_.swap(tilings_); | 129 layer_impl->tilings_.swap(tilings_); |
| 130 layer_impl->tilings_->SetClient(layer_impl); | 130 layer_impl->tilings_->SetClient(layer_impl); |
| 131 if (tilings_) | 131 if (tilings_) |
| 132 tilings_->SetClient(this); | 132 tilings_->SetClient(this); |
| 133 | 133 |
| 134 // Ensure that the recycle tree doesn't have any unshared tiles. | 134 // Ensure that the recycle tree doesn't have any unshared tiles. |
| 135 if (tilings_ && pile_->is_solid_color()) | 135 if (tilings_ && pile_->is_solid_color()) |
| (...skipping 15 matching lines...) Expand all Loading... |
| 151 // in case push properties is skipped. | 151 // in case push properties is skipped. |
| 152 layer_impl->invalidation_.Swap(&invalidation_); | 152 layer_impl->invalidation_.Swap(&invalidation_); |
| 153 invalidation_.Clear(); | 153 invalidation_.Clear(); |
| 154 needs_post_commit_initialization_ = true; | 154 needs_post_commit_initialization_ = true; |
| 155 | 155 |
| 156 // We always need to push properties. | 156 // We always need to push properties. |
| 157 // See http://crbug.com/303943 | 157 // See http://crbug.com/303943 |
| 158 needs_push_properties_ = true; | 158 needs_push_properties_ = true; |
| 159 } | 159 } |
| 160 | 160 |
| 161 void PictureLayerImpl::UpdatePile(scoped_refptr<PicturePileImpl> pile) { |
| 162 bool could_have_tilings = CanHaveTilings(); |
| 163 pile_.swap(pile); |
| 164 |
| 165 // Need to call UpdateTiles again if CanHaveTilings changed. |
| 166 if (could_have_tilings != CanHaveTilings()) { |
| 167 layer_tree_impl()->set_needs_update_draw_properties(); |
| 168 } |
| 169 } |
| 170 |
| 161 void PictureLayerImpl::AppendQuads(RenderPass* render_pass, | 171 void PictureLayerImpl::AppendQuads(RenderPass* render_pass, |
| 162 const Occlusion& occlusion_in_content_space, | 172 const Occlusion& occlusion_in_content_space, |
| 163 AppendQuadsData* append_quads_data) { | 173 AppendQuadsData* append_quads_data) { |
| 164 DCHECK(!needs_post_commit_initialization_); | 174 DCHECK(!needs_post_commit_initialization_); |
| 165 // The bounds and the pile size may differ if the pile wasn't updated (ie. | 175 // The bounds and the pile size may differ if the pile wasn't updated (ie. |
| 166 // PictureLayer::Update didn't happen). But that should never be the case if | 176 // PictureLayer::Update didn't happen). But that should never be the case if |
| 167 // the layer is part of the visible frame, which is why we're appending quads | 177 // the layer is part of the visible frame, which is why we're appending quads |
| 168 // in the first place | 178 // in the first place |
| 169 DCHECK_EQ(bounds().ToString(), pile_->tiling_size().ToString()); | 179 DCHECK_EQ(bounds().ToString(), pile_->tiling_size().ToString()); |
| 170 | 180 |
| (...skipping 1541 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1712 PictureLayerTilingSet::TilingRange tiling_range = CurrentTilingRange(); | 1722 PictureLayerTilingSet::TilingRange tiling_range = CurrentTilingRange(); |
| 1713 size_t current_tiling_range_offset = current_tiling_ - tiling_range.start; | 1723 size_t current_tiling_range_offset = current_tiling_ - tiling_range.start; |
| 1714 return tiling_range.end - 1 - current_tiling_range_offset; | 1724 return tiling_range.end - 1 - current_tiling_range_offset; |
| 1715 } | 1725 } |
| 1716 } | 1726 } |
| 1717 NOTREACHED(); | 1727 NOTREACHED(); |
| 1718 return 0; | 1728 return 0; |
| 1719 } | 1729 } |
| 1720 | 1730 |
| 1721 } // namespace cc | 1731 } // namespace cc |
| OLD | NEW |