| 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/layer_impl.h" | 5 #include "cc/layers/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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 transform_tree_index_(-1), | 77 transform_tree_index_(-1), |
| 78 effect_tree_index_(-1), | 78 effect_tree_index_(-1), |
| 79 clip_tree_index_(-1), | 79 clip_tree_index_(-1), |
| 80 scroll_tree_index_(-1), | 80 scroll_tree_index_(-1), |
| 81 sorting_context_id_(0), | 81 sorting_context_id_(0), |
| 82 current_draw_mode_(DRAW_MODE_NONE), | 82 current_draw_mode_(DRAW_MODE_NONE), |
| 83 element_id_(0), | 83 element_id_(0), |
| 84 mutable_properties_(MutableProperty::kNone), | 84 mutable_properties_(MutableProperty::kNone), |
| 85 debug_info_(nullptr), | 85 debug_info_(nullptr), |
| 86 scrolls_drawn_descendant_(false), | 86 scrolls_drawn_descendant_(false), |
| 87 layer_or_descendant_has_touch_handler_(false) { | 87 layer_or_descendant_has_touch_handler_(false), |
| 88 has_will_change_transform_hint_(false) { |
| 88 DCHECK_GT(layer_id_, 0); | 89 DCHECK_GT(layer_id_, 0); |
| 89 | 90 |
| 90 DCHECK(layer_tree_impl_); | 91 DCHECK(layer_tree_impl_); |
| 91 layer_tree_impl_->RegisterLayer(this); | 92 layer_tree_impl_->RegisterLayer(this); |
| 92 layer_tree_impl_->AddToElementMap(this); | 93 layer_tree_impl_->AddToElementMap(this); |
| 93 | 94 |
| 94 SetNeedsPushProperties(); | 95 SetNeedsPushProperties(); |
| 95 } | 96 } |
| 96 | 97 |
| 97 LayerImpl::~LayerImpl() { | 98 LayerImpl::~LayerImpl() { |
| (...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 488 // If the main thread commits multiple times before the impl thread actually | 489 // If the main thread commits multiple times before the impl thread actually |
| 489 // draws, then damage tracking will become incorrect if we simply clobber the | 490 // draws, then damage tracking will become incorrect if we simply clobber the |
| 490 // update_rect here. The LayerImpl's update_rect needs to accumulate (i.e. | 491 // update_rect here. The LayerImpl's update_rect needs to accumulate (i.e. |
| 491 // union) any update changes that have occurred on the main thread. | 492 // union) any update changes that have occurred on the main thread. |
| 492 update_rect_.Union(layer->update_rect()); | 493 update_rect_.Union(layer->update_rect()); |
| 493 layer->SetUpdateRect(update_rect_); | 494 layer->SetUpdateRect(update_rect_); |
| 494 | 495 |
| 495 if (owned_debug_info_) | 496 if (owned_debug_info_) |
| 496 layer->SetDebugInfo(std::move(owned_debug_info_)); | 497 layer->SetDebugInfo(std::move(owned_debug_info_)); |
| 497 | 498 |
| 499 layer->set_has_will_change_transform_hint(has_will_change_transform_hint()); |
| 500 |
| 498 // Reset any state that should be cleared for the next update. | 501 // Reset any state that should be cleared for the next update. |
| 499 layer_property_changed_ = false; | 502 layer_property_changed_ = false; |
| 500 update_rect_ = gfx::Rect(); | 503 update_rect_ = gfx::Rect(); |
| 501 layer_tree_impl()->RemoveLayerShouldPushProperties(this); | 504 layer_tree_impl()->RemoveLayerShouldPushProperties(this); |
| 502 } | 505 } |
| 503 | 506 |
| 504 bool LayerImpl::IsAffectedByPageScale() const { | 507 bool LayerImpl::IsAffectedByPageScale() const { |
| 505 TransformTree& transform_tree = | 508 TransformTree& transform_tree = |
| 506 layer_tree_impl()->property_trees()->transform_tree; | 509 layer_tree_impl()->property_trees()->transform_tree; |
| 507 return transform_tree.Node(transform_tree_index()) | 510 return transform_tree.Node(transform_tree_index()) |
| (...skipping 755 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1263 replica_layer_->AsValueInto(state); | 1266 replica_layer_->AsValueInto(state); |
| 1264 state->EndDictionary(); | 1267 state->EndDictionary(); |
| 1265 } | 1268 } |
| 1266 | 1269 |
| 1267 state->SetBoolean("can_use_lcd_text", can_use_lcd_text()); | 1270 state->SetBoolean("can_use_lcd_text", can_use_lcd_text()); |
| 1268 state->SetBoolean("contents_opaque", contents_opaque()); | 1271 state->SetBoolean("contents_opaque", contents_opaque()); |
| 1269 | 1272 |
| 1270 state->SetBoolean("has_animation_bounds", | 1273 state->SetBoolean("has_animation_bounds", |
| 1271 layer_tree_impl_->HasAnimationThatInflatesBounds(this)); | 1274 layer_tree_impl_->HasAnimationThatInflatesBounds(this)); |
| 1272 | 1275 |
| 1276 state->SetBoolean("has_will_change_transform_hint", |
| 1277 has_will_change_transform_hint()); |
| 1278 |
| 1273 gfx::BoxF box; | 1279 gfx::BoxF box; |
| 1274 if (LayerUtils::GetAnimationBounds(*this, &box)) | 1280 if (LayerUtils::GetAnimationBounds(*this, &box)) |
| 1275 MathUtil::AddToTracedValue("animation_bounds", box, state); | 1281 MathUtil::AddToTracedValue("animation_bounds", box, state); |
| 1276 | 1282 |
| 1277 if (debug_info_) { | 1283 if (debug_info_) { |
| 1278 std::string str; | 1284 std::string str; |
| 1279 debug_info_->AppendAsTraceFormat(&str); | 1285 debug_info_->AppendAsTraceFormat(&str); |
| 1280 base::JSONReader json_reader; | 1286 base::JSONReader json_reader; |
| 1281 std::unique_ptr<base::Value> debug_info_value(json_reader.ReadToValue(str)); | 1287 std::unique_ptr<base::Value> debug_info_value(json_reader.ReadToValue(str)); |
| 1282 | 1288 |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1410 .layer_transforms_should_scale_layer_contents) { | 1416 .layer_transforms_should_scale_layer_contents) { |
| 1411 return default_scale; | 1417 return default_scale; |
| 1412 } | 1418 } |
| 1413 | 1419 |
| 1414 gfx::Vector2dF transform_scales = MathUtil::ComputeTransform2dScaleComponents( | 1420 gfx::Vector2dF transform_scales = MathUtil::ComputeTransform2dScaleComponents( |
| 1415 DrawTransform(), default_scale); | 1421 DrawTransform(), default_scale); |
| 1416 return std::max(transform_scales.x(), transform_scales.y()); | 1422 return std::max(transform_scales.x(), transform_scales.y()); |
| 1417 } | 1423 } |
| 1418 | 1424 |
| 1419 } // namespace cc | 1425 } // namespace cc |
| OLD | NEW |