| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 const int kTileRoundUp = 64; | 52 const int kTileRoundUp = 64; |
| 53 | 53 |
| 54 // For performance reasons and to support compressed tile textures, tile | 54 // For performance reasons and to support compressed tile textures, tile |
| 55 // width and height should be an even multiple of 4 in size. | 55 // width and height should be an even multiple of 4 in size. |
| 56 const int kTileMinimalAlignment = 4; | 56 const int kTileMinimalAlignment = 4; |
| 57 | 57 |
| 58 } // namespace | 58 } // namespace |
| 59 | 59 |
| 60 namespace cc { | 60 namespace cc { |
| 61 | 61 |
| 62 PictureLayerImpl::PictureLayerImpl( | 62 PictureLayerImpl::PictureLayerImpl(LayerTreeImpl* tree_impl, |
| 63 LayerTreeImpl* tree_impl, | 63 int id, |
| 64 int id, | 64 bool is_mask) |
| 65 bool is_mask, | 65 : LayerImpl(tree_impl, id), |
| 66 scoped_refptr<SyncedScrollOffset> scroll_offset) | |
| 67 : LayerImpl(tree_impl, id, scroll_offset), | |
| 68 twin_layer_(nullptr), | 66 twin_layer_(nullptr), |
| 69 tilings_(CreatePictureLayerTilingSet()), | 67 tilings_(CreatePictureLayerTilingSet()), |
| 70 ideal_page_scale_(0.f), | 68 ideal_page_scale_(0.f), |
| 71 ideal_device_scale_(0.f), | 69 ideal_device_scale_(0.f), |
| 72 ideal_source_scale_(0.f), | 70 ideal_source_scale_(0.f), |
| 73 ideal_contents_scale_(0.f), | 71 ideal_contents_scale_(0.f), |
| 74 raster_page_scale_(0.f), | 72 raster_page_scale_(0.f), |
| 75 raster_device_scale_(0.f), | 73 raster_device_scale_(0.f), |
| 76 raster_source_scale_(0.f), | 74 raster_source_scale_(0.f), |
| 77 raster_contents_scale_(0.f), | 75 raster_contents_scale_(0.f), |
| (...skipping 10 matching lines...) Expand all Loading... |
| 88 twin_layer_->twin_layer_ = nullptr; | 86 twin_layer_->twin_layer_ = nullptr; |
| 89 layer_tree_impl()->UnregisterPictureLayerImpl(this); | 87 layer_tree_impl()->UnregisterPictureLayerImpl(this); |
| 90 } | 88 } |
| 91 | 89 |
| 92 const char* PictureLayerImpl::LayerTypeAsString() const { | 90 const char* PictureLayerImpl::LayerTypeAsString() const { |
| 93 return "cc::PictureLayerImpl"; | 91 return "cc::PictureLayerImpl"; |
| 94 } | 92 } |
| 95 | 93 |
| 96 scoped_ptr<LayerImpl> PictureLayerImpl::CreateLayerImpl( | 94 scoped_ptr<LayerImpl> PictureLayerImpl::CreateLayerImpl( |
| 97 LayerTreeImpl* tree_impl) { | 95 LayerTreeImpl* tree_impl) { |
| 98 return PictureLayerImpl::Create(tree_impl, id(), is_mask_, | 96 return PictureLayerImpl::Create(tree_impl, id(), is_mask_); |
| 99 synced_scroll_offset()); | |
| 100 } | 97 } |
| 101 | 98 |
| 102 void PictureLayerImpl::PushPropertiesTo(LayerImpl* base_layer) { | 99 void PictureLayerImpl::PushPropertiesTo(LayerImpl* base_layer) { |
| 103 PictureLayerImpl* layer_impl = static_cast<PictureLayerImpl*>(base_layer); | 100 PictureLayerImpl* layer_impl = static_cast<PictureLayerImpl*>(base_layer); |
| 104 DCHECK_EQ(layer_impl->is_mask_, is_mask_); | 101 DCHECK_EQ(layer_impl->is_mask_, is_mask_); |
| 105 | 102 |
| 106 LayerImpl::PushPropertiesTo(base_layer); | 103 LayerImpl::PushPropertiesTo(base_layer); |
| 107 | 104 |
| 108 // Twin relationships should never change once established. | 105 // Twin relationships should never change once established. |
| 109 DCHECK(!twin_layer_ || twin_layer_ == layer_impl); | 106 DCHECK(!twin_layer_ || twin_layer_ == layer_impl); |
| (...skipping 1149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1259 | 1256 |
| 1260 bool PictureLayerImpl::IsOnActiveOrPendingTree() const { | 1257 bool PictureLayerImpl::IsOnActiveOrPendingTree() const { |
| 1261 return !layer_tree_impl()->IsRecycleTree(); | 1258 return !layer_tree_impl()->IsRecycleTree(); |
| 1262 } | 1259 } |
| 1263 | 1260 |
| 1264 bool PictureLayerImpl::HasValidTilePriorities() const { | 1261 bool PictureLayerImpl::HasValidTilePriorities() const { |
| 1265 return IsOnActiveOrPendingTree() && IsDrawnRenderSurfaceLayerListMember(); | 1262 return IsOnActiveOrPendingTree() && IsDrawnRenderSurfaceLayerListMember(); |
| 1266 } | 1263 } |
| 1267 | 1264 |
| 1268 } // namespace cc | 1265 } // namespace cc |
| OLD | NEW |