OLD | NEW |
1 // Copyright 2010 The Chromium Authors. All rights reserved. | 1 // Copyright 2010 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/layer.h" | 5 #include "cc/layers/layer.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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 subtree_property_changed_(false), | 82 subtree_property_changed_(false), |
83 background_color_(0), | 83 background_color_(0), |
84 safe_opaque_background_color_(0), | 84 safe_opaque_background_color_(0), |
85 opacity_(1.f), | 85 opacity_(1.f), |
86 blend_mode_(SkXfermode::kSrcOver_Mode), | 86 blend_mode_(SkXfermode::kSrcOver_Mode), |
87 draw_blend_mode_(SkXfermode::kSrcOver_Mode), | 87 draw_blend_mode_(SkXfermode::kSrcOver_Mode), |
88 scroll_parent_(nullptr), | 88 scroll_parent_(nullptr), |
89 clip_parent_(nullptr), | 89 clip_parent_(nullptr), |
90 replica_layer_(nullptr), | 90 replica_layer_(nullptr), |
91 client_(nullptr), | 91 client_(nullptr), |
92 num_unclipped_descendants_(0) {} | 92 num_unclipped_descendants_(0), |
| 93 has_will_change_transform_hint_(false) {} |
93 | 94 |
94 Layer::~Layer() { | 95 Layer::~Layer() { |
95 // Our parent should be holding a reference to us so there should be no | 96 // Our parent should be holding a reference to us so there should be no |
96 // way for us to be destroyed while we still have a parent. | 97 // way for us to be destroyed while we still have a parent. |
97 DCHECK(!parent()); | 98 DCHECK(!parent()); |
98 // Similarly we shouldn't have a layer tree host since it also keeps a | 99 // Similarly we shouldn't have a layer tree host since it also keeps a |
99 // reference to us. | 100 // reference to us. |
100 DCHECK(!layer_tree_host()); | 101 DCHECK(!layer_tree_host()); |
101 | 102 |
102 RemoveFromScrollTree(); | 103 RemoveFromScrollTree(); |
(...skipping 1100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1203 layer->PassCopyRequests(&main_thread_copy_requests); | 1204 layer->PassCopyRequests(&main_thread_copy_requests); |
1204 } | 1205 } |
1205 | 1206 |
1206 // If the main thread commits multiple times before the impl thread actually | 1207 // If the main thread commits multiple times before the impl thread actually |
1207 // draws, then damage tracking will become incorrect if we simply clobber the | 1208 // draws, then damage tracking will become incorrect if we simply clobber the |
1208 // update_rect here. The LayerImpl's update_rect needs to accumulate (i.e. | 1209 // update_rect here. The LayerImpl's update_rect needs to accumulate (i.e. |
1209 // union) any update changes that have occurred on the main thread. | 1210 // union) any update changes that have occurred on the main thread. |
1210 update_rect_.Union(layer->update_rect()); | 1211 update_rect_.Union(layer->update_rect()); |
1211 layer->SetUpdateRect(update_rect_); | 1212 layer->SetUpdateRect(update_rect_); |
1212 | 1213 |
| 1214 layer->set_has_will_change_transform_hint(has_will_change_transform_hint()); |
| 1215 |
1213 // Reset any state that should be cleared for the next update. | 1216 // Reset any state that should be cleared for the next update. |
1214 subtree_property_changed_ = false; | 1217 subtree_property_changed_ = false; |
1215 update_rect_ = gfx::Rect(); | 1218 update_rect_ = gfx::Rect(); |
1216 | 1219 |
1217 layer_tree_host()->RemoveLayerShouldPushProperties(this); | 1220 layer_tree_host()->RemoveLayerShouldPushProperties(this); |
1218 } | 1221 } |
1219 | 1222 |
1220 void Layer::SetTypeForProtoSerialization(proto::LayerNode* proto) const { | 1223 void Layer::SetTypeForProtoSerialization(proto::LayerNode* proto) const { |
1221 proto->set_type(proto::LayerNode::LAYER); | 1224 proto->set_type(proto::LayerNode::LAYER); |
1222 } | 1225 } |
(...skipping 530 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1753 ->data.num_copy_requests_in_subtree; | 1756 ->data.num_copy_requests_in_subtree; |
1754 } | 1757 } |
1755 | 1758 |
1756 gfx::Transform Layer::screen_space_transform() const { | 1759 gfx::Transform Layer::screen_space_transform() const { |
1757 DCHECK_NE(transform_tree_index_, -1); | 1760 DCHECK_NE(transform_tree_index_, -1); |
1758 return draw_property_utils::ScreenSpaceTransform( | 1761 return draw_property_utils::ScreenSpaceTransform( |
1759 this, layer_tree_host_->property_trees()->transform_tree); | 1762 this, layer_tree_host_->property_trees()->transform_tree); |
1760 } | 1763 } |
1761 | 1764 |
1762 } // namespace cc | 1765 } // namespace cc |
OLD | NEW |